Lines Matching refs:NL
504 …NL "layout(local_size_x = 1, local_size_y = 1) in;" NL "layout(std430) buffer Output {" NL " vec4… in Setup()
505 "} g_out;" NL "void main() {" NL " g_out.data = vec4(1.0, 2.0, 3.0, 4.0);" NL "}"; in Setup()
567 return NL "1. Verify that declared local work size has correct effect." NL in Purpose()
568 "2. Verify that the number of shader invocations is correct." NL in Purpose()
569 …3. Verify that the built-in variables: gl_WorkGroupSize, gl_WorkGroupID, gl_GlobalInvocationID," NL in Purpose()
570 " gl_LocalInvocationID and gl_LocalInvocationIndex has correct values." NL in Purpose()
576 return NL "1. Create several CS with various local sizes." NL in Method()
577 "2. Dispatch each CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
593 ss << NL "layout(local_size_x = " << x << ", local_size_y = " << y << ", local_size_z = " << z in GenSource()
594 << ") in;" NL "layout(std430, binding = " << binding in GenSource()
595 << ") buffer Output {" NL " uvec4 local_id[];" NL "} g_out;" NL "void main() {" NL in GenSource()
598 …<< ") && gl_WorkGroupID == uvec3(0) &&" NL " gl_GlobalInvocationID == gl_LocalInvocationID) {… in GenSource()
599 … " g_out.local_id[gl_LocalInvocationIndex] = uvec4(gl_LocalInvocationID, 0);" NL " } else {" NL in GenSource()
600 " g_out.local_id[gl_LocalInvocationIndex] = uvec4(0xffff);" NL " }" NL "}"; in GenSource()
728 return NL "1. Create CS which uses array of UBOs." NL in Method()
729 "2. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
730 "3. Read data from each UBO and write it to SSBO." NL "4. Verify SSBO content." NL in Method()
748 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
749 …<< ", local_size_z = " << local_size.z() << ") in;" NL "const uvec3 kGlobalSize = uvec3(" << globa… in GenSource()
751 << ");" NL "layout(std140) uniform InputBuffer {" NL " vec4 data[" in GenSource()
753 << "];" NL "} g_in_buffer[12];" NL "layout(std430) buffer OutputBuffer {" NL " vec4 data0[" in GenSource()
754 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data1[" in GenSource()
755 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data2[" in GenSource()
756 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data3[" in GenSource()
757 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data4[" in GenSource()
758 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data5[" in GenSource()
759 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data6[" in GenSource()
760 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data7[" in GenSource()
761 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data8[" in GenSource()
762 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data9[" in GenSource()
763 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data10[" in GenSource()
764 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data11[" in GenSource()
766 …<< "];" NL "} g_out_buffer;" NL "void main() {" NL " const uint global_index = gl_GlobalInvocatio… in GenSource()
767 " gl_GlobalInvocationID.y * kGlobalSize.x +" NL in GenSource()
768 " gl_GlobalInvocationID.z * kGlobalSize.x * kGlobalSize.y;" NL in GenSource()
769 " g_out_buffer.data0[global_index] = g_in_buffer[0].data[global_index];" NL in GenSource()
770 " g_out_buffer.data1[global_index] = g_in_buffer[1].data[global_index];" NL in GenSource()
771 " g_out_buffer.data2[global_index] = g_in_buffer[2].data[global_index];" NL in GenSource()
772 " g_out_buffer.data3[global_index] = g_in_buffer[3].data[global_index];" NL in GenSource()
773 " g_out_buffer.data4[global_index] = g_in_buffer[4].data[global_index];" NL in GenSource()
774 " g_out_buffer.data5[global_index] = g_in_buffer[5].data[global_index];" NL in GenSource()
775 " g_out_buffer.data6[global_index] = g_in_buffer[6].data[global_index];" NL in GenSource()
776 " g_out_buffer.data7[global_index] = g_in_buffer[7].data[global_index];" NL in GenSource()
777 " g_out_buffer.data8[global_index] = g_in_buffer[8].data[global_index];" NL in GenSource()
778 " g_out_buffer.data9[global_index] = g_in_buffer[9].data[global_index];" NL in GenSource()
779 " g_out_buffer.data10[global_index] = g_in_buffer[10].data[global_index];" NL in GenSource()
780 " g_out_buffer.data11[global_index] = g_in_buffer[11].data[global_index];" NL "}"; in GenSource()
911 return NL "Compute Shader resources - Textures"; in Title()
916 return NL "Verify that texture access works correctly in CS."; in Purpose()
921 …return NL "1. Create CS which uses all sampler types (sampler1D, sampler2D, sampler3D, sampler2DRe… in Method()
922 " sampler1DArray, sampler2DArray, samplerBuffer, sampler2DMS, sampler2DMSArray)." NL in Method()
923 "2. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
924 "3. Sample each texture and write sampled value to SSBO." NL "4. Verify SSBO content." NL in Method()
930 return NL "Everything works as expected."; in PassCriteria()
943 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
944 …<< ", local_size_z = " << local_size.z() << ") in;" NL "const uvec3 kGlobalSize = uvec3(" << globa… in GenSource()
946 << ");" NL "uniform sampler1D g_sampler0;" NL "uniform sampler2D g_sampler1;" NL in GenSource()
947 "uniform sampler3D g_sampler2;" NL "uniform sampler2DRect g_sampler3;" NL in GenSource()
948 "uniform sampler1DArray g_sampler4;" NL "uniform sampler2DArray g_sampler5;" NL in GenSource()
949 "uniform samplerBuffer g_sampler6;" NL "uniform sampler2DMS g_sampler7;" NL in GenSource()
950 …"uniform sampler2DMSArray g_sampler8;" NL "layout(std430) buffer OutputBuffer {" NL " vec4 data0[" in GenSource()
951 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data1[" in GenSource()
952 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data2[" in GenSource()
953 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data3[" in GenSource()
954 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data4[" in GenSource()
955 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data5[" in GenSource()
956 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data6[" in GenSource()
957 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data7[" in GenSource()
958 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data8[" in GenSource()
960 …<< "];" NL "} g_out_buffer;" NL "void main() {" NL " const uint global_index = gl_GlobalInvocatio… in GenSource()
961 " gl_GlobalInvocationID.y * kGlobalSize.x +" NL in GenSource()
962 " gl_GlobalInvocationID.z * kGlobalSize.x * kGlobalSize.y;" NL in GenSource()
963 … " g_out_buffer.data0[global_index] = texelFetch(g_sampler0, int(gl_GlobalInvocationID), 0);" NL in GenSource()
965 "vec2(kGlobalSize));" NL " g_out_buffer.data2[global_index] = textureProj(g_sampler2, " in GenSource()
966 "vec4(vec3(gl_GlobalInvocationID) / vec3(kGlobalSize), 1.0));" NL in GenSource()
968 "1.0), ivec2(0));" NL " g_out_buffer.data4[global_index] = textureLodOffset(g_sampler4, " in GenSource()
970 "0);" NL " g_out_buffer.data5[global_index] = texelFetchOffset(g_sampler5, " in GenSource()
971 "ivec3(gl_GlobalInvocationID), 0, ivec2(0));" NL in GenSource()
972 " g_out_buffer.data6[global_index] = texelFetch(g_sampler6, int(global_index));" NL in GenSource()
973 … " g_out_buffer.data7[global_index] = texelFetch(g_sampler7, ivec2(gl_GlobalInvocationID), 1);" NL in GenSource()
974 …_out_buffer.data8[global_index] = texelFetch(g_sampler8, ivec3(gl_GlobalInvocationID), 2);" NL "}"; in GenSource()
1145 return NL "Compute Shader resources - Images"; in Title()
1150 return NL "Verify that reading/writing GPU memory via image variables work as expected."; in Purpose()
1155 …return NL "1. Create CS which uses two image2D variables to read and write underlying GPU memory."… in Method()
1156 "2. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
1157 "3. Verify memory content." NL "4. Repeat for different texture and CS work sizes."; in Method()
1162 return NL "Everything works as expected."; in PassCriteria()
1175 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
1177 << ") in;" NL "layout(rgba32f) coherent uniform image2D g_image1;" NL in GenSource()
1178 "layout(rgba32f) uniform image2D g_image2;" NL "const uvec3 kGlobalSize = uvec3(" in GenSource()
1180 << ");" NL "void main() {" NL in GenSource()
1181 … (gl_GlobalInvocationID.x >= kGlobalSize.x || gl_GlobalInvocationID.y >= kGlobalSize.y) return;" NL in GenSource()
1182 " vec4 color = vec4(gl_GlobalInvocationID.x + gl_GlobalInvocationID.y) / 255.0;" NL in GenSource()
1183 " imageStore(g_image1, ivec2(gl_GlobalInvocationID), color);" NL in GenSource()
1184 " vec4 c = imageLoad(g_image1, ivec2(gl_GlobalInvocationID));" NL in GenSource()
1185 " imageStore(g_image2, ivec2(gl_GlobalInvocationID), c);" NL "}"; in GenSource()
1286 NL "out StageData {" NL " vec2 texcoord;" NL "} vs_out;" NL in Run()
1287 … vec2 g_quad[] = vec2[](vec2(-1, -1), vec2(1, -1), vec2(-1, 1), vec2(1, 1));" NL "void main() {" NL in Run()
1288 " gl_Position = vec4(g_quad[gl_VertexID], 0, 1);" NL in Run()
1289 " vs_out.texcoord = 0.5 + 0.5 * g_quad[gl_VertexID];" NL "}"; in Run()
1292 …NL "in StageData {" NL " vec2 texcoord;" NL "} fs_in;" NL "layout(location = 0) out vec4 o_color;… in Run()
1293 "uniform sampler2D g_image1;" NL "uniform sampler2D g_image2;" NL "void main() {" NL in Run()
1294 …" vec4 c1 = texture(g_image1, fs_in.texcoord);" NL " vec4 c2 = texture(g_image2, fs_in.texcoord)… in Run()
1295 " if (c1 == c2) o_color = c1;" NL " else o_color = vec4(1, 0, 0, 1);" NL "}"; in Run()
1351 return NL in Purpose()
1352 "1. Verify that Atomic Counters work as expected in CS." NL in Purpose()
1353 …rify that built-in functions: atomicCounterIncrement and atomicCounterDecrement work correctly." NL in Purpose()
1354 "3. Verify that GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER is accepted by" NL in Purpose()
1360 return NL in Method()
1361 "1. Create CS which uses two atomic_uint variables." NL in Method()
1362 …S write values returned by atomicCounterIncrement and atomicCounterDecrement functions to SSBO." NL in Method()
1363 …atch CS with DispatchCompute and DispatchComputeIndirect commands." NL "4. Verify SSBO content." NL in Method()
1381 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
1383 << ") in;" NL "layout(std430, binding = 0) buffer Output {" NL " uint inc_data[" in GenSource()
1384 << global_size.x() * global_size.y() * global_size.z() << "];" NL " uint dec_data[" in GenSource()
1386 << "];" NL "};" NL "layout(binding = 0, offset = 0) uniform atomic_uint g_inc_counter;" NL in GenSource()
1387 "layout(binding = 1, offset = 0) uniform atomic_uint g_dec_counter;" NL "void main() {" NL in GenSource()
1388 … " const uint index = atomicCounterIncrement(g_inc_counter);" NL " inc_data[index] = index;" NL in GenSource()
1389 " dec_data[index] = atomicCounterDecrement(g_dec_counter);" NL "}"; in GenSource()
1534 return NL "1. Verify that subroutines work as expected in CS." NL in Purpose()
1535 "2. Verify that subroutines array can be indexed with gl_WorkGroupID built-in variable." NL in Purpose()
1536 "3. Verify that atomicCounterIncrement, imageLoad and texelFetch functions" NL in Purpose()
1542 return NL "1. Create CS which uses array of subroutines." NL in Method()
1543 "2. In CS index subroutine array with gl_WorkGroupID built-in variable." NL in Method()
1544 "3. In each subroutine load data from SSBO0 and write it to SSBO1." NL in Method()
1545 "3. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
1546 "4. Verify SSBO1 content." NL "5. Repeat for different buffer and CS work sizes."; in Method()
1573 …NL "layout(local_size_x = 16) in;" NL "layout(binding = 1, std430) buffer Input {" NL " uvec4 dat… in Run()
1574 …"} g_input;" NL "layout(std430, binding = 0) buffer Output {" NL " uvec4 g_output[64];" NL "};" NL in Run()
1575 "subroutine void ComputeType();" NL "subroutine uniform ComputeType Compute[4];" NL in Run()
1576 "layout(binding = 0, offset = 0) uniform atomic_uint g_atomic_counter;" NL in Run()
1577 "layout(rgba32ui) readonly uniform uimageBuffer g_image_buffer;" NL in Run()
1578 … "uniform usamplerBuffer g_sampler_buffer;" NL "subroutine(ComputeType)" NL "void Compute0() {" NL in Run()
1579 " const uint index = atomicCounterIncrement(g_atomic_counter);" NL in Run()
1580 … " g_output[index] = uvec4(index);" NL "}" NL "subroutine(ComputeType)" NL "void Compute1() {" NL in Run()
1581 " g_output[gl_GlobalInvocationID.x] = g_input.data[gl_LocalInvocationIndex];" NL "}" NL in Run()
1582 "subroutine(ComputeType)" NL "void Compute2() {" NL in Run()
1583 …" g_output[gl_GlobalInvocationID.x] = imageLoad(g_image_buffer, int(gl_LocalInvocationIndex));" NL in Run()
1584 "}" NL "subroutine(ComputeType)" NL "void Compute3() {" NL in Run()
1585 …g_output[gl_GlobalInvocationID.x] = texelFetch(g_sampler_buffer, int(gl_LocalInvocationIndex));" NL in Run()
1586 "}" NL "void main() {" NL " Compute[gl_WorkGroupID.x]();" NL "}"; in Run()
1720 return NL "1. Verify that all types of uniform variables work as expected in CS." NL in Purpose()
1721 … "2. Verify that uniform variables can be updated with Uniform* and ProgramUniform* commands." NL in Purpose()
1727 …return NL "1. Create CS which uses all (single precision and integer) types of uniform variables."… in Method()
1728 "2. Update uniform variables with ProgramUniform* commands." NL in Method()
1729 "3. Verify that uniform variables were updated correctly." NL "4. Re-link CS program." NL in Method()
1730 "5. Update uniform variables with Uniform* commands." NL in Method()
1751 const char* const glsl_cs = NL in Run()
1752 …"layout(local_size_x = 1) in;" NL "buffer Result {" NL " int g_result;" NL "};" NL "uniform float… in Run()
1753 "uniform vec2 g_1;" NL "uniform vec3 g_2;" NL "uniform vec4 g_3;" NL "uniform mat2 g_4;" NL in Run()
1754 "uniform mat2x3 g_5;" NL "uniform mat2x4 g_6;" NL "uniform mat3x2 g_7;" NL "uniform mat3 g_8;" NL in Run()
1755 …"uniform mat3x4 g_9;" NL "uniform mat4x2 g_10;" NL "uniform mat4x3 g_11;" NL "uniform mat4 g_12;" … in Run()
1756 "uniform int g_13;" NL "uniform ivec2 g_14;" NL "uniform ivec3 g_15;" NL "uniform ivec4 g_16;" NL in Run()
1757 …"uniform uint g_17;" NL "uniform uvec2 g_18;" NL "uniform uvec3 g_19;" NL "uniform uvec4 g_20;" NL… in Run()
1758 "void main() {" NL " g_result = 1;" NL NL " if (g_0 != 1.0) g_result = 0;" NL in Run()
1759 …" if (g_1 != vec2(2.0, 3.0)) g_result = 0;" NL " if (g_2 != vec3(4.0, 5.0, 6.0)) g_result = 0;" … in Run()
1760 " if (g_3 != vec4(7.0, 8.0, 9.0, 10.0)) g_result = 0;" NL NL in Run()
1761 " if (g_4 != mat2(11.0, 12.0, 13.0, 14.0)) g_result = 0;" NL in Run()
1762 " if (g_5 != mat2x3(15.0, 16.0, 17.0, 18.0, 19.0, 20.0)) g_result = 0;" NL in Run()
1763 " if (g_6 != mat2x4(21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0)) g_result = 0;" NL NL in Run()
1764 " if (g_7 != mat3x2(29.0, 30.0, 31.0, 32.0, 33.0, 34.0)) g_result = 0;" NL in Run()
1765 " if (g_8 != mat3(35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0)) g_result = 0;" NL in Run()
1767 …"0;" NL NL " if (g_10 != mat4x2(56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0)) g_result = 0;" NL in Run()
1769 …"0;" NL " if (g_12 != mat4(75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0… in Run()
1770 "88.0, 89.0, 90.0)) g_result = 0;" NL NL " if (g_13 != 91) g_result = 0;" NL in Run()
1771 …" if (g_14 != ivec2(92, 93)) g_result = 0;" NL " if (g_15 != ivec3(94, 95, 96)) g_result = 0;" NL in Run()
1772 … " if (g_16 != ivec4(97, 98, 99, 100)) g_result = 0;" NL NL " if (g_17 != 101u) g_result = 0;" NL in Run()
1773 " if (g_18 != uvec2(102u, 103u)) g_result = 0;" NL in Run()
1774 " if (g_19 != uvec3(104u, 105u, 106u)) g_result = 0;" NL in Run()
1775 " if (g_20 != uvec4(107u, 108u, 109u, 110u)) g_result = 0;" NL "}"; in Run()
1983 return NL "Verify that all (gl_WorkGroupSize, gl_WorkGroupID, gl_LocalInvocationID," NL in Purpose()
1984 "gl_GlobalInvocationID, gl_NumWorkGroups, gl_WorkGroupSize)" NL in Purpose()
1990 return NL "1. Create CS which writes all built-in variables to SSBO." NL in Method()
1991 "2. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
1992 "3. Verify SSBO content." NL "4. Repeat for several different local and global work sizes."; in Method()
2008 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
2009 …<< ", local_size_z = " << local_size.z() << ") in;" NL "const uvec3 kGlobalSize = uvec3(" << globa… in GenSource()
2011 << ");" NL "layout(std430) buffer OutputBuffer {" NL " uvec4 num_work_groups[" in GenSource()
2012 << global_size.x() * global_size.y() * global_size.z() << "];" NL " uvec4 work_group_size[" in GenSource()
2013 << global_size.x() * global_size.y() * global_size.z() << "];" NL " uvec4 work_group_id[" in GenSource()
2014 … << global_size.x() * global_size.y() * global_size.z() << "];" NL " uvec4 local_invocation_id[" in GenSource()
2015 … << global_size.x() * global_size.y() * global_size.z() << "];" NL " uvec4 global_invocation_id[" in GenSource()
2016 …<< global_size.x() * global_size.y() * global_size.z() << "];" NL " uvec4 local_invocation_index[" in GenSource()
2018 << "];" NL "} g_out_buffer;" NL "void main() {" NL in GenSource()
2019 …f ((gl_WorkGroupSize * gl_WorkGroupID + gl_LocalInvocationID) != gl_GlobalInvocationID) return;" NL in GenSource()
2020 " const uint global_index = gl_GlobalInvocationID.x +" NL in GenSource()
2021 " gl_GlobalInvocationID.y * kGlobalSize.x +" NL in GenSource()
2022 " gl_GlobalInvocationID.z * kGlobalSize.x * kGlobalSize.y;" NL in GenSource()
2023 " g_out_buffer.num_work_groups[global_index] = uvec4(gl_NumWorkGroups, 0);" NL in GenSource()
2024 " g_out_buffer.work_group_size[global_index] = uvec4(gl_WorkGroupSize, 0);" NL in GenSource()
2025 " g_out_buffer.work_group_id[global_index] = uvec4(gl_WorkGroupID, 0);" NL in GenSource()
2026 " g_out_buffer.local_invocation_id[global_index] = uvec4(gl_LocalInvocationID, 0);" NL in GenSource()
2027 " g_out_buffer.global_invocation_id[global_index] = uvec4(gl_GlobalInvocationID, 0);" NL in GenSource()
2028 " g_out_buffer.local_invocation_index[global_index] = uvec4(gl_LocalInvocationIndex);" NL "}"; in GenSource()
2193 return NL "CS max values"; in Title()
2198 …return NL "Verify (on the API and GLSL side) that all GL_MAX_COMPUTE_* values are not less than" NL in Purpose()
2204 …return NL "1. Use all API commands to query all GL_MAX_COMPUTE_* values. Verify that they are corr… in Method()
2210 return NL "Everything works as expected."; in PassCriteria()
2374 …NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL " int g_output;" NL "};"… in Run()
2375 "uniform ivec3 MaxComputeWorkGroupCount;" NL "uniform ivec3 MaxComputeWorkGroupSize;" NL in Run()
2376 "uniform int MaxComputeUniformComponents;" NL "uniform int MaxComputeTextureImageUnits;" NL in Run()
2377 "uniform int MaxComputeImageUniforms;" NL "uniform int MaxComputeAtomicCounters;" NL in Run()
2378 "uniform int MaxComputeAtomicCounterBuffers;" NL "void main() {" NL " g_output = 1;" NL in Run()
2379 " if (MaxComputeWorkGroupCount != gl_MaxComputeWorkGroupCount) g_output = 0;" NL in Run()
2380 " if (MaxComputeWorkGroupSize != gl_MaxComputeWorkGroupSize) g_output = 0;" NL in Run()
2381 " if (MaxComputeUniformComponents != gl_MaxComputeUniformComponents) g_output = 0;" NL in Run()
2382 " if (MaxComputeTextureImageUnits != gl_MaxComputeTextureImageUnits) g_output = 0;" NL in Run()
2383 " if (MaxComputeImageUniforms != gl_MaxComputeImageUniforms) g_output = 0;" NL in Run()
2384 " if (MaxComputeAtomicCounters != gl_MaxComputeAtomicCounters) g_output = 0;" NL in Run()
2385 … " if (MaxComputeAtomicCounterBuffers != gl_MaxComputeAtomicCounterBuffers) g_output = 0;" NL "}"; in Run()
2449 return NL "1. Verify that building monolithic CS program works as expected." NL in Purpose()
2450 "2. Verify that program consisting from 3 compilation units links as expected." NL in Purpose()
2456 …return NL "1. Create, compile and link CS using CreateShader, CompileShader and LinkProgram comman… in Method()
2469 NL "layout(local_size_x = 1) in;" NL "void Run();" NL "void main() {" NL in Run()
2470 " Run();" NL "}" }; in Run()
2473 …"#version 430 core" NL "layout(binding = 0, std430) buffer Output {" NL " vec4 g_output;" NL "};"… in Run()
2474 "vec4 CalculateOutput();" NL "void Run() {" NL " g_output = CalculateOutput();" NL "}"; in Run()
2477 …"#version 430 core" NL "layout(local_size_x = 1) in;" NL "layout(binding = 0, std430) buffer Outpu… in Run()
2478 " vec4 g_output;" NL "};" NL "vec4 CalculateOutput() {" NL " g_output = vec4(0);" NL in Run()
2479 " return vec4(1, 2, 3, 4);" NL "}"; in Run()
2554 return NL "1. Verify that building separable CS program works as expected." NL in Purpose()
2560 return NL "1. Create, compile and link CS using CreateShaderProgramv command." NL in Method()
2574 NL "layout(local_size_x = 1) in;" NL "void Run();" NL "void main() {" NL " Run();" NL "}", in Run()
2575 NL "layout(binding = 0, std430) buffer Output {" NL " vec4 g_output;" NL "};" NL in Run()
2576 "vec4 CalculateOutput();" NL "void Run() {" NL " g_output = CalculateOutput();" NL "}", in Run()
2577 NL "vec4 CalculateOutput() {" NL " g_output = vec4(0);" NL " return vec4(1, 2, 3, 4);" NL "}" in Run()
2639 return NL "1. Verify that shared array of uints works as expected." NL in Purpose()
2640 "2. Verify that shared memory written by one invocation is observable by other invocations" NL in Purpose()
2646 …return NL "1. Create and dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
2647 "2. Verify results written by CS to SSBO." NL in Method()
2712 …NL "layout(local_size_x = 256) in;" NL "layout(std430) buffer Output {" NL " uint g_output[];" NL… in Run()
2713 "shared uint g_shared_data[256];" NL "void main() {" NL in Run()
2714 " g_shared_data[gl_LocalInvocationID.x] = gl_LocalInvocationIndex;" NL in Run()
2716 NL " barrier();" // wait for all stores to finish in Run()
2717 NL " g_output[gl_GlobalInvocationID.x] = 1;" NL " if (gl_LocalInvocationIndex < 255) {" NL in Run()
2720 …NL " if (res != (gl_LocalInvocationIndex + 1)) {" NL " g_output[gl_GlobalInvocationID.x] =… in Run()
2721 " }" NL " }" NL "}"; in Run()
2756 return NL "1. Verify that vectors, matrices, structers and arrays of those can be used" NL in Purpose()
2757 " as a shared memory." NL in Purpose()
2758 "2. Verify that shared memory can be indexed with constant values, built-in" NL in Purpose()
2759 " variables and dynamic expressions." NL in Purpose()
2760 "3. Verify that memoryBarrierAtomicCounter(), memoryBarrierImage(), memoryBarrier()," NL in Purpose()
2761 " memoryBarrierBuffer() and memoryBarrierShared() built-in functions are accepted" NL in Purpose()
2767 …return NL "1. Create and dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
2831 const char* const glsl_cs = NL in Run()
2832 …"layout(local_size_x = 128) in;" NL "layout(std430) buffer Output {" NL " vec4 g_output[256];" NL… in Run()
2833 …"struct SubData {" NL " mat2x4 data;" NL "};" NL "struct Data {" NL " uint index;" NL " vec3 da… in Run()
2834 …" SubData data1;" NL "};" NL "shared Data g_shared_data[256];" NL "shared int g_shared_buf[2];" NL in Run()
2835 "void main() {" NL " if (gl_LocalInvocationID.x == 0) {" NL " g_shared_buf[1] = 1;" NL in Run()
2836 " g_shared_buf[1 + gl_LocalInvocationID.x] = 0;" NL " g_shared_buf[0] = 128;" NL in Run()
2837 " g_output[0] = vec4(g_shared_buf[1]);" NL " g_output[128] = vec4(g_shared_buf[0]);" NL in Run()
2839 NL " } else {" NL " const uint index = gl_LocalInvocationIndex;" NL in Run()
2840 …" g_shared_data[index].index = index;" NL " g_shared_data[index + 128].index = index + 128;"… in Run()
2841 " g_shared_data[index].data1.data = mat2x4(0.0);" NL in Run()
2842 " g_shared_data[index + 128].data1.data = mat2x4(0.0);" NL in Run()
2844 NL " g_output[index + 128] = vec4(g_shared_data[index + 128].index);" NL in Run()
2846 NL " }" NL " memoryBarrierAtomicCounter();" NL " memoryBarrierImage();" NL in Run()
2848 NL "}"; in Run()
2875 return NL "DispatchComputeIndirect command"; in Title()
2880 return NL in Purpose()
2881 …"1. Verify that DispatchComputeIndirect command works as described in the OpenGL specification." NL in Purpose()
2882 "2. Verify that <offset> parameter is correctly applied." NL in Purpose()
2883 …ify that updating dispatch buffer with different methods (BufferData, BufferSubData, MapBuffer)" NL in Purpose()
2884 " just before DispatchComputeIndirect call works as expected." NL in Purpose()
2890 return NL in Method()
2891 …"1. Create CS and dispatch indirect buffer." NL "2. Dispatch CS with DispatchComputeIndirect comma… in Method()
2892 "3. Update dispatch indirect buffer." NL in Method()
2898 return NL "Everything works as expected."; in PassCriteria()
2977 …NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL " uint g_output[];" NL "… in Run()
2978 "uniform uvec3 g_global_size;" NL "void main() {" NL in Run()
2979 " const uint global_index = gl_GlobalInvocationID.x +" NL in Run()
2980 " gl_GlobalInvocationID.y * g_global_size.x +" NL in Run()
2981 " gl_GlobalInvocationID.z * g_global_size.x * g_global_size.y;" NL in Run()
2982 " if (gl_NumWorkGroups != g_global_size) {" NL " g_output[global_index] = 0xffff;" NL in Run()
2983 " return;" NL " }" NL " g_output[global_index] = global_index;" NL "}"; in Run()
3065 return NL "Separable CS Programs - Compute and non-compute stages (1)"; in Title()
3069 …return NL "1. Verify that compute and non-compute stages can be attached to one pipeline object." … in Purpose()
3074 return NL "1. Create VS, FS and CS. Attach all created stages to one pipeline object." NL in Method()
3075 "2. Bind pipeline object." NL "3. Invoke compute stage with DispatchCompute commmand." NL in Method()
3076 "4. Issue MemoryBarrier command." NL in Method()
3077 …"5. Issue DrawArrays command which uses data written by the compute stage." NL "6. Verify result."; in Method()
3081 return NL "Everything works as expected."; in PassCriteria()
3100 …NL "layout(local_size_x = 4) in;" NL "layout(std430) buffer Output {" NL " vec4 g_output[4];" NL … in Run()
3101 …"void main() {" NL " const vec2 quad[4] = { vec2(-1, -1), vec2(1, -1), vec2(-1, 1), vec2(1, 1) };… in Run()
3102 " g_output[gl_GlobalInvocationID.x] = vec4(quad[gl_GlobalInvocationID.x], 0, 1);" NL "}"; in Run()
3111 …NL "layout(location = 0) in vec4 i_position;" NL "out gl_PerVertex {" NL " vec4 gl_Position;" NL … in Run()
3112 "void main() {" NL " gl_Position = i_position;" NL "}"; in Run()
3118 …NL "layout(location = 0) out vec4 o_color;" NL "void main() {" NL " o_color = vec4(0, 1, 0, 1);" … in Run()
3171 return NL "Separable CS Programs - Compute and non-compute stages (2)"; in Title()
3175 …return NL "1. Verify that data computed by the compute stage is visible to non-compute stage after… in Purpose()
3176 "MemoryBarrier command." NL "2. Verify that ProgramParameteri(program, GL_PROGRAM_SEPARABLE, " in Purpose()
3177 "GL_TRUE) command works correctly for CS." NL in Purpose()
3182 return NL "1. Create VS, FS and CS. Attach all created stages to one pipeline object." NL in Method()
3183 "2. Bind pipeline object." NL "3. Invoke compute stage with DispatchCompute commmand." NL in Method()
3184 "4. Issue MemoryBarrier command." NL in Method()
3185 …"5. Issue DrawArrays command which uses data written to the buffer object by the compute stage." NL in Method()
3190 return NL "Everything works as expected."; in PassCriteria()
3219 …"#version 430 core" NL "layout(binding = 1, std430) buffer Input {" NL " vec2 g_input[4];" NL "};… in Run()
3220 …"out StageData {" NL " vec3 color;" NL "} g_vs_out;" NL "out gl_PerVertex {" NL " vec4 gl_Positi… in Run()
3221 "};" NL "void main() {" NL " gl_Position = vec4(g_input[gl_VertexID], 0, 1);" NL in Run()
3222 " g_vs_out.color = vec3(0, 1, 0);" NL "}"; in Run()
3225 "#version 430 core" NL "in StageData {" NL " vec3 color;" NL "} g_fs_in;" NL in Run()
3226 …"layout(location = 0) out vec4 g_color;" NL "void main() {" NL " g_color = vec4(g_fs_in.color, 1)… in Run()
3229 …"#version 430 core" NL "layout(local_size_x = 4) in;" NL "layout(binding = 1, std430) buffer Outpu… in Run()
3230 " vec2 g_output[gl_WorkGroupSize.x];" NL "};" NL "void main() {" NL in Run()
3231 " if (gl_GlobalInvocationID.x == 0) {" NL " g_output[0] = vec2(-0.8, -0.8);" NL in Run()
3232 " } else if (gl_GlobalInvocationID.x == 1) {" NL " g_output[1] = vec2(0.8, -0.8);" NL in Run()
3233 " } else if (gl_GlobalInvocationID.x == 2) {" NL " g_output[2] = vec2(-0.8, 0.8);" NL in Run()
3234 …" } else if (gl_GlobalInvocationID.x == 3) {" NL " g_output[3] = vec2(0.8, 0.8);" NL " }" NL … in Run()
3291 return NL "Separable CS Programs - Compute stage"; in Title()
3295 return NL "Verify that compute shader stage selected with UseProgram command has precedence" NL in Purpose()
3300 …return NL "1. Create CS0 with CreateProgram command. Create CS1 with CreateShaderProgramv command.… in Method()
3301 "2. Verify that CS program selected with UseProgram is dispatched even if there is active" NL in Method()
3306 return NL "Everything works as expected."; in PassCriteria()
3325 …"#version 430 core" NL "layout(local_size_x = 1) in;" NL "layout(binding = 3, std430) buffer Outpu… in Run()
3326 " int g_output;" NL "};" NL "void main() {" NL " g_output = 1;" NL "}"; in Run()
3329 …"#version 430 core" NL "layout(local_size_x = 1) in;" NL "layout(binding = 3, std430) buffer Outpu… in Run()
3330 " int g_output;" NL "};" NL "void main() {" NL " g_output = 2;" NL "}"; in Run()
3438 return NL "Atomic functions"; in Title()
3442 return NL "1. Verify that atomicAdd function works as expected with int and uint parameters." NL in Purpose()
3443 "2. Verify that shared memory can be used with atomic functions." NL in Purpose()
3448 return NL "1. Use shared memory as a 'counter' with-in one CS work group." NL in Method()
3449 "2. Each shader invocation increments/decrements 'counter' value using atomicAdd function." NL in Method()
3450 "3. Values returned by atomicAdd function are written to SSBO." NL in Method()
3455 return NL "Everything works as expected."; in PassCriteria()
3470 NL "layout(local_size_x = 8) in;" NL "layout(std430, binding = 0) buffer Output {" NL in Run()
3471 " uint g_add_output[8];" NL " int g_sub_output[8];" NL "};" NL "shared uint g_add_value;" NL in Run()
3472 "shared int g_sub_value;" NL "void main() {" NL " if (gl_LocalInvocationIndex == 0) {" NL in Run()
3473 " g_add_value = 0u;" NL " g_sub_value = 7;" NL " }" NL in Run()
3474 …" g_add_output[gl_LocalInvocationIndex] = 0u;" NL " g_sub_output[gl_LocalInvocationIndex] = 0;" … in Run()
3475 " groupMemoryBarrier();" NL " barrier();" NL in Run()
3476 " g_add_output[gl_LocalInvocationIndex] = atomicAdd(g_add_value, 1u);" NL in Run()
3477 " g_sub_output[gl_LocalInvocationIndex] = atomicAdd(g_sub_value, -1);" NL "}"; in Run()
3531 return NL "Atomic functions - buffer variables"; in Title()
3535 return NL "1. Verify that all atomic functions (atomicExchange, atomicMin, atomicMax," NL in Purpose()
3536 … atomicAnd, atomicOr, atomicXor and atomicCompSwap) works as expected with buffer variables." NL in Purpose()
3537 "2. Verify that atomic functions work with parameters being constants and" NL in Purpose()
3538 " with parameters being uniforms." NL in Purpose()
3543 …return NL "1. Create CS that uses all atomic functions. Values returned by the atomic functions ar… in Method()
3544 "SSBO." NL "2. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
3545 "3. Verify SSBO content." NL in Method()
3550 return NL "Everything works as expected."; in PassCriteria()
3561 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
3562 …<< ", local_size_z = " << local_size.z() << ") in;" NL "const uvec3 kGlobalSize = uvec3(" << globa… in GenSource()
3564 << ");" NL "layout(std430, binding = 0) buffer OutputU {" NL " uint g_uint_out[" in GenSource()
3566 << "];" NL "};" NL "layout(std430, binding = 1) buffer OutputI {" NL " int data[" in GenSource()
3568 << "];" NL "} g_int_out;" NL in GenSource()
3569 …rm uint g_uint_value[8] = uint[8](3u, 1u, 2u, 0x1u, 0x3u, 0x1u, 0x2u, 0x7u);" NL "void main() {" NL in GenSource()
3570 " const uint global_index = gl_GlobalInvocationID.x +" NL in GenSource()
3571 " gl_GlobalInvocationID.y * kGlobalSize.x +" NL in GenSource()
3572 " gl_GlobalInvocationID.z * kGlobalSize.x * kGlobalSize.y;" NL in GenSource()
3573 " atomicExchange(g_uint_out[global_index], g_uint_value[0]);" NL in GenSource()
3574 " atomicMin(g_uint_out[global_index], g_uint_value[1]);" NL in GenSource()
3575 " atomicMax(g_uint_out[global_index], g_uint_value[2]);" NL in GenSource()
3576 " atomicAnd(g_uint_out[global_index], g_uint_value[3]);" NL in GenSource()
3577 " atomicOr(g_uint_out[global_index], g_uint_value[4]);" NL " if (g_uint_value[0] > 0u) {" NL in GenSource()
3579 NL " atomicXor(g_uint_out[global_index], g_uint_value[5]);" NL " }" NL in GenSource()
3580 " atomicCompSwap(g_uint_out[global_index], g_uint_value[6], g_uint_value[7]);" NL NL in GenSource()
3581 …atomicExchange(g_int_out.data[global_index], 3);" NL " atomicMin(g_int_out.data[global_index], 1)… in GenSource()
3582 …" atomicMax(g_int_out.data[global_index], 2);" NL " atomicAnd(g_int_out.data[global_index], 0x1)… in GenSource()
3583 …" atomicOr(g_int_out.data[global_index], 0x3);" NL " atomicXor(g_int_out.data[global_index], 0x1… in GenSource()
3584 " atomicCompSwap(g_int_out.data[global_index], 0x2, 0x7);" NL "}"; in GenSource()
3686 return NL "Atomic functions - shared variables"; in Title()
3690 return NL "1. Verify that all atomic functions (atomicExchange, atomicMin, atomicMax," NL in Purpose()
3691 … atomicAnd, atomicOr, atomicXor and atomicCompSwap) works as expected with shared variables." NL in Purpose()
3692 "2. Verify that atomic functions work with parameters being constants and" NL in Purpose()
3693 " with parameters being uniforms." NL in Purpose()
3698 …return NL "1. Create CS that uses all atomic functions. Values returned by the atomic functions ar… in Method()
3699 "SSBO." NL "2. Dispatch CS with DispatchCompute and DispatchComputeIndirect commands." NL in Method()
3700 "3. Verify SSBO content." NL in Method()
3705 return NL "Everything works as expected."; in PassCriteria()
3715 ss << NL "layout(local_size_x = " << local_size.x() << ", local_size_y = " << local_size.y() in GenSource()
3717 << ") in;" NL "layout(std430, binding = 0) buffer Output {" NL " uint g_uint_out[" in GenSource()
3718 << local_size.x() * local_size.y() * local_size.z() << "];" NL " int g_int_out[" in GenSource()
3719 …<< local_size.x() * local_size.y() * local_size.z() << "];" NL "};" NL "shared uint g_shared_uint[" in GenSource()
3720 << local_size.x() * local_size.y() * local_size.z() << "];" NL "shared int g_shared_int[" in GenSource()
3722 … << "];" NL "uniform uint g_uint_value[8] = uint[8](3u, 1u, 2u, 0x1u, 0x3u, 0x1u, 0x2u, 0x7u);" NL in GenSource()
3723 … "void main() {" NL " atomicExchange(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[0]);" NL in GenSource()
3724 " atomicMin(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[1]);" NL in GenSource()
3725 " atomicMax(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[2]);" NL in GenSource()
3726 " atomicAnd(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[3]);" NL in GenSource()
3727 " atomicOr(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[4]);" NL in GenSource()
3728 " atomicXor(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[5]);" NL in GenSource()
3729 …" atomicCompSwap(g_shared_uint[gl_LocalInvocationIndex], g_uint_value[6], g_uint_value[7]);" NL NL in GenSource()
3730 " atomicExchange(g_shared_int[gl_LocalInvocationIndex], 3);" NL in GenSource()
3731 " atomicMin(g_shared_int[gl_LocalInvocationIndex], 1);" NL in GenSource()
3732 " atomicMax(g_shared_int[gl_LocalInvocationIndex], 2);" NL in GenSource()
3733 … " atomicAnd(g_shared_int[gl_LocalInvocationIndex], 0x1);" NL " if (g_uint_value[1] > 0u) {" NL in GenSource()
3734 " atomicOr(g_shared_int[gl_LocalInvocationIndex], 0x3);" NL in GenSource()
3735 " atomicXor(g_shared_int[gl_LocalInvocationIndex], 0x1);" NL in GenSource()
3736 " atomicCompSwap(g_shared_int[gl_LocalInvocationIndex], 0x2, 0x7);" NL " }" NL NL in GenSource()
3737 " g_uint_out[gl_LocalInvocationIndex] = g_shared_uint[gl_LocalInvocationIndex];" NL in GenSource()
3738 " g_int_out[gl_LocalInvocationIndex] = g_shared_int[gl_LocalInvocationIndex];" NL "}"; in GenSource()
3837 return NL "Copy Image"; in Title()
3841 return NL "Verify that copying two textures using CS works as expected."; in Purpose()
3845 return NL "Use shader image load and store operations to copy two textures in the CS."; in Method()
3849 return NL "Everything works as expected."; in PassCriteria()
3864 const char* const glsl_cs = NL "#define TILE_WIDTH 16" NL "#define TILE_HEIGHT 16" NL in Run()
3865 "const ivec2 kTileSize = ivec2(TILE_WIDTH, TILE_HEIGHT);" NL NL in Run()
3866 "layout(binding = 0, rgba8) uniform image2D g_input_image;" NL in Run()
3867 "layout(binding = 1, rgba8) uniform image2D g_output_image;" NL NL in Run()
3868 "layout(local_size_x=TILE_WIDTH, local_size_y=TILE_HEIGHT) in;" NL NL in Run()
3869 "void main() {" NL " const ivec2 tile_xy = ivec2(gl_WorkGroupID);" NL in Run()
3870 " const ivec2 thread_xy = ivec2(gl_LocalInvocationID);" NL in Run()
3871 " const ivec2 pixel_xy = tile_xy * kTileSize + thread_xy;" NL NL in Run()
3872 " vec4 pixel = imageLoad(g_input_image, pixel_xy);" NL in Run()
3873 " imageStore(g_output_image, pixel_xy, pixel);" NL "}"; in Run()
3926 return NL "CS as an additional pipeline stage - Before VS (1)"; in Title()
3930 return NL "Verify that CS which runs just before VS and modifies VBO content works as expected."; in Purpose()
3934 …return NL "1. Prepare VBO and VAO for a drawing operation." NL "2. Run CS to modify existing VBO c… in Method()
3935 "3. Issue MemoryBarrier(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT) command." NL in Method()
3936 "4. Issue draw call command." NL "5. Verify that the framebuffer content is as expected."; in Method()
3940 return NL "Everything works as expected."; in PassCriteria()
3957 …NL "layout(local_size_x = 4) in;" NL "struct Vertex {" NL " vec4 position;" NL " vec4 color;" NL… in Run()
3958 "layout(binding = 0, std430) buffer VertexBuffer {" NL " Vertex g_vertex[];" NL "};" NL in Run()
3959 "uniform float g_scale = 0.8;" NL "void main() {" NL in Run()
3960 " g_vertex[gl_GlobalInvocationID.x].position.xyz *= g_scale;" NL in Run()
3961 " g_vertex[gl_GlobalInvocationID.x].color *= vec4(0, 1, 0, 1);" NL "}"; in Run()
3968 NL "layout(location = 0) in vec4 g_position;" NL "layout(location = 1) in vec4 g_color;" NL in Run()
3969 "out StageData {" NL " vec4 color;" NL "} g_vs_out;" NL "void main() {" NL in Run()
3970 " gl_Position = g_position;" NL " g_vs_out.color = g_color;" NL "}"; in Run()
3973 …NL "in StageData {" NL " vec4 color;" NL "} g_fs_in;" NL "layout(location = 0) out vec4 g_color;"… in Run()
3974 "void main() {" NL " g_color = g_fs_in.color;" NL "}"; in Run()
4032 return NL "CS as an additional pipeline stage - Before VS (2)"; in Title()
4036 return NL "Verify that a complex scenario where CS is used to generate drawing commands" NL in Purpose()
4037 … "and write them to a draw indirect buffer works as expected. This is a practial usage of CS." NL in Purpose()
4042 …return NL "1. Run CS which will generate four sets of draw call parameters and write them to the d… in Method()
4043 "buffer." NL "2. One set of draw call parameters will be: 0, 0, 0, 0" NL in Method()
4044 … " (which means that an object is outside of the viewing frustum and should not be drawn)." NL in Method()
4045 "3. Issue MemoryBarrier(GL_COMMAND_BARRIER_BIT) command." NL in Method()
4046 …"4. Issue four draw indirect commands." NL "5. Verify that the framebuffer content is as expected.… in Method()
4050 return NL "Everything works as expected."; in PassCriteria()
4081 NL "layout(local_size_x = 4) in;" NL "struct DrawCommand {" NL " uint count;" NL in Run()
4082 …" uint instance_count;" NL " uint first_index;" NL " int base_vertex;" NL " uint base_instance… in Run()
4083 "};" NL "layout(std430) buffer;" NL "layout(binding = 0) readonly buffer ObjectBuffer {" NL in Run()
4084 " mat4 transform[4];" NL " uint count[4];" NL " uint first_index[4];" NL "} g_objects;" NL in Run()
4085 …yout(binding = 1) writeonly buffer DrawCommandBuffer {" NL " DrawCommand g_command[4];" NL "};" NL in Run()
4086 "bool IsObjectVisible(uint id) {" NL in Run()
4087 …" if (g_objects.transform[id][3].x < -1.0 || g_objects.transform[id][3].x > 1.0) return false;" NL in Run()
4088 … if (g_objects.transform[id][3][1] < -1.0 || g_objects.transform[id][3][1] > 1.0) return false;" NL in Run()
4089 … if (g_objects.transform[id][3][2] < -1.0 || g_objects.transform[id][3].z > 1.0) return false;" NL in Run()
4090 " return true;" NL "}" NL "void main() {" NL " uint id = gl_GlobalInvocationID.x;" NL in Run()
4091 " g_command[id].count = 0;" NL " g_command[id].instance_count = 0;" NL in Run()
4092 " g_command[id].first_index = 0;" NL " g_command[id].base_vertex = 0;" NL in Run()
4093 " g_command[id].base_instance = 0;" NL " if (IsObjectVisible(id)) {" NL in Run()
4094 " g_command[id].count = g_objects.count[id];" NL " g_command[id].instance_count = 1;" NL in Run()
4095 " g_command[id].first_index = g_objects.first_index[id];" NL " }" NL "}"; in Run()
4102 NL "layout(location = 0) in vec4 g_position;" NL "layout(location = 1) in vec3 g_color;" NL in Run()
4103 "out StageData {" NL " vec3 color;" NL "} g_vs_out;" NL in Run()
4104 …layout(binding = 0, std430) buffer ObjectBuffer {" NL " mat4 transform[4];" NL " uint count[4];"… in Run()
4105 " uint first_index[4];" NL "} g_objects;" NL "uniform int g_object_id;" NL "void main() {" NL in Run()
4106 …Position = g_objects.transform[g_object_id] * g_position;" NL " g_vs_out.color = g_color;" NL "}"; in Run()
4109 …NL "in StageData {" NL " vec3 color;" NL "} g_fs_in;" NL "layout(location = 0) out vec4 g_color;"… in Run()
4110 "void main() {" NL " g_color = vec4(g_fs_in.color, 1);" NL "}"; in Run()
4218 return NL "Compute Chain"; in Title()
4222 return NL "1. Verify that dispatching several compute kernels that work in a sequence" NL in Purpose()
4223 " with a common set of resources works as expected." NL in Purpose()
4224 "2. Verify that indexing nested structures with built-in variables work as expected." NL in Purpose()
4225 "3. Verify that two kernels can write to the same resource without MemoryBarrier" NL in Purpose()
4230 return NL "1. Create a set of GPU resources (buffers, images, atomic counters)." NL in Method()
4231 "2. Dispatch Kernel0 that write to these resources." NL "3. Issue MemoryBarrier command." NL in Method()
4232 … Dispatch Kernel1 that read/write from/to these resources." NL "5. Issue MemoryBarrier command." NL in Method()
4233 "6. Dispatch Kernel2 that read/write from/to these resources." NL in Method()
4238 return NL "Everything works as expected."; in PassCriteria()
4249 return NL "struct S0 {" NL " int m0[8];" NL "};" NL "struct S1 {" NL " S0 m0[8];" NL "};" NL in Common()
4250 …"layout(binding = 0, std430) buffer Buffer0 {" NL " int m0[5];" NL " S1 m1[8];" NL "} g_buffer0;… in Common()
4251 "layout(binding = 1, std430) buffer Buffer1 {" NL " uint data[8];" NL "} g_buffer1;" NL in Common()
4252 "layout(binding = 2, std430) buffer Buffer2 {" NL " int data[256];" NL "} g_buffer2;" NL in Common()
4253 "layout(binding = 3, std430) buffer Buffer3 {" NL " int data[256];" NL "} g_buffer3;" NL in Common()
4254 "layout(binding = 4, std430) buffer Buffer4 {" NL " mat4 data0;" NL " mat4 data1;" NL in Common()
4255 "} g_buffer4;" NL "layout(binding = 0, rgba32f) uniform image2D g_image0;" NL in Common()
4264 ss << NL "layout(local_size_x = 4, local_size_y = 4, local_size_z = 4) in;" NL in GenGLSL()
4265 … "void UpdateBuffer0(uvec3 id, int add_val) {" NL " if (id.x < 8 && id.y < 8 && id.z < 8) {" NL in GenGLSL()
4266 " g_buffer0.m1[id.z].m0[id.y].m0[id.x] += add_val;" NL " }" NL "}" NL in GenGLSL()
4267 "uniform int g_add_value = 1;" NL "uniform uint g_counter_y = 1;" NL in GenGLSL()
4268 "uniform vec4 g_image_value = vec4(0.125, 0.25, 0.375, 0.5);" NL "void main() {" NL in GenGLSL()
4269 " uvec3 id = gl_GlobalInvocationID;" NL " UpdateBuffer0(id, 1);" NL in GenGLSL()
4270 " UpdateBuffer0(id, g_add_value);" NL " if (id == uvec3(1, g_counter_y, 1)) {" NL in GenGLSL()
4271 " uint idx = atomicCounterIncrement(g_counter[1]);" NL " g_buffer1.data[idx] = idx;" NL in GenGLSL()
4272 … " idx = atomicCounterIncrement(g_counter[1]);" NL " g_buffer1.data[idx] = idx;" NL " }" NL in GenGLSL()
4273 " if (id.x < 4 && id.y < 4 && id.z == 0) {" NL in GenGLSL()
4274 " vec4 v = imageLoad(g_image0, ivec2(id.xy));" NL in GenGLSL()
4275 " imageStore(g_image0, ivec2(id.xy), v + g_image_value);" NL " }" NL in GenGLSL()
4276 …" if (id.x < 2 && id.y == 0 && id.z == 0) {" NL " g_buffer2.data[id.x] -= int(g_counter_y);" NL in GenGLSL()
4277 " }" NL "}"; in GenGLSL()
4281 ss << NL "layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in;" in GenGLSL()
4283 …NL "uniform mat4 g_mvp = mat4(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 10.0,… in GenGLSL()
4284 "20.0, 30.0, 1.0);" NL "void main() {" NL " if (gl_GlobalInvocationID == uvec3(0)) {" NL in GenGLSL()
4285 " g_buffer4.data0 *= g_mvp;" NL " }" NL " if (gl_WorkGroupID == uvec3(0)) {" NL in GenGLSL()
4287 "g_mvp[gl_LocalInvocationID.x][gl_LocalInvocationID.y];" NL " }" NL "}"; in GenGLSL()
4291 …ss << NL "layout(local_size_x = 4, local_size_y = 4, local_size_z = 4) in;" NL "void main() {" NL … in GenGLSL()
4502 return NL "CS as an additional pipeline stage - After FS"; in Title()
4506 …return NL "1. Verify that CS which runs just after FS to do a post-processing on a rendered image … in Purpose()
4507 "expected." NL "2. Verify that CS used as a post-processing filter works as expected." NL in Purpose()
4513 return NL in Method()
4514 "1. Render image to Texture0 using VS and FS." NL in Method()
4515 …e Texture0 as an input to Kernel0 which performs post-processing and writes result to Texture1." NL in Method()
4516 "3. Issue MemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT) command." NL in Method()
4517 …e Texture1 as an input to Kernel1 which performs post-processing and writes result to Texture0." NL in Method()
4518 "5. Issue MemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT) command." NL in Method()
4523 return NL "Everything works as expected."; in PassCriteria()
4543 NL "const vec2 g_vertex[4] = vec2[4](vec2(0), vec2(-1, -1), vec2(3, -1), vec2(-1, 3));" NL in Run()
4544 "void main() {" NL " gl_Position = vec4(g_vertex[gl_VertexID], 0, 1);" NL "}"; in Run()
4547 …NL "layout(location = 0) out vec4 g_color;" NL "void main() {" NL " g_color = vec4(1, 0, 0, 1);" … in Run()
4555 NL "#define TILE_WIDTH 16" NL "#define TILE_HEIGHT 16" NL in Run()
4556 "const ivec2 kTileSize = ivec2(TILE_WIDTH, TILE_HEIGHT);" NL NL in Run()
4557 "layout(binding = 0, rgba32f) uniform image2D g_input_image;" NL in Run()
4558 "layout(binding = 1, rgba32f) uniform image2D g_output_image;" NL NL in Run()
4559 "layout(local_size_x = TILE_WIDTH, local_size_y=TILE_HEIGHT) in;" NL NL "void main() {" NL in Run()
4560 " const ivec2 tile_xy = ivec2(gl_WorkGroupID);" NL in Run()
4561 … " const ivec2 thread_xy = ivec2(gl_LocalInvocationID);" NL NL " if (thread_xy == ivec2(0)) {" NL in Run()
4562 …" const ivec2 pixel_xy = tile_xy * kTileSize;" NL " for (int y = 0; y < TILE_HEIGHT; ++y) {"… in Run()
4563 " for (int x = 0; x < TILE_WIDTH; ++x) {" NL in Run()
4564 … " imageStore(g_output_image, pixel_xy + ivec2(x, y), vec4(0, 1, 0, 1));" NL " }" NL in Run()
4565 " }" NL " }" NL "}"; in Run()
4572 const char* const glsl_cs2 = NL "#define TILE_WIDTH 32" NL "#define TILE_HEIGHT 32" NL in Run()
4573 "const ivec2 kTileSize = ivec2(TILE_WIDTH, TILE_HEIGHT);" NL NL in Run()
4574 "layout(binding = 0, rgba32f) uniform image2D g_input_image;" NL in Run()
4575 "layout(binding = 1, rgba32f) uniform image2D g_output_image;" NL NL in Run()
4576 "layout(local_size_x = TILE_WIDTH, local_size_y=TILE_HEIGHT) in;" NL NL in Run()
4577 "vec4 Process(vec4 ic) {" NL " return ic + vec4(1, 0, 0, 0);" NL "}" NL in Run()
4578 "void main() {" NL " const ivec2 tile_xy = ivec2(gl_WorkGroupID);" NL in Run()
4579 " const ivec2 thread_xy = ivec2(gl_LocalInvocationID);" NL in Run()
4580 " const ivec2 pixel_xy = tile_xy * kTileSize + thread_xy;" NL in Run()
4581 " vec4 ic = imageLoad(g_input_image, pixel_xy);" NL in Run()
4582 " imageStore(g_output_image, pixel_xy, Process(ic));" NL "}"; in Run()
4665 return NL "CS as an additional pipeline stage - After XFB"; in Title()
4669 return NL "1. Verify that CS which process data fedback by VS works as expected." NL in Purpose()
4670 "2. Verify that XFB and SSBO works correctly together in one shader." NL in Purpose()
4676 return NL "1. Draw triangle with XFB enabled. Some data is written to the XFB buffer." NL in Method()
4677 "2. Use XFB buffer as 'input SSBO' in CS. Process data and write it to 'output SSBO'." NL in Method()
4682 return NL "Everything works as expected."; in PassCriteria()
4711 NL "layout(location = 0) in vec4 g_position;" NL "layout(location = 1) in vec4 g_color;" NL in Run()
4712 "struct Vertex {" NL " vec4 position;" NL " vec4 color;" NL "};" NL "out StageData {" NL in Run()
4713 " vec4 color;" NL "} g_vs_out;" NL "layout(binding = 0, std430) buffer StageData {" NL in Run()
4714 … " Vertex vertex[];" NL "} g_vs_buffer;" NL "void main() {" NL " gl_Position = g_position;" NL in Run()
4715 " g_vs_out.color = g_color;" NL " g_vs_buffer.vertex[gl_VertexID].position = g_position;" NL in Run()
4716 " g_vs_buffer.vertex[gl_VertexID].color = g_color;" NL "}"; in Run()
4719 …NL "in StageData {" NL " vec4 color;" NL "} g_fs_in;" NL "layout(location = 0) out vec4 g_color;"… in Run()
4720 "void main() {" NL " g_color = g_fs_in.color;" NL "}"; in Run()
4733 …NL "layout(local_size_x = 3) in;" NL "struct Vertex {" NL " vec4 position;" NL " vec4 color;" NL… in Run()
4734 "layout(binding = 3, std430) buffer Buffer {" NL " Vertex g_vertex[3];" NL "};" NL in Run()
4735 "uniform vec4 g_color1 = vec4(0, 0, 1, 0);" NL "uniform int g_two = 2;" NL in Run()
4736 …"void UpdateVertex2(int i) {" NL " g_vertex[i].color -= vec4(-1, 1, 0, 0);" NL "}" NL "void main(… in Run()
4737 " switch (gl_GlobalInvocationID.x) {" NL in Run()
4738 " case 0: g_vertex[gl_GlobalInvocationID.x].color += vec4(1, 0, 0, 0); break;" NL in Run()
4739 …" case 1: g_vertex[1].color += g_color1; break;" NL " case 2: UpdateVertex2(g_two); break;" … in Run()
4740 " default: return;" NL " }" NL "}"; in Run()
4837 return NL "Shared Memory - Indexing"; in Title()
4841 return NL "1. Verify that indexing various types of shared memory works as expected." NL in Purpose()
4842 … "2. Verify that indexing shared memory with different types of expressions work as expected." NL in Purpose()
4847 return NL "1. Create CS which uses shared memory in many different ways." NL in Method()
4848 …"2. Write to shared memory using different expressions." NL "3. Validate shared memory content." NL in Method()
4853 return NL "Everyting works as expected."; in PassCriteria()
4867 const char* const glsl_cs = NL in Run()
4868 "layout(binding = 3, rgba32f) uniform image2D g_result_image;" NL in Run()
4869 "layout (local_size_x = 4,local_size_y=4 ) in;" NL "shared vec4 g_shared1[4];" NL in Run()
4870 "shared mat4 g_shared2;" NL "shared struct {" NL " float data[4];" NL "} g_shared3[4];" NL in Run()
4871 "shared struct Type { float data[4]; } g_shared4[4];" NL "shared Type g_shared5[4];" NL in Run()
4872 "uniform bool g_true = true;" NL in Run()
4873 "uniform float g_values[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };" NL NL in Run()
4874 "void Sync() {" NL " groupMemoryBarrier();" NL " barrier();" NL "}" NL in Run()
4875 …"void SetMemory(ivec2 xy, float value) {" NL " g_shared1[xy.y][gl_LocalInvocationID.x] = value;" … in Run()
4876 " g_shared2[xy.y][xy.x] = value;" NL " g_shared3[xy[1]].data[xy[0]] = value;" NL in Run()
4877 " g_shared4[xy.y].data[xy[0]] = value;" NL in Run()
4878 " g_shared5[gl_LocalInvocationID.y].data[gl_LocalInvocationID.x] = value;" NL "}" NL in Run()
4879 "bool CheckMemory(ivec2 xy, float expected) {" NL in Run()
4880 " if (g_shared1[xy.y][xy[0]] != expected) return false;" NL in Run()
4881 " if (g_shared2[xy[1]][xy[0]] != expected) return false;" NL in Run()
4882 … if (g_shared3[gl_LocalInvocationID.y].data[gl_LocalInvocationID.x] != expected) return false;" NL in Run()
4883 " if (g_shared4[gl_LocalInvocationID.y].data[xy.x] != expected) return false;" NL in Run()
4884 " if (g_shared5[xy.y].data[xy.x] != expected) return false;" NL " return true;" NL "}" NL in Run()
4885 "void main() {" NL " const ivec2 thread_xy = ivec2(gl_LocalInvocationID);" NL in Run()
4886 " vec4 result = vec4(0, 1, 0, 1);" NL NL in Run()
4887 " SetMemory(thread_xy, g_values[gl_LocalInvocationIndex] * 1.0);" NL " Sync();" NL in Run()
4888 …!CheckMemory(thread_xy, g_values[gl_LocalInvocationIndex] * 1.0)) result = vec4(1, 0, 0, 1);" NL NL in Run()
4889 " SetMemory(thread_xy, g_values[gl_LocalInvocationIndex] * -1.0);" NL " Sync();" NL in Run()
4890 …CheckMemory(thread_xy, g_values[gl_LocalInvocationIndex] * -1.0)) result = vec4(1, 0, 0, 1);" NL NL in Run()
4891 " if (g_true && gl_LocalInvocationID.x < 10) {" NL in Run()
4892 " SetMemory(thread_xy, g_values[gl_LocalInvocationIndex] * 7.0);" NL " Sync();" NL in Run()
4893 …f (!CheckMemory(thread_xy, g_values[gl_LocalInvocationIndex] * 7.0)) result = vec4(1, 0, 0, 1);" NL in Run()
4894 " }" NL NL " imageStore(g_result_image, thread_xy, result);" NL "}"; in Run()
4945 return NL "Shared Memory - 32K"; in Title()
4949 return NL "Support for 32K of shared memory is required by the OpenGL specifaction. Verify if an " in Purpose()
4954 return NL "Create and dispatch CS which uses 32K of shared memory."; in Method()
4958 return NL "Everything works as expected."; in PassCriteria()
4973 NL "layout(local_size_x = 1024) in;" NL in Run()
4975 NL "layout(std430) buffer Output {" NL " Type g_output[1024];" NL "};" NL NL "void main() {" NL in Run()
4976 " const int id = int(gl_GlobalInvocationID.x);" NL in Run()
4977 … g_shared[id].v = vec4[2](vec4(1.0), vec4(1.0));" NL " memoryBarrierShared();" NL " barrier();" … in Run()
4978 …" vec4 sum = vec4(0.0);" NL " int sum_count = 0;" NL " for (int i = id - 3; i < id + 4; ++i) {"… in Run()
4979 " if (id >= 0 && id < g_shared.length()) {" NL " sum += g_shared[id].v[0];" NL in Run()
4980 " sum += g_shared[id].v[1];" NL " sum_count += 2;" NL " }" NL " }" NL in Run()
4981 " if (any(greaterThan(abs((sum / sum_count) - vec4(1.0)), vec4(0.0000001f)))) return;" NL NL in Run()
4982 " g_output[id] = g_shared[id];" NL "}"; in Run()
5030 return NL "Dynamic execution paths"; in Title()
5034 …return NL "1. Verify case where each of the four threads takes different execution path in the CS.… in Purpose()
5035 "2. Execution path for each thread is not known at the compilation time." NL in Purpose()
5036 " Selection is made based on the result of the texture sampling." NL in Purpose()
5037 "3. Verify that memory synchronization primitives (memoryBarrier* functions) are accepted" NL in Purpose()
5042 …return NL "1. Create and dispatch CS that takes different execution paths based on the result of t… in Method()
5043 … "sampling." NL "2. In each execution path use different resources (buffers, samplers, uniform " in Method()
5048 return NL "Everything works as expected."; in PassCriteria()
5065 NL "layout(local_size_x = 4) in;" NL "layout(std140, binding = 0) buffer Output {" NL in Run()
5066 " vec4 g_output[4];" NL "};" NL "uniform isamplerBuffer g_path_buffer;" NL in Run()
5067 "uniform vec4[4] g_input0 = vec4[4](vec4(100), vec4(200), vec4(300), vec4(400));" NL in Run()
5068 "uniform samplerBuffer g_input1;" NL "layout(binding = 1, std430) buffer Input2 {" NL in Run()
5069 " vec4[4] g_input2;" NL "};" NL NL "void Path2(int id) {" NL in Run()
5070 …" g_output[id] = texelFetch(g_input1, int(gl_LocalInvocationIndex));" NL "}" NL "void main() {" NL in Run()
5071 " const int id = int(gl_GlobalInvocationID.x);" NL in Run()
5072 " const int path = texelFetch(g_path_buffer, id).x;" NL NL " if (path == 0) {" NL in Run()
5073 " g_output[id] = g_input0[gl_LocalInvocationID.x];" NL " memoryBarrier();" NL in Run()
5074 … " } else if (path == 1) {" NL " return;" NL " } else if (path == 2) {" NL " Path2(id);" NL in Run()
5075 " return;" NL " } else if (path == 3) {" NL " g_output[id] = g_input2[path - 1];" NL in Run()
5076 " memoryBarrierBuffer();" NL " }" NL "}"; in Run()
5162 return NL "Maximum number of resources in one shader"; in Title()
5166 return NL "1. Verify that using 8 SSBOs, 12 UBOs, 8 atomic counters, 16 samplers" NL in Purpose()
5171 return NL "Create and dispatch CS. Verify result."; in Method()
5175 return NL "Everything works as expected."; in PassCriteria()
5277 NL "layout(local_size_x = 1) in;" NL "layout(std140, binding = 0) buffer ShaderStorageBlock {" NL in Run()
5278 …" uint data;" NL "} g_shader_storage[8];" NL "layout(std140, binding = 0) uniform UniformBlock {"… in Run()
5279 …" uint data;" NL "} g_uniform[12];" NL "layout(binding = 0) uniform usamplerBuffer g_sampler[16];… in Run()
5280 "layout(binding = 0, r32ui) uniform uimageBuffer g_image[8];" NL in Run()
5281 "layout(binding = 0, offset = 0) uniform atomic_uint g_atomic_counter0;" NL in Run()
5282 "layout(binding = 1, offset = 0) uniform atomic_uint g_atomic_counter1;" NL in Run()
5283 "layout(binding = 2, offset = 0) uniform atomic_uint g_atomic_counter2;" NL in Run()
5284 "layout(binding = 3, offset = 0) uniform atomic_uint g_atomic_counter3;" NL in Run()
5285 "layout(binding = 4, offset = 0) uniform atomic_uint g_atomic_counter4;" NL in Run()
5286 "layout(binding = 5, offset = 0) uniform atomic_uint g_atomic_counter5;" NL in Run()
5287 "layout(binding = 6, offset = 0) uniform atomic_uint g_atomic_counter6;" NL in Run()
5288 "layout(binding = 7, offset = 0) uniform atomic_uint g_atomic_counter7;" NL in Run()
5289 "uniform uint g_uniform_def[480];" NL "uniform uint g_index = 0u;" NL NL "uint Add() {" NL in Run()
5290 " switch (g_index) {" NL " case 0: return atomicCounter(g_atomic_counter0);" NL in Run()
5291 " case 1: return atomicCounter(g_atomic_counter1);" NL in Run()
5292 " case 2: return atomicCounter(g_atomic_counter2);" NL in Run()
5293 " case 3: return atomicCounter(g_atomic_counter3);" NL in Run()
5294 " case 4: return atomicCounter(g_atomic_counter4);" NL in Run()
5295 " case 5: return atomicCounter(g_atomic_counter5);" NL in Run()
5296 " case 6: return atomicCounter(g_atomic_counter6);" NL in Run()
5297 " case 7: return atomicCounter(g_atomic_counter7);" NL " }" NL "}" NL "void main() {" NL in Run()
5298 " g_shader_storage[g_index].data += g_uniform[g_index].data;" NL in Run()
5299 " g_shader_storage[g_index].data += texelFetch(g_sampler[g_index], 0).x;" NL in Run()
5300 " g_shader_storage[g_index].data += imageLoad(g_image[g_index], 0).x;" NL in Run()
5301 " g_shader_storage[g_index].data += Add();" NL in Run()
5302 " g_shader_storage[g_index].data += g_uniform_def[g_index];" NL "}"; in Run()
5344 return NL "FP64 support - built-in math functions"; in Title()
5348 return NL "Verify that selected double precision math functions works as expected in the CS."; in Purpose()
5352 return NL "Create and dispatch CS which uses double precision math functions. Verify results."; in Method()
5356 return NL "Everything works as expected."; in PassCriteria()
5373 NL "layout(local_size_x = 4) in;" NL "layout(std140, binding = 0) buffer ShaderStorageBlock {" NL in Run()
5374 …" double data;" NL "} g_shader_storage[4];" NL "layout(std140, binding = 0) uniform UniformBlock … in Run()
5375 … " double data;" NL "} g_uniform[2];" NL "uniform dvec2 g_uniform_def;" NL NL "void main() {" NL in Run()
5376 " if (gl_GlobalInvocationID.x == 0) {" NL in Run()
5378 NL " } else if (gl_GlobalInvocationID.x == 1) {" NL in Run()
5380 NL " } else if (gl_GlobalInvocationID.x == 2) {" NL in Run()
5382 NL " } else if (gl_GlobalInvocationID.x == 3) {" NL in Run()
5384 NL " }" NL "}"; in Run()
5444 return NL "FP64 support - uniform variables"; in Title()
5448 …return NL "1. Verify that all types of double precision uniform variables work as expected in CS."… in Purpose()
5450 "ProgramUniform* commands." NL "3. Verify that re-linking CS program works as expected."; in Purpose()
5454 return NL "1. Create CS which uses all (double precision) types of uniform variables." NL in Method()
5455 "2. Update uniform variables with ProgramUniform* commands." NL in Method()
5456 "3. Verify that uniform variables were updated correctly." NL "4. Re-link CS program." NL in Method()
5457 "5. Update uniform variables with Uniform* commands." NL in Method()
5462 return NL "Everything works as expected."; in PassCriteria()
5476 const char* const glsl_cs = NL in Run()
5477 …"layout(local_size_x = 1) in;" NL "buffer Result {" NL " int g_result;" NL "};" NL "uniform doubl… in Run()
5478 "uniform dvec2 g_1;" NL "uniform dvec3 g_2;" NL "uniform dvec4 g_3;" NL "uniform dmat2 g_4;" NL in Run()
5479 …"uniform dmat2x3 g_5;" NL "uniform dmat2x4 g_6;" NL "uniform dmat3x2 g_7;" NL "uniform dmat3 g_8;"… in Run()
5480 …"uniform dmat3x4 g_9;" NL "uniform dmat4x2 g_10;" NL "uniform dmat4x3 g_11;" NL "uniform dmat4 g_1… in Run()
5481 "void main() {" NL " g_result = 1;" NL NL " if (g_0 != 1.0LF) g_result = 0;" NL in Run()
5482 " if (g_1 != dvec2(2.0LF, 3.0LF)) g_result = 0;" NL in Run()
5483 " if (g_2 != dvec3(4.0LF, 5.0LF, 6.0LF)) g_result = 0;" NL in Run()
5484 " if (g_3 != dvec4(7.0LF, 8.0LF, 9.0LF, 10.0LF)) g_result = 0;" NL NL in Run()
5485 " if (g_4 != dmat2(11.0LF, 12.0LF, 13.0LF, 14.0LF)) g_result = 0;" NL in Run()
5486 " if (g_5 != dmat2x3(15.0LF, 16.0LF, 17.0LF, 18.0LF, 19.0LF, 20.0LF)) g_result = 0;" NL in Run()
5487 …_6 != dmat2x4(21.0LF, 22.0LF, 23.0LF, 24.0LF, 25.0LF, 26.0LF, 27.0LF, 28.0LF)) g_result = 0;" NL NL in Run()
5488 " if (g_7 != dmat3x2(29.0LF, 30.0LF, 31.0LF, 32.0LF, 33.0LF, 34.0LF)) g_result = 0;" NL in Run()
5490 …"0;" NL " if (g_9 != dmat3x4(44.0LF, 45.0LF, 46.0LF, 47.0LF, 48.0LF, 49.0LF, 50.0LF, 51.0LF, 52.0… in Run()
5491 "53.0LF, 54.0LF, 55.0LF)) g_result = 0;" NL NL in Run()
5492 " if (g_10 != dmat4x2(56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0)) g_result = 0;" NL in Run()
5494 …"0;" NL " if (g_12 != dmat4(75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.… in Run()
5495 "88.0, 89.0, 90.0)) g_result = 0;" NL "}"; in Run()
5672 return NL "FP64 support - subroutines"; in Title()
5676 …return NL "Verify that subroutines that performs double precision computation works as expected in… in Purpose()
5680 return NL in Method()
5685 return NL "Everything works as expected."; in PassCriteria()
5700 NL "layout(local_size_x = 1) in;" NL "uniform double[4] g_input;" NL "uniform int index;" NL in Run()
5701 "layout(std430, binding = 0) buffer Output {" NL " double g_output[4];" NL "};" NL in Run()
5702 "subroutine double MathFunc(double x);" NL "subroutine uniform MathFunc g_func[4];" NL in Run()
5703 … "subroutine(MathFunc)" NL "double Func0(double x) {" NL " return abs(x);" // abs(-1.0LF) == 1.0LF in Run()
5704 NL "}" NL "subroutine(MathFunc)" NL "double Func1(double x) {" NL in Run()
5706 NL "}" NL "subroutine(MathFunc)" NL "double Func2(double x) {" NL in Run()
5708 NL "}" NL "subroutine(MathFunc)" NL "double Func3(double x) {" NL in Run()
5710 …NL "}" NL "void main() {" NL " int i = index;" NL " g_output[i] = g_func[i](g_input[i]);" NL "}"; in Run()
5786 return NL "Conditional Dispatching"; in Title()
5790 …return NL "Verify that DispatchCompute and DispatchComputeIndirect commands work as expected insid… in Purpose()
5795 return NL "1. Render two quads. One will pass depth-test and the second one will not." NL in Method()
5796 "2. Use GL_ANY_SAMPLES_PASSED query objects to 'remember' these results." NL in Method()
5798 "query objects." NL in Method()
5799 "4. Verify that DispatchCompute and DispatchComputeIndirect commands are only executed in" NL in Method()
5804 return NL "Everything works as expected."; in PassCriteria()
5826 const char* const glsl_vs = NL in Run()
5827 …"uniform float g_depth;" NL "uniform vec2[3] g_vertex = vec2[3](vec2(-1, -1), vec2(3, -1), vec2(-1… in Run()
5828 "void main() {" NL " gl_Position = vec4(g_vertex[gl_VertexID], g_depth, 1);" NL "}"; in Run()
5831 …NL "layout(location = 0) out vec4 g_color;" NL "void main() {" NL " g_color = vec4(0, 1, 0, 1);" … in Run()
5839 …NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL " int g_output;" NL "};"… in Run()
5840 "void main() {" NL " atomicAdd(g_output, 1);" NL "}"; in Run()
5956 return NL "API errors - no active program"; in Title()
5960 return NL "Verify that appropriate errors are generated by the OpenGL API."; in Purpose()
5964 return NL ""; in Method()
5968 return NL ""; in PassCriteria()
6010 …NL "layout(location = 0) in vec4 g_position;" NL "void main() {" NL " gl_Position = g_position;" … in Run()
6013 NL "layout(location = 0) out vec4 g_color;" NL "void main() {" NL " g_color = vec4(1);" NL "}"; in Run()
6065 return NL "API errors - invalid work group count"; in Title()
6069 return NL "Verify that appropriate errors are generated by the OpenGL API."; in Purpose()
6073 return NL ""; in Method()
6077 return NL ""; in PassCriteria()
6092 …NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL " uint g_output[];" NL "… in Run()
6093 "void main() {" NL in Run()
6094 …g_output[gl_GlobalInvocationID.x * gl_GlobalInvocationID.y * gl_GlobalInvocationID.z] = 0;" NL "}"; in Run()
6156 return NL "API errors - incorrect DispatchComputeIndirect usage"; in Title()
6160 return NL "Verify that appropriate errors are generated by the OpenGL API."; in Purpose()
6164 return NL ""; in Method()
6168 return NL ""; in PassCriteria()
6186 …NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL " uint g_output[];" NL "… in Run()
6187 "void main() {" NL " g_output[gl_GlobalInvocationID.x] = 0;" NL "}"; in Run()
6261 return NL "API errors - program state"; in Title()
6265 return NL "Verify that appropriate errors are generated by the OpenGL API."; in Purpose()
6269 return NL ""; in Method()
6273 return NL ""; in PassCriteria()
6288 …NL "layout(location = 0) in vec4 g_position;" NL "void main() {" NL " gl_Position = g_position;" … in Run()
6291 NL "layout(location = 0) out vec4 g_color;" NL "void main() {" NL " g_color = vec4(1);" NL "}"; in Run()
6321 "#version 430 core" NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL in Run()
6322 …" uint g_output[];" NL "};" NL "void main() {" NL " g_output[gl_GlobalInvocationID.x] = 0;" NL "… in Run()
6370 return NL "Compile-time errors"; in Title()
6374 return NL "Verify that appropriate errors are generated by the GLSL compiler."; in Purpose()
6378 return NL ""; in Method()
6382 return NL ""; in PassCriteria()
6388 ss << "#version 430 core" NL "layout(local_size_x = " << x << ", local_size_y = " << y in Shader1()
6389 …<< ", local_size_z = " << z << ") in;" NL "layout(std430) buffer Output {" NL " uint g_output[];"… in Shader1()
6390 "void main() {" NL " g_output[gl_GlobalInvocationID.x] = 0;" NL "}"; in Shader1()
6397 …if (!Compile("#version 420 core" NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Outpu… in Run()
6398 … " uint g_output[];" NL "};" NL "void main() {" NL " g_output[gl_GlobalInvocationID.x] = 0;" NL in Run()
6402 …if (!Compile("#version 430 core" NL "layout(local_size_x = 1) in;" NL "layout(local_size_x = 2) in… in Run()
6403 "layout(std430) buffer Output {" NL " uint g_output[];" NL "};" NL "void main() {" NL in Run()
6404 " g_output[gl_GlobalInvocationID.x] = 0;" NL "}")) in Run()
6407 if (!Compile("#version 430 core" NL "layout(local_size_x = 1) in;" NL "in uint x;" NL in Run()
6408 "layout(std430) buffer Output {" NL " uint g_output[];" NL "};" NL "void main() {" NL in Run()
6409 " g_output[gl_GlobalInvocationID.x] = x;" NL "}")) in Run()
6412 if (!Compile("#version 430 core" NL "layout(local_size_x = 1) in;" NL "out uint x;" NL in Run()
6413 "layout(std430) buffer Output {" NL " uint g_output[];" NL "};" NL "void main() {" NL in Run()
6414 " g_output[gl_GlobalInvocationID.x] = 0;" NL " x = 0;" NL "}")) in Run()
6466 return NL "Link-time errors"; in Title()
6470 return NL "Verify that appropriate errors are generated by the GLSL linker."; in Purpose()
6474 return NL ""; in Method()
6478 return NL ""; in PassCriteria()
6484 if (!Link("#version 430 core" NL "void Run();" NL "void main() {" NL " Run();" NL "}", in Run()
6485 "#version 430 core" NL "layout(std430) buffer Output {" NL " uint g_output[];" NL "};" NL in Run()
6486 "void Run() {" NL " g_output[gl_GlobalInvocationID.x] = 0;" NL "}")) in Run()
6489 …if (!Link("#version 430 core" NL "layout(local_size_x = 2) in;" NL "void Run();" NL "void main() {… in Run()
6490 " Run();" NL "}", in Run()
6491 "#version 430 core" NL "layout(local_size_x = 1) in;" NL "layout(std430) buffer Output {" NL in Run()
6492 …" uint g_output[];" NL "};" NL "void Run() {" NL " g_output[gl_GlobalInvocationID.x] = 0;" NL "}… in Run()
6567 return NL "gl_WorkGroupSize is an constant"; in Title()
6571 return NL "Verify that gl_WorkGroupSize can be used as an constant expression."; in Purpose()
6575 return NL ""; in Method()
6579 return NL ""; in PassCriteria()
6595 NL "layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in;" NL in Run()
6596 …"layout(std430, binding = 0) buffer Output {" NL " uint g_buffer[22 + gl_WorkGroupSize.x];" NL "}… in Run()
6597 "shared uint g_shared[gl_WorkGroupSize.x * gl_WorkGroupSize.y * gl_WorkGroupSize.z];" NL in Run()
6599 "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 };" NL "void main() {" NL in Run()
6600 " g_shared[gl_LocalInvocationIndex] = 1U;" NL " groupMemoryBarrier();" NL " barrier();" NL in Run()
6601 " uint sum = 0;" NL in Run()
6602 … " for (uint i = 0; i < gl_WorkGroupSize.x * gl_WorkGroupSize.y * gl_WorkGroupSize.z; ++i) {" NL in Run()
6603 " sum += g_shared[i];" NL " }" NL " sum += g_uniform[gl_LocalInvocationIndex];" NL in Run()
6604 " g_buffer[gl_LocalInvocationIndex] = sum;" NL "}"; in Run()