NVlabs / FPSci

Aim Training Experiments
Other
70 stars 23 forks source link

Cache session shaders manually to work around LAUNCH_SHADER assumption #300

Closed jspjutNV closed 3 years ago

jspjutNV commented 3 years ago

The G3D LAUNCH_SHADER macro has a static variable inside, assuming the same shader will be provided every time that macro is used. This PR switches to the LAUNCH_SHADER_PTR macro that allows us to control shader loading and caching explicitly.

Fixes a bug where sessions with different custom shaders would always use whichever shader was loaded first.

bboudaoud-nv commented 3 years ago

I made some minor changes to use FPSciApp::updateSession() to (re)load the shader before each session. This prevents against doing the load in an onGraphics() routine.