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

Only generate some images/FBO when they are used #1233

Merged
merged 4 commits into from
Sep 26, 2024

Conversation

illwieckz
Copy link
Member

@illwieckz illwieckz added T-Improvement Improvement for an existing feature A-Renderer labels Aug 9, 2024
@slipher
Copy link
Member

slipher commented Aug 10, 2024

I'm not really a fan of the push to make every single renderer setting latched. Having to restart all the time is annoying both as a player who wants to experiment with settings, and when debugging. This should only be done if there are significant savings to be had (like not building 100 shader variants, or not building one that causes the shader compiler to error out). Does sky or fog support really impose a significant cost when not used?

@illwieckz illwieckz changed the title Illwieckz/unused images Only generate some images/FBO when they are used Aug 12, 2024
@illwieckz
Copy link
Member Author

Actually skipping fog GLSL / image to be built / generated when disabled was dumb because disabling fog is a cheat, so no regular player can win anything at disabling it, because they should not be able to disable it. So I reverted that.

For the sky, I really don't see the reason to build code that will not be used Disabling a feature that is not a cheat to do so has multiple benefits: better performance in game, faster GLSL compilation at game load, and less risk to hit a GLSL compilation failure because of something being unsupported and seeing the engine abort entirely.

I don't find the need to restart on latched cvars change a big deal, and we can make it even less a deal by either implementing set alternative command that would restart after setting, or even a special cvar that would automatically restart if at least one latched cvar was changed in a frame. But anyway, this still looks fine to me to restart.

I still have one thought though, those images I disable like _whiteCube or _blackCube have names, technically they may be usablein a .shader file. I don't know if that would make sense to do so and if we should consider that public API or not. If it is considered public API third-party content can rely on, we should always generate them. I found no occurrence of them from 817 .shader files from betaserv listing, so it looks like such names were never used in third-party content, meaning it was either never needed to be used, either it was never a public API, either both. So that sounds safe to me to not generate them when unneeded.

src/engine/renderer/tr_image.cpp Show resolved Hide resolved
src/engine/renderer/tr_image.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_fbo.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_image.cpp Outdated Show resolved Hide resolved
@slipher
Copy link
Member

slipher commented Sep 19, 2024

LGTM. There's some bad spacing in the bloom commit

@illwieckz
Copy link
Member Author

There's some bad spacing in the bloom commit

GitHub probably messed-up the display, as I can find none.

@illwieckz illwieckz merged commit def3c4a into master Sep 26, 2024
9 checks passed
@illwieckz illwieckz deleted the illwieckz/unused-images branch September 26, 2024 10:57
@slipher
Copy link
Member

slipher commented Sep 26, 2024

For example if ( !glConfig2.bloom)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Improvement Improvement for an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants