Skip to content

Allow registering shaders multiple times with different RSF_ flags #1700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 23, 2025

Conversation

slipher
Copy link
Member

@slipher slipher commented Jul 16, 2025

Same idea as #1695 but for q3shaders instead of images.

Stacked on #1699.

It's a draft in case we want to make changes related to distinguishing "2D" vs. "3D" shaders when deciding whether to use sRGB.

@slipher
Copy link
Member Author

slipher commented Jul 17, 2025

In the current version of the sRGB code, the RSF_2D flag is used for deciding whether to upload images in sRGB format triggering an sRGB-to-linear conversion. So maybe that should be considered the primary 2D vs. 3D flag. Maybe I'll rename what I'm calling RSF_IMPLICIT_3D to RSF_IMPLICIT_LIGHTING. Though it affects a couple other fiddly options for implicit shaders in addition to adding lighting.

slipher added 3 commits July 23, 2025 07:16
Allow instantiating multiple versions of a q3shader if it was registered
with different RSF_* flags each time. This will make it so that
registering stuff in a different order will not give different behavior.

NUKE shaderType_t and replace it with a new flag RSF_3D that
replicates the behavior of the old shaderType_t::3D. Previously, shaders
could be registered multiple times but only based on a differing
shaderType_t.
@slipher slipher force-pushed the shader-multi-reg branch from 39f7e67 to ae001f7 Compare July 23, 2025 12:45
@slipher slipher marked this pull request as ready for review July 23, 2025 12:47
@slipher
Copy link
Member Author

slipher commented Jul 23, 2025

Ready for review. I renamed RSF_IMPLICIT_3D to RSF_3D because RSF_2D also only affected implicit shaders. So I figure either both should have implicit in the name, or neither.

@slipher
Copy link
Member Author

slipher commented Jul 23, 2025

I wondered if the RSF_3D flag should be split up into multiple parts since it affects 4 different things (light mapping, culling, vertex colors, blending), but I didn't come up with a nice way to do it.

Copy link
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

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

LGTM.

@slipher slipher merged commit b9570ae into DaemonEngine:master Jul 23, 2025
9 checks passed
@slipher slipher deleted the shader-multi-reg branch July 23, 2025 18:31
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.

2 participants