From 2a01066c56fffe67179a1d2abdcddb0c32b33a33 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 12 Apr 2018 13:13:29 +1000 Subject: [PATCH] arb_compute_shader: test shared 64bit ints Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103972 --- .../basic-shared-64bit-int.shader_test | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/spec/arb_compute_shader/execution/basic-shared-64bit-int.shader_test diff --git a/tests/spec/arb_compute_shader/execution/basic-shared-64bit-int.shader_test b/tests/spec/arb_compute_shader/execution/basic-shared-64bit-int.shader_test new file mode 100644 index 000000000..9ce59e655 --- /dev/null +++ b/tests/spec/arb_compute_shader/execution/basic-shared-64bit-int.shader_test @@ -0,0 +1,85 @@ +# Test for assigning values to a shared int64. Bug #103972 + +[require] +GL >= 4.0 +GLSL >= 4.00 +GL_ARB_compute_shader +GL_ARB_shader_image_load_store +GL_ARB_gpu_shader_int64 + +[compute shader] +#version 400 +#extension GL_ARB_compute_shader: enable +#extension GL_ARB_shader_image_load_store: enable +#extension GL_ARB_gpu_shader_int64: enable + +writeonly uniform image2D tex; + +layout(local_size_x=2, local_size_y=2, local_size_z=1) in; + +shared u64vec2 mmShared[192 * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; + +void main() +{ + ivec2 coord = ivec2(gl_GlobalInvocationID.xy); + + uint b[8]; + b[0] = 2101479989U; + b[1] = 1917184202U; + b[2] = 4191109983U; + b[3] = 1779160146U; + b[4] = 2746074432U; + b[5] = 2613207917U; + b[6] = 4045743315U; + b[7] = 4014514165U; + + u64vec2 st[3]; + st[0].x = packUint2x32(uvec2(b[0], b[1])); + st[0].y = packUint2x32(uvec2(b[2], b[3])); + st[1].x = packUint2x32(uvec2(b[4], b[5])); + st[1].y = packUint2x32(uvec2(b[6], b[7])); + st[2] = st[0]; + + u64vec2 mmLocal[192]; + + uint offset = gl_LocalInvocationIndex * 192; + + uint io = 188+offset; + uint lsize = 192/3; + + for (int i = 0; i < lsize; ++i) { + mmShared[io+0] = st[0]; + mmShared[io+1] = st[1]; + mmShared[io+2] = st[2]; + io -= 3; + } + + io = offset; + for(int i = 0; i < 192; ++i) { + mmLocal[i] = mmShared[io]; + ++io; + } + + // 2101479989,1917184202,4191109983,1779160146 + uvec2 v01 = unpackUint2x32(mmLocal[1].x); + uvec2 v23 = unpackUint2x32(mmLocal[1].y); + + uvec4 expected = uvec4(2101479989U,1917184202U,4191109983U,1779160146U); + + vec4 colour; + if (uvec4(v01, v23) == expected) + colour = vec4(0.0, 1.0, 0.0, 1.0); + else + colour = vec4(1.0, 0.0, 0.0, 1.0); + + imageStore(tex, coord, colour); +} + +[test] +uniform int tex 0 +texture rgbw 0 (16, 16) GL_RGBA8 +image texture 0 GL_RGBA8 +fb tex 2d 0 + +compute 1 1 1 +probe all rgba 0.0 1.0 0.0 0.0 -- 2.17.0