Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

Only generate some images/FBO when they are used

Open illwieckz opened this issue 1 year ago • 2 comments

  • Delete some images/FBO that are never used.
  • Only generate some images/FBO when they are used.
  • Also latch r_noFog since the GLSL shader since shader is built conditionally after https://github.com/DaemonEngine/Daemon/pull/1228

illwieckz avatar Aug 09 '24 18:08 illwieckz

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?

slipher avatar Aug 10 '24 04:08 slipher

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.

illwieckz avatar Aug 12 '24 22:08 illwieckz

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

slipher avatar Sep 19 '24 13:09 slipher

There's some bad spacing in the bloom commit

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

illwieckz avatar Sep 26 '24 10:09 illwieckz

For example if ( !glConfig2.bloom)

slipher avatar Sep 26 '24 16:09 slipher