Skip to content
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

Rebuilding GLSL shaders that don't need a vid_restart #1580

Open
illwieckz opened this issue Mar 4, 2025 · 5 comments
Open

Rebuilding GLSL shaders that don't need a vid_restart #1580

illwieckz opened this issue Mar 4, 2025 · 5 comments
Labels

Comments

@illwieckz
Copy link
Member

I would like to see a mechanism that can rebuild a GLSL shader without needing a vid_restart.

I assume this would be doable for GLSL shaders not requiring to load any new data.

Not candidates:

  • r_normalMapping (requires shader parsing and image loading)
  • r_drawSky (requires shader parsing and image loading)
  • r_lightMode (requires bsp loading and image loading)

Candidates:

  • r_toneMapping
  • r_colorGrading (as far as I know the way colorGrade images are loaded may make it possible)
@illwieckz illwieckz added A-Renderer T-Feature-Request Proposed new feature labels Mar 4, 2025
@illwieckz
Copy link
Member Author

We already have some lazy shader compilation mechanism, so maybe we can just invalidate a shader to get it rebuilt.

@illwieckz
Copy link
Member Author

illwieckz commented Mar 4, 2025

We may implement a mechanism similar to Cvar::Latch(), to register shader cvars with their related GLSL shader, like that:

Cvar::Shader( r_toneMapping, gl_cameraEffectsShader );

When r_toneMapping would be modified, some code would invalidate gl_cameraEffectsShader to trigger a rebuild.

@VReaperV
Copy link
Contributor

VReaperV commented Mar 4, 2025

Do note that I'm in the process of reworking shader loading/building to a substantial degree to make it faster and fix a few issues, so any actual changes here shoud be done after that.

@illwieckz
Copy link
Member Author

Yes, don't worry I have this in the back of my mind since years, but I thought it would be the right time to share the thought.

@slipher
Copy link
Member

slipher commented Mar 6, 2025

We already have some lazy shader compilation mechanism, so maybe we can just invalidate a shader to get it rebuilt.

That's a nice idea. Maybe a simple Cvar::Callback to unload the affected shaders could really work. (Can we NUKE r_smp? It would be awfully annoying to have to sync the thread in the callback.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants