hlsl: Fix struct specifiers in uniforms.
We would miss the definition for structs specfied in uniforms. Fix
this by always checking to add the constructor. Fixes the WebGL
test 'glsl/misc/struct-specifiers-in-uniforms'.
BUG=angleproject:818
BUG=433412
Change-Id: I411e4a4477f7ef34fceb9faa77489f77d8efdce8
Reviewed-on: https://chromium-review.googlesource.com/267797
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/end2end_tests/GLSLTest.cpp b/src/tests/end2end_tests/GLSLTest.cpp
index 71ee6c9..f2bcdfa 100644
--- a/src/tests/end2end_tests/GLSLTest.cpp
+++ b/src/tests/end2end_tests/GLSLTest.cpp
@@ -1047,3 +1047,23 @@
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_EQ(0, 0, 6, 0, 0, 255);
}
+
+// Test that structs defined in uniforms are translated correctly.
+TYPED_TEST(GLSLTest, StructSpecifiersUniforms)
+{
+ const std::string fragmentShaderSource = SHADER_SOURCE
+ (
+ precision mediump float;
+
+ uniform struct S { float field;} s;
+
+ void main()
+ {
+ gl_FragColor = vec4(1, 0, 0, 1);
+ gl_FragColor.a += s.field;
+ }
+ );
+
+ GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
+ EXPECT_NE(0u, program);
+}