cemu-project / Cemu

Cemu - Wii U emulator
https://cemu.info
Mozilla Public License 2.0
6.6k stars 506 forks source link

OpenGL: fix loading cached shaders from GL cache files #1209

Closed goeiecool9999 closed 1 month ago

goeiecool9999 commented 1 month ago

The code that uses glProgramBinary to load compiled shaders from shaderCache/precompiled/\<TitleID>_gl.bin files is unreachable. The fileSize variable is never changed so the function always fails. This means Cemu has been relying entirely on driver cache implementations for some time. (they must be pretty effective since nobody seems to have noticed this)

Exzap commented 1 month ago

Nice catch.

In our experience, glProgramBinary is pretty broken/useless across the board on Windows (unsure about Linux drivers). On 2 out of the 3 big vendors we had an issue where shaders would not be restored with all their state permutations. So you'd still get stutter during gameplay occasionally. The driver internal caches do not have this problem but iirc they do get invalidated on driver update. Either way thanks for the fix