Add a uint version of u_ColorModulate#1476
Conversation
01b21fa to
6dd46bd
Compare
6dd46bd to
026ba65
Compare
|
This seems to make the heat haze effect on the Plat23 forcefields lose its effect. It renders the same as if |
It is the same issue, yeah. It just so happens that for plat23 on master the size of the struct generated for the heatHaze shader at least somewhat lines up to prdouce a (non-moving) heatHaze effect, but here changing the size of |
c099442 to
43193c5
Compare
|
Light styles are off again. It seems that the light factor is not being applied to light style stages: if I set |
43193c5 to
836e1e9
Compare
This is now fixed. |
When set to >= 0, the value of this cvar (in milliseconds) will be used for time-based shader effects.
`u_Color` was a vec4 that was being set from a `Color` object, which only has 8-bit precision per colour, so using up 4 times more memory than that to transfer it was quite atrocious. Instead, pack it into a uint32_t, then use `unpackUnorm4x8()` to unpack in the shader. Also adds a macro for unpacking for hardware that doesn't support `GL_ARB_gpu_shader5`.
Add `u_ColorModulateColorGen` for use with shaders other than `cameraEffects`, since the latter can get an arbitrary vec4 for it. All other shaders only use 12 distinct states of `u_ColorModulateColorGen`, encoded as 5 bits. Also adds `u_ColorModulateLightFactor` as a global uniform, to be able to put the `genericMaterial` shader struct into 8 bytes. Fixes an issue with material shader post-processing that was removing global uniforms that had similar names to a non-global one.
Move the multiplication by tr.mapLightFactor to the generic shader, store it in `u_ColorModulateColorGen`.
`tr.mapLightFactor` is already in `u_ColorModulateColorGen` anyway, so there's no need for the extra uniform.
Also fixes extra bits beng added to the `lightFactor` part `SetUniform_ColorModulateColorGen` in some cases.
f8359f3 to
2a37d2b
Compare


Picked from #1473.
u_Colorwas a vec4 that was being set from aColorobject, which only has 8-bit precision per colour, so using up 4 times more memory than that to transfer it was quite atrocious. Instead, pack it into a uint32_t, then useunpackUnorm4x8()to unpack in the shader.Also adds a macro for unpacking for hardware that doesn't support
GL_ARB_gpu_shader5.Add
u_ColorModulateColorGenfor use with shaders other thancameraEffects, since the latter can get an arbitrary vec4 for it. All other shaders only use 12 distinct states ofu_ColorModulateColorGen, encoded as 5 bits. The map lightFactor is put into 8 bits ofu_ColorModulateColorGen.Also added an
r_forceRendererTimecvar to debug time-based renderer effects, and since it's a very simple change that I used to test theu_Colorchange, it might as well be here.Fixes an issue with material shader post-processing that was removing global uniforms that had similar names to a non-global one.