GLES2: uniform struct{sampler} as a function arg
authorKai Ninomiya <kainino@chromium.org>
Sat, 27 Jan 2018 02:38:36 +0000 (18:38 -0800)
committerKai Ninomiya <kainino@chromium.org>
Mon, 29 Jan 2018 18:53:55 +0000 (10:53 -0800)
(Some of?) these tests failed on Pixel2016/7.0 (they were
fixed in 8.0 and pass on Pixel2016/8.1):
  https://crbug.com/695680
This is a port from WebGL:
  https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance/glsl/bugs/sampler-struct-function-arg.html

New tests:
  dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_vertex
  dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_fragment
  dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_array_function_arg_vertex
  dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_array_function_arg_fragment
Components: AOSP

Change-Id: Ic71a7969c9bcf481c12b95a99e6379cfec659a8e

android/cts/master/gles2-master.txt
modules/gles2/functional/es2fShaderStructTests.cpp

index 6264211..e2a1e66 100644 (file)
@@ -6613,6 +6613,10 @@ dEQP-GLES2.functional.shaders.struct.uniform.sampler_vertex
 dEQP-GLES2.functional.shaders.struct.uniform.sampler_fragment
 dEQP-GLES2.functional.shaders.struct.uniform.sampler_nested_vertex
 dEQP-GLES2.functional.shaders.struct.uniform.sampler_nested_fragment
+dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_vertex
+dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_fragment
+dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_array_function_arg_vertex
+dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_array_function_arg_fragment
 dEQP-GLES2.functional.shaders.struct.uniform.equal_vertex
 dEQP-GLES2.functional.shaders.struct.uniform.equal_fragment
 dEQP-GLES2.functional.shaders.struct.uniform.not_equal_vertex
index 555a154..292c526 100644 (file)
@@ -1859,6 +1859,58 @@ void UniformStructTests::init (void)
                        c.color.xyz() = c.texture2D(TEXTURE_BRICK, c.coords.swizzle(0,1) * 0.25f + 0.5f).swizzle(0,1,2);
                });
 
+       UNIFORM_STRUCT_CASE(sampler_in_function_arg, "Sampler in struct as function arg", FLAG_USES_TEXTURES,
+               LineStream()
+               << "${DECLARATIONS}"
+               << ""
+               << "struct S {"
+               << "    sampler2D               source;"
+               << "};"
+               << ""
+               << "mediump vec4 fun(S s) {"
+               << "    return texture2D(s.source, vec2(0.5));"
+               << "}"
+               << ""
+               << "uniform S s;"
+               << "void main (void)"
+               << "{"
+               << "    ${DST} = fun(s);"
+               << "    ${ASSIGN_POS}"
+               << "}",
+               {
+                       DE_UNREF(constCoords);
+                       setUniform(gl, programID, "s.source", 0);
+               },
+               {
+                       c.color.xyz() = c.texture2D(TEXTURE_BRICK, tcu::Vec2(0.5f, 0.5f)).swizzle(0,1,2);
+               });
+
+       UNIFORM_STRUCT_CASE(sampler_in_array_function_arg, "Sampler in struct as function arg", FLAG_USES_TEXTURES,
+               LineStream()
+               << "${DECLARATIONS}"
+               << ""
+               << "struct S {"
+               << "    sampler2D               source;"
+               << "};"
+               << ""
+               << "mediump vec4 fun(S s[2]) {"
+               << "    return texture2D(s[0].source, vec2(0.5));"
+               << "}"
+               << ""
+               << "uniform S s[2];"
+               << "void main (void)"
+               << "{"
+               << "    ${DST} = fun(s);"
+               << "    ${ASSIGN_POS}"
+               << "}",
+               {
+                       DE_UNREF(constCoords);
+                       setUniform(gl, programID, "s[0].source", 0);
+               },
+               {
+                       c.color.xyz() = c.texture2D(TEXTURE_BRICK, tcu::Vec2(0.5f, 0.5f)).swizzle(0,1,2);
+               });
+
        UNIFORM_STRUCT_CASE(equal, "Struct equality", 0,
                LineStream()
                << "${DECLARATIONS}"