src/third_party/angle/src/tests/gl_tests/UniformBufferTest.cpp
// Test indexing accesses uniform block with a large matrix array member correctly.
Test indexing accesses uniform block with a large matrix array member correctly.
Test indexing accesses uniform block with a large matrix array member correctly .
TEST_P(UniformBlockWithOneLargeArrayMemberTest, MemberTypeIsMatrixAndIndexAccess)
{
    const char *kFS = R"(#version 300 es
precision mediump float;
uniform uint index;
struct S { uvec4 idx; };
layout(std140) uniform idxbuf { S idxArray[2]; };
layout(std140) uniform buffer1 { mat4 s1[128]; };
layout(std140) uniform buffer2 { mat4 s2[128]; } buf2[2];
out vec4 fragColor;
void main()
{
  fragColor = s1[1][0] + s1[index][1] + s1[idxArray[0].idx.x][idxArray[1].idx.z]
  + buf2[0].s2[1][0] + buf2[1].s2[index][1] + buf2[0].s2[idxArray[0].idx.y][idxArray[1].idx.z]
  + vec4(buf2[1].s2[index][1][index], s1[1][0][2], s1[idxArray[0].idx.x][idxArray[1].idx.z][2],
  buf2[0].s2[idxArray[0].idx.y][idxArray[1].idx.z][3]);
})";
    ANGLE_GL_PROGRAM(program, essl3_shaders::vs::Simple(), kFS);
    ASSERT_GL_NO_ERROR();
}
TEST_P ( UniformBlockWithOneLargeArrayMemberTest , MemberTypeIsMatrixAndIndexAccess ) { const char * kFS = R" ( #version 300 es
precision mediump float;

uniform uint index;

struct S { uvec4 idx; };

layout(std140) uniform idxbuf { S idxArray[2]; };

layout(std140) uniform buffer1 { mat4 s1[128]; };
layout(std140) uniform buffer2 { mat4 s2[128]; } buf2[2];

out vec4 fragColor;
void main()
{
  fragColor = s1[1][0] + s1[index][1] + s1[idxArray[0].idx.x][idxArray[1].idx.z]
  + buf2[0].s2[1][0] + buf2[1].s2[index][1] + buf2[0].s2[idxArray[0].idx.y][idxArray[1].idx.z]
  + vec4(buf2[1].s2[index][1][index], s1[1][0][2], s1[idxArray[0].idx.x][idxArray[1].idx.z][2],
  buf2[0].s2[idxArray[0].idx.y][idxArray[1].idx.z][3]);
} ) " ; ANGLE_GL_PROGRAM ( program , essl3_shaders :: vs :: Simple ( ) , kFS ) ; ASSERT_GL_NO_ERROR ( ) ; }
Test indexing accesses uniform block with a large matrix array member correctly.
Test indexing accesses uniform block with a large matrix array member correctly .