Skip to content

Fix poisonous GLSL cache when running different architecture binaries - #2047

Merged
slipher merged 3 commits into
DaemonEngine:masterfrom
slipher:glcache-bitness
Nov 23, 2026
Merged

slipher merged 3 commits into
DaemonEngine:masterfrom
slipher:glcache-bitness

Conversation

@slipher

@slipher slipher commented Nov 22, 2026

Copy link
Copy Markdown
Member

Fixes #1604

Note: this uses a C++20 thing from <algorithm> to check for the
matching shader program descriptor.
LoadShaderBinary already checked the GL_LINK_STATUS which indicates the
error. But it failed to dispose of the program handle upon error. Then
BuildShaderProgram decides not to build anything because there is
already a program. This means we attempt to render using the program
that failed to load.

Fixes DaemonEngine#1604.
Make sure the current CPU architecture matches the one a GLSL cache file
was written with, as an additional protection against the scenario of
DaemonEngine#1604 (comment)
where the cache is poisined by changing between 32- and 64-bit binaries.
With the previous commit alone, the error is detected, but with this
commit we can avoid asking the GL driver to load the binary and avoid
warning spew.

@illwieckz illwieckz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“poisined” (not blocking)

LGTM.

Thanks a lot for taking care of that, I faced these annoyances these days.

@slipher
slipher merged commit 978c1e0 into DaemonEngine:master Nov 23, 2026
8 checks passed
@slipher
slipher deleted the glcache-bitness branch November 23, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GLSL caching bugs are still with us - and they've only grown stronger

2 participants