patriciogonzalezvivo / vera

C++/WASM GL Framework
Other
82 stars 14 forks source link

REVERT_TO_PREVIOUS_SHADER not working in certain situations #6

Closed themoep closed 1 year ago

themoep commented 1 year ago

The Problem: glslViewer is using setSource() and use() to render the canvas shader (and possibly others). The first overwrites the m_fragmentSource field and the latter calls load() with the (new) m_fragmentSource. However, load() assumes the passed source is new and reverts to the local m_fragmentSource if it fails compilation - which also fails since it is the same and always results in the SHOW_MAGENTA_SHADER setting.

I expect REVERT_TO_PREVIOUS_SHADER to always fall back to the last working shader and started working on a fix at this forked branch - however it currently falls back to the last shader, so loading a shader twice that failed compilation shows a magenta screen again.

Maybe reverting to the previous shader, even if it failed compilation, should be the behavior of REVERT_TO_PREVIOUS_SHADER and a new setting should enable the behavior I expect: REVERT_TO_LAST_WORKING_SHADER. Happy to get feedback on this.