-
Notifications
You must be signed in to change notification settings - Fork 62
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
Use colorModulateColorGen instead of disabling vertex color #1514
Conversation
9f18b21
to
21ac5dc
Compare
I've added a fix for #1522 here, since this pr changes the relevant code anyway. |
21ac5dc
to
b5ae49c
Compare
Originally, vertex color array was disabled if colorGen CGEN_VERTEX or CGEN_ONE_MINUS_VERTEX or alphaGen CGEN_VERTEX or CGEN_ONE_MINUS_VERTEX were used, resulting in the shader receiving the default OpenGL values for the disabled arrays (0.0, 0.0, 0.0, 1.0). Now it will instead be set via setting a bit in `u_ColorModulateColorGen`, which allows skipping the vertex format change. It will also be necessary for the geometry cache. Also fixes incorrect lighting with `tr.mapOverBrightBits = 3`.
b5ae49c
to
944ddbd
Compare
LGTM |
/* Originally, this controlled whether the vertex color array was used, | ||
now it does the equivalent by setting the color in the shader in such way as if it was using | ||
the default OpenGL values for the disabled arrays (0.0, 0.0, 0.0, 1.0) | ||
This allows to skip the vertex format change */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that related to "Vertex shader in program 11 is being recompiled based on GL state." warnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be. On my end I got this warn for the deformVertexes
shader, which does use data taken from attr_Color
. Perhaps the driver was optimising all attr_Color
and derivative usages out when the attrib was disabled, then had to recompile when it got enabled.
Originally, vertex color array was disabled if colorGen CGEN_VERTEX or CGEN_ONE_MINUS_VERTEX or alphaGen CGEN_VERTEX or CGEN_ONE_MINUS_VERTEX were used, resulting in the shader receiving the default OpenGL values for the disabled arrays (0.0, 0.0, 0.0, 1.0).
Now it will instead be set via setting a bit in
u_ColorModulateColorGen
, which allows skipping the vertex format change - changing the vertex format can require doing quite a lot in the driver i. e. being slower. It will also be necessary for the geometry cache.Also fixed the incorrect lighting with
tr.mapOverBrightBits = 3
(#1522).