Low priority: OpenGL error every frame in missions with a volumetric nebula
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- computer-graphics
Research direction
Start in code/graphics/opengl/gropengldeferred.cpp at the emissive texture restore after the volumetric nebula pass, and inspect the surrounding OpenGL texture-state calls. Reproduce with a mission containing a volumetric nebula in a debug build, then verify that fs2_open.log no longer reports the per-frame GL_INVALID_OPERATION error and that the emissive texture filter is restored.
Written by the indexing model from the issue text.
Description
Low priority: nothing looks wrong on screen, it only shows up as an OpenGL error in debug logs. Found while testing another PR.
Problem
On OpenGL, a mission with a volumetric nebula logs GL_INVALID_OPERATION in glBindTexture(target mismatch) about once per frame in a debug build. Missions without a volumetric nebula don't log it, and it goes away with -no_deferred.
After the volumetric nebula draws, the code switches back to the emissive texture with the one-argument GL_state.Texture.Enable(Scene_emissive_texture) (code/graphics/opengl/gropengldeferred.cpp, line 656 on master). That binds to whichever texture unit was active last, which is the unit the nebula's 3D volume texture was just bound to. So OpenGL is asked to bind a 2D texture as a 3D one and refuses. The glTexParameteri on the next line, which is meant to put the emissive texture's filter back to GL_LINEAR, then doesn't reach the emissive texture either.
Steps to reproduce
- Build current master (I used 12a36dc1a, Debug, Linux).
- Use MediaVPs 5.0.2 and a mission with a volumetric nebula. I copied MediaVPs' SM1-01 and added a
+Volumetric Nebula:block usingvolume_noise_sphere.poffrom Beyond the Aftermath 2.2.0 (any volumetric nebula should do). - Run it on OpenGL and fly for a few seconds.
- Open
fs2_open.log.
Expected vs. actual behavior
Expected: no OpenGL errors.
Actual: OpenGL Debug: ... Type:Error ... GL_INVALID_OPERATION in glBindTexture(target mismatch) every frame (19 in the first 5 seconds). A debugger breakpoint on the error puts it in opengl_texture_state::Enable(GLuint) called from gr_opengl_deferred_lighting_finish. Seen on Mesa's software OpenGL; I haven't checked a hardware OpenGL driver.
Proposed fixes
- Name the unit and target on that line:
GL_state.Texture.Enable(1, GL_TEXTURE_2D, Scene_emissive_texture). Unit 1 is where the emissive texture was bound for the nebula pass, so the filter reset after it lands on the right texture. - Set the emissive texture's filter back without depending on which unit is active, for example by binding it explicitly first in its own small helper, so later edits to the nebula pass can't break it again.
- Make the one-argument
Enablecheck that the active unit's target matches the texture it's asked to bind (and complain in debug builds), which would catch this pattern anywhere else in the OpenGL code.
- Dominant language
- C++
- Stars
- 488
- Forks
- 184
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 40
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from scp-fs2open/fs2open.github.com
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
scp-fs2open/fs2open.github.com#7918 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
scp-fs2open/fs2open.github.com#7917 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
scp-fs2open/fs2open.github.com#7916 ·
Maintainers usually reply within 1 day
-
P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuverPossibly taken @vovosta claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
scp-fs2open/fs2open.github.com#7914 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
scp-fs2open/fs2open.github.com#7899 ·
Maintainers usually reply within 1 day
All issues in scp-fs2open/fs2open.github.com
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
macOS: a double-click on a notarized altairsim is refused, and the docs give only the offline casePossibly taken @anhaoXie claimed this today. Opendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mutationpp/Mutationpp#337 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bulletphysics/bullet3#4819 ·
-
[YSQL] Local-node initdb reads postgres.bki, but YB clusters bootstrap only from yb_postgres.bkiOpenarea/ysql kind/enhancement priority/low status/awaiting-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
yugabyte/yugabyte-db#35763 ·
Maintainers usually reply within 1 day