Description
CURRENT BEHAVIOR
When setting the RHI backend to OpenGL, either the vec4 in the MVP below is being copied by reference or the code is getting jumbled by the compiler.
The result is that setting COLOR sets the same value to vertexColor, which should not happen.
(Both COLOR and vertexColor become white)
EXPECTED
vertexColor should be a copy of the vertex color, COLOR/VAR_COLOR should be white.
REPRODUCE
Vertex Shader
layout(location=10) flat out vec4 vertexColor; //flat has no influence here
main() {
vertexColor = COLOR;
COLOR = vec4(1,1,1,1);
}
Fragment Shader
layout(location=10) flat in vec4 vertexColor; main() { // This equality check breaks in OpenGL // It will always return true, regardless of the original vertex color if (vertexColor == vec4(1,1,1,1){ BASE_COLOR = (1, 0, 0, 1); } else { BASE_COLOR = vertexColor; } }
RELATED
The following Vert shader code fixes the issue
layout(location=10) flat out vec4 vertexColor; //flat has no influence here
main() {
vertexColor.rgb = COLOR.rgb;
vertexColor.a = 1;
COLOR = vec4(1,1,1,1);
}