Repository navigation
opengl: accept the fixed-function caps a GL 1.x renderer turns off - #2995
Open
KingProNoob2 wants to merge 1 commit into
Open
KingProNoob2 wants to merge 1 commit into
KingProNoob2 wants to merge 1 commit into
Conversation
A renderer written for GL 1.x puts the fixed-function pipeline's state in order before its shader draws, so it enables and disables the lights, the lighting model, the alpha test, the fog and the texture-coordinate generators first. cap_set keeps only the caps a draw reads, so it reported each of those once as a `[RED] glDisable(…) not implemented` line: seven lines before the first draw, with nothing wrong in the picture. With a program bound the shader decides the lighting, whether a fragment is discarded and where its texture coordinates come from, so none of those caps can change a draw. cap_set now accepts them; the layer keeps no fixed-function state for them to set. t_gl_imports (test_fixed_function_caps) enables and disables each of them and checks that the state a draw reads is exactly as it was, and that a cap the layer does keep still sets its state. The GPU and --cpu forms pass. Checked: a four-minute run of a GL 1.x renderer whose draws are all GLSL (the prologue of a visual novel) with no [RED] line, and its save and backlog screens. Not checked: a game that draws through the fixed-function pipeline, which this layer does not implement at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A renderer written for GL 1.x puts the fixed-function pipeline's state in order before its GLSL draws, so it disables the lights, the lighting model, the alpha test, the fog and the texture-coordinate generators first.
cap_setkeeps only the caps a draw reads, so it reported each of them once as a[RED] glDisable(…) not implementedline — seven lines before the first draw, with nothing wrong in the picture:With a program bound the shader decides the lighting, whether a fragment is discarded and where its texture coordinates come from, so none of those caps can change a draw.
cap_setnow accepts them (GL_LIGHTING,GL_LIGHT0–7,GL_ALPHA_TEST,GL_FOG,GL_TEXTURE_GEN_S/T/R/Q,GL_COLOR_MATERIAL,GL_NORMALIZE); the layer keeps no fixed-function state for them to set.New test,
t_gl_imports/test_fixed_function_caps: it enables and disables each cap and checks that every piece of state a draw reads is exactly as it was, and that a cap the layer does keep (GL_BLEND) still sets its state.Reference entry: Fixed-function caps a GL 1.x renderer turns off (the symptom index was regenerated with
dm/tools/docs_symptoms.py).Checked
make -C dm/gfx/tests GAME=<id> check_t_gl_imports— passes in its GPU,--stubsand--cpuforms (202 shared entries, the new case among them).python3 -m unittest dm/tools/tests/test_docs.py— passes. The wholedm/tools/testssuite runs with 3 errors intest_shader_toolchain_cache(mesh target selection); they fail identically with this change stashed, so they are pre-existing on this machine (macOS 27.3, Python 3.15) and not from this change.dm/tools/lint_c.py compdb && tidywith Homebrew LLVM 23.1.5 reports no finding from this change. The one finding it puts above the baseline (t_gl_imports.m:705,bugprone-suspicious-memory-comparison) is in the upload test that501df0e2(opengl/textures: expand RED and RG uploads) added, which is already onmain.010023301E41C000v589824, a GL 3.1 renderer through EGL. Four minutes from the disclaimer through the prologue's first scene to frame 13,500: 0[RED]lines (7 before the change), 10,500–11,700 draws per 300 frames and 19 pipelines as before, 1.95 → 2.03 GB footprint, 250–260 MB of Metal allocations; the in-game menu, its save screen and the backlog render.scripts/regress.py impact main..HEADreports 0 games affected, 4 not affected (the profiles with a usage manifest are NVN games) and 184 unknown — every GL profile (Balatro, Digimon Story Cyber Sleuth, DOOM 3, Mega Man Legacy Collection, Well Dweller) has no manifest.regress.py check --games 0100217023F6C000 010029D00E740000(the two GL profiles with asmoke.tsvroute) could not run here: neither game's Mac build is on this machine. Please run it if you have those builds. Beyond the new test the change cannot alter a draw: it only stops logging caps whose state the layer never kept.[gl] framedraw and pipeline counts and the memory lines are unchanged run to run.Docs
docs/reference/rendering.md(Fixed-function caps a GL 1.x renderer turns off) andpython3 dm/tools/docs_symptoms.pywas run