P1: Changing anti-aliasing from SMAA to FXAA, then Lighting, crashes under OpenGL
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in gropenglshader.cpp, around lines 443–451, and trace the shader type lookup from the recompile-all loop after a Lighting change. Check how deleted slots are marked unused and how slot reuse handles that marker. Done when switching from SMAA to FXAA and then changing Lighting no longer crashes during shader recompilation; the issue gives these reproduction steps but names no test file.
Written by the indexing model from the issue text.
Description
Problem
Changing graphics options in the game's options menu can crash under OpenGL, on any mod. Set anti-aliasing to an SMAA mode, play with it for a moment, switch to an FXAA mode, then change the Lighting setting: the game crashes while it recompiles its shaders.
Switching away from SMAA deletes the SMAA shaders and marks their slots as unused, but the recompile that runs after a Lighting change walks every slot, including the deleted ones. For a deleted slot the shader type lookup returns nothing, and the compile code uses that result without a check (gropenglshader.cpp, around line 443-451).
Steps to reproduce
- FSO master (tested on 12a36dc1a with an ASan debug build;
gropenglshader.cppis unchanged on current master 76219fd1e), Linux, OpenGL, MediaVPs 5.0.2. Any mission. - In the options menu, set Anti-Aliasing to SMAA Low. Return to the mission and fly for a few seconds, so the SMAA shaders get compiled.
- Set Anti-Aliasing to FXAA Low. Return to the mission for a few seconds.
- Change Lighting (for example Ultra to High).
I drove the three option changes through the scripting options API (opt.Options, persistChanges), which is the same option system the menu uses. Changing SMAA to FXAA in a single step, with no frame rendered in SMAA, did not crash, because no SMAA shader had been compiled yet.
Expected vs. actual behavior
Expected: the shaders recompile and the game continues with the new lighting level.
Actual: the debug build stops on Assert(sdr_info != nullptr) in the shader compile path, called from the recompile-all loop. A release build has no assert there and reads through the null pointer (from reading the code).
Proposed fixes
- Skip deleted slots in the recompile loop. In
gr_opengl_recompile_all_shaders, skip any slot whose shader type is the "unused" marker, the same check the slot-reuse code already makes. One line. - Erase the slot instead of marking it. Have shader deletion remove the entry from the shader list (and its lookup map) so nothing that walks the list can see it. Cleaner, but every stored shader index after the removed one would shift, so it needs care.
- Make the compile function refuse an unknown type. Return early with an error when the type lookup fails, so any future caller that reaches a deleted slot is safe as well.
- 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
-
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 76/100
scp-fs2open/fs2open.github.com#7901 ·
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
-
Eval bug: minimax-m3: build_moe_ffn() drops the per-expert NVFP4 scale → garbled output (M3.1 Flash)Openbug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Status: Needs confirmation Status: Needs triage
Difficulty 1/5 Under an hour Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
[BUG] Failed archive extraction deletes the dataset cachePossibly taken @dajiaohuang claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
alibaba/GraphScope#4674 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 93/100
webarkit/WebARKitLib#107 ·
Maintainers usually reply within 1 day