Optimus laptop...How to use the on-demand mode?

I know that I have to run programs with certain environment variables:

(1) If the program uses Vulkan, __NV_PRIME_RENDER_OFFLOAD=1 is enough.
(2) __GLX_VENDOR_LIBRARY_NAME=nvidia is only needed when using GLX.
(3) How do I know which program uses Vulkan and which uses GLX ? Is there a downside to using both __NV_PRIME_RENDER_OFFLOAD=1 and __GLX_VENDOR_LIBRARY_NAME=nvidia ?

Is running ALL programs with both __NV_PRIME_RENDER_OFFLOAD=1 and __GLX_VENDOR_LIBRARY_NAME=nvidia a good idea ? Or should I figure out which program uses GLX and which uses Vulkan ?