[Piglit] [PATCH 3/7] intel_shader_atomic_float_minmax: Add tests for atomic{Min, Max}(float, float)

Ian Romanick idr at freedesktop.org
Sat Jun 23 05:04:26 UTC 2018


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../execution/shared-atomicMax-float.shader_test   | 139 ++++++++++++++++++++
 .../execution/shared-atomicMin-float.shader_test   | 143 +++++++++++++++++++++
 .../execution/ssbo-atomicMax-float.shader_test     | 141 ++++++++++++++++++++
 .../execution/ssbo-atomicMin-float.shader_test     | 141 ++++++++++++++++++++
 4 files changed, 564 insertions(+)
 create mode 100644 tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMax-float.shader_test
 create mode 100644 tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMin-float.shader_test
 create mode 100644 tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float.shader_test
 create mode 100644 tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float.shader_test

diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMax-float.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMax-float.shader_test
new file mode 100644
index 000000000..2dde8c713
--- /dev/null
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMax-float.shader_test
@@ -0,0 +1,139 @@
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_storage_buffer_object
+GL_ARB_shader_atomic_counters
+GL_INTEL_shader_atomic_float_minmax
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: require
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_INTEL_shader_atomic_float_minmax: require
+
+layout(local_size_x = 64) in;
+
+layout(binding = 0) buffer bufblock {
+	float source_array[64];
+	float source_value;
+};
+
+shared float array[source_array.length()];
+shared float value;
+
+layout(binding = 0) uniform atomic_uint fail;
+
+void main()
+{
+	if (gl_LocalInvocationIndex == 0u) {
+		array = source_array;
+		value = source_value;
+	}
+
+	barrier();
+
+	int local_index = int(gl_LocalInvocationIndex);
+	float v;
+
+	/* For value, every instance should get 2147483647. */
+	v = atomicMax(value, local_index);
+	if (v != 2147483647)
+		atomicCounterIncrement(fail);
+
+	if (value != 2147483647)
+		atomicCounterIncrement(fail);
+
+	float first_expected = (local_index + 1) * -4;
+	float second_expected = local_index * 4;
+
+	/* The per-instance value should give the old value on the first step.
+	 * This is expected to be the negative byte offset of the next array
+	 * element.
+	 */
+	v = atomicMax(array[local_index], second_expected);
+	if (v != first_expected)
+		atomicCounterIncrement(fail);
+
+	/* The per-instance value should give the new value on the second
+	 * step.  This is expected to be the byte offset of the current array
+	 * element.
+	 */
+	v = atomicExchange(array[local_index], first_expected);
+	if (v != second_expected)
+		atomicCounterIncrement(fail);
+}
+
+[test]
+atomic counters 1
+
+ssbo 0 260
+ssbo 0 subdata float 0 -4
+ssbo 0 subdata float 4 -8
+ssbo 0 subdata float 8 -12
+ssbo 0 subdata float 12 -16
+ssbo 0 subdata float 16 -20
+ssbo 0 subdata float 20 -24
+ssbo 0 subdata float 24 -28
+ssbo 0 subdata float 28 -32
+ssbo 0 subdata float 32 -36
+ssbo 0 subdata float 36 -40
+ssbo 0 subdata float 40 -44
+ssbo 0 subdata float 44 -48
+ssbo 0 subdata float 48 -52
+ssbo 0 subdata float 52 -56
+ssbo 0 subdata float 56 -60
+ssbo 0 subdata float 60 -64
+ssbo 0 subdata float 64 -68
+ssbo 0 subdata float 68 -72
+ssbo 0 subdata float 72 -76
+ssbo 0 subdata float 76 -80
+ssbo 0 subdata float 80 -84
+ssbo 0 subdata float 84 -88
+ssbo 0 subdata float 88 -92
+ssbo 0 subdata float 92 -96
+ssbo 0 subdata float 96 -100
+ssbo 0 subdata float 100 -104
+ssbo 0 subdata float 104 -108
+ssbo 0 subdata float 108 -112
+ssbo 0 subdata float 112 -116
+ssbo 0 subdata float 116 -120
+ssbo 0 subdata float 120 -124
+ssbo 0 subdata float 124 -128
+ssbo 0 subdata float 128 -132
+ssbo 0 subdata float 132 -136
+ssbo 0 subdata float 136 -140
+ssbo 0 subdata float 140 -144
+ssbo 0 subdata float 144 -148
+ssbo 0 subdata float 148 -152
+ssbo 0 subdata float 152 -156
+ssbo 0 subdata float 156 -160
+ssbo 0 subdata float 160 -164
+ssbo 0 subdata float 164 -168
+ssbo 0 subdata float 168 -172
+ssbo 0 subdata float 172 -176
+ssbo 0 subdata float 176 -180
+ssbo 0 subdata float 180 -184
+ssbo 0 subdata float 184 -188
+ssbo 0 subdata float 188 -192
+ssbo 0 subdata float 192 -196
+ssbo 0 subdata float 196 -200
+ssbo 0 subdata float 200 -204
+ssbo 0 subdata float 204 -208
+ssbo 0 subdata float 208 -212
+ssbo 0 subdata float 212 -216
+ssbo 0 subdata float 216 -220
+ssbo 0 subdata float 220 -224
+ssbo 0 subdata float 224 -228
+ssbo 0 subdata float 228 -232
+ssbo 0 subdata float 232 -236
+ssbo 0 subdata float 236 -240
+ssbo 0 subdata float 240 -244
+ssbo 0 subdata float 244 -248
+ssbo 0 subdata float 248 -252
+ssbo 0 subdata float 252 -256
+ssbo 0 subdata float 256 2147483647
+
+compute 2 3 4
+probe atomic counter 0 == 0
diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMin-float.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMin-float.shader_test
new file mode 100644
index 000000000..ac2a740cd
--- /dev/null
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/shared-atomicMin-float.shader_test
@@ -0,0 +1,143 @@
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_storage_buffer_object
+GL_ARB_shader_atomic_counters
+GL_INTEL_shader_atomic_float_minmax
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: require
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_INTEL_shader_atomic_float_minmax: require
+
+layout(local_size_x = 64) in;
+
+layout(binding = 0) buffer bufblock {
+	float source_array[64];
+	float source_value;
+};
+
+shared float array[source_array.length()];
+shared float value;
+
+layout(binding = 0) uniform atomic_uint fail;
+
+void main()
+{
+	if (gl_LocalInvocationIndex == 0u) {
+		array = source_array;
+		value = source_value;
+	}
+
+	barrier();
+
+	int local_index = int(gl_LocalInvocationIndex);
+	float v;
+
+	/* For value, every instance should get 5. */
+	v = atomicMin(value, 7 + local_index);
+	if (v != 5)
+		atomicCounterIncrement(fail);
+
+	if (value != 5)
+		atomicCounterIncrement(fail);
+
+	float first_expected = local_index * 4;
+	float second_expected = -first_expected;
+
+	/* The per-instance value should give the old value on the first step.
+	 * This is expected to be the byte offset of the current array
+	 * element.
+	 */
+	v = atomicMin(array[local_index], second_expected);
+	if (v != first_expected)
+		atomicCounterIncrement(fail);
+
+	/* The per-instance value should give the new value on the second
+	 * step.  This is expected to be the negative byte offset of the
+	 * current array element.
+	 */
+	v = atomicExchange(array[local_index], first_expected);
+	if (v != second_expected)
+		atomicCounterIncrement(fail);
+}
+
+[test]
+atomic counters 1
+
+ssbo 0 260
+ssbo 0 subdata float 0 0
+ssbo 0 subdata float 4 4
+ssbo 0 subdata float 8 8
+ssbo 0 subdata float 12 12
+ssbo 0 subdata float 16 16
+ssbo 0 subdata float 20 20
+ssbo 0 subdata float 24 24
+ssbo 0 subdata float 28 28
+ssbo 0 subdata float 32 32
+ssbo 0 subdata float 36 36
+ssbo 0 subdata float 40 40
+ssbo 0 subdata float 44 44
+ssbo 0 subdata float 48 48
+ssbo 0 subdata float 52 52
+ssbo 0 subdata float 56 56
+ssbo 0 subdata float 60 60
+ssbo 0 subdata float 64 64
+ssbo 0 subdata float 68 68
+ssbo 0 subdata float 72 72
+ssbo 0 subdata float 76 76
+ssbo 0 subdata float 80 80
+ssbo 0 subdata float 84 84
+ssbo 0 subdata float 88 88
+ssbo 0 subdata float 92 92
+ssbo 0 subdata float 96 96
+ssbo 0 subdata float 100 100
+ssbo 0 subdata float 104 104
+ssbo 0 subdata float 108 108
+ssbo 0 subdata float 112 112
+ssbo 0 subdata float 116 116
+ssbo 0 subdata float 120 120
+ssbo 0 subdata float 124 124
+ssbo 0 subdata float 128 128
+ssbo 0 subdata float 132 132
+ssbo 0 subdata float 136 136
+ssbo 0 subdata float 140 140
+ssbo 0 subdata float 144 144
+ssbo 0 subdata float 148 148
+ssbo 0 subdata float 152 152
+ssbo 0 subdata float 156 156
+ssbo 0 subdata float 160 160
+ssbo 0 subdata float 164 164
+ssbo 0 subdata float 168 168
+ssbo 0 subdata float 172 172
+ssbo 0 subdata float 176 176
+ssbo 0 subdata float 180 180
+ssbo 0 subdata float 184 184
+ssbo 0 subdata float 188 188
+ssbo 0 subdata float 192 192
+ssbo 0 subdata float 196 196
+ssbo 0 subdata float 200 200
+ssbo 0 subdata float 204 204
+ssbo 0 subdata float 208 208
+ssbo 0 subdata float 212 212
+ssbo 0 subdata float 216 216
+ssbo 0 subdata float 220 220
+ssbo 0 subdata float 224 224
+ssbo 0 subdata float 228 228
+ssbo 0 subdata float 232 232
+ssbo 0 subdata float 236 236
+ssbo 0 subdata float 240 240
+ssbo 0 subdata float 244 244
+ssbo 0 subdata float 248 248
+ssbo 0 subdata float 252 252
+ssbo 0 subdata float 256 5
+
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2
+
+probe atomic counter 0 == 0
diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float.shader_test
new file mode 100644
index 000000000..319997e96
--- /dev/null
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float.shader_test
@@ -0,0 +1,141 @@
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_storage_buffer_object
+GL_ARB_shader_atomic_counters
+GL_INTEL_shader_atomic_float_minmax
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_INTEL_shader_atomic_float_minmax: require
+
+layout(binding = 0) buffer bufblock {
+	float array[64];
+	float value;
+};
+
+layout(binding = 0) uniform atomic_uint fail;
+
+out vec4 color;
+
+void main()
+{
+	int x = int(gl_FragCoord.x);
+	int y = int(gl_FragCoord.y);
+	int local_index = y * array.length() + x;
+	float v;
+
+	/* For value, every instance should get 2147483647. */
+	v = atomicMax(value, local_index);
+	if (v != 2147483647)
+		atomicCounterIncrement(fail);
+
+	if (value != 2147483647)
+		atomicCounterIncrement(fail);
+
+	if (local_index < array.length()) {
+		float first_expected = (local_index + 1) * -4;
+		float second_expected = local_index * 4;
+
+		/* The per-instance value should give the old value on the
+		 * first step.  This is expected to be the negative byte
+		 * offset of the next array element.
+		 */
+		v = atomicMax(array[local_index], second_expected);
+		if (v != first_expected)
+			atomicCounterIncrement(fail);
+
+		/* The per-instance value should give the new value on the
+		 * second step.  This is expected to be the byte offset of the
+		 * current array element.
+		 */
+		v = atomicExchange(array[local_index], first_expected);
+		if (v != second_expected)
+			atomicCounterIncrement(fail);
+
+		color = vec4(0.0, 1.0, 0.0, 1.0);
+	} else {
+		color = vec4(0.0, 0.0, 1.0, 1.0);
+	}
+}
+
+[test]
+atomic counters 1
+
+ssbo 0 260
+ssbo 0 subdata float 0 -4
+ssbo 0 subdata float 4 -8
+ssbo 0 subdata float 8 -12
+ssbo 0 subdata float 12 -16
+ssbo 0 subdata float 16 -20
+ssbo 0 subdata float 20 -24
+ssbo 0 subdata float 24 -28
+ssbo 0 subdata float 28 -32
+ssbo 0 subdata float 32 -36
+ssbo 0 subdata float 36 -40
+ssbo 0 subdata float 40 -44
+ssbo 0 subdata float 44 -48
+ssbo 0 subdata float 48 -52
+ssbo 0 subdata float 52 -56
+ssbo 0 subdata float 56 -60
+ssbo 0 subdata float 60 -64
+ssbo 0 subdata float 64 -68
+ssbo 0 subdata float 68 -72
+ssbo 0 subdata float 72 -76
+ssbo 0 subdata float 76 -80
+ssbo 0 subdata float 80 -84
+ssbo 0 subdata float 84 -88
+ssbo 0 subdata float 88 -92
+ssbo 0 subdata float 92 -96
+ssbo 0 subdata float 96 -100
+ssbo 0 subdata float 100 -104
+ssbo 0 subdata float 104 -108
+ssbo 0 subdata float 108 -112
+ssbo 0 subdata float 112 -116
+ssbo 0 subdata float 116 -120
+ssbo 0 subdata float 120 -124
+ssbo 0 subdata float 124 -128
+ssbo 0 subdata float 128 -132
+ssbo 0 subdata float 132 -136
+ssbo 0 subdata float 136 -140
+ssbo 0 subdata float 140 -144
+ssbo 0 subdata float 144 -148
+ssbo 0 subdata float 148 -152
+ssbo 0 subdata float 152 -156
+ssbo 0 subdata float 156 -160
+ssbo 0 subdata float 160 -164
+ssbo 0 subdata float 164 -168
+ssbo 0 subdata float 168 -172
+ssbo 0 subdata float 172 -176
+ssbo 0 subdata float 176 -180
+ssbo 0 subdata float 180 -184
+ssbo 0 subdata float 184 -188
+ssbo 0 subdata float 188 -192
+ssbo 0 subdata float 192 -196
+ssbo 0 subdata float 196 -200
+ssbo 0 subdata float 200 -204
+ssbo 0 subdata float 204 -208
+ssbo 0 subdata float 208 -212
+ssbo 0 subdata float 212 -216
+ssbo 0 subdata float 216 -220
+ssbo 0 subdata float 220 -224
+ssbo 0 subdata float 224 -228
+ssbo 0 subdata float 228 -232
+ssbo 0 subdata float 232 -236
+ssbo 0 subdata float 236 -240
+ssbo 0 subdata float 240 -244
+ssbo 0 subdata float 244 -248
+ssbo 0 subdata float 248 -252
+ssbo 0 subdata float 252 -256
+ssbo 0 subdata float 256 2147483647
+
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2
+
+probe atomic counter 0 == 0
diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float.shader_test
new file mode 100644
index 000000000..de5c87e0a
--- /dev/null
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float.shader_test
@@ -0,0 +1,141 @@
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_storage_buffer_object
+GL_ARB_shader_atomic_counters
+GL_INTEL_shader_atomic_float_minmax
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_INTEL_shader_atomic_float_minmax: require
+
+layout(binding = 0) buffer bufblock {
+	float array[64];
+	float value;
+};
+
+layout(binding = 0) uniform atomic_uint fail;
+
+out vec4 color;
+
+void main()
+{
+	int x = int(gl_FragCoord.x);
+	int y = int(gl_FragCoord.y);
+	int local_index = y * array.length() + x;
+	float v;
+
+	/* For value, every instance should get 5. */
+	v = atomicMin(value, 7 + local_index);
+	if (v != 5)
+		atomicCounterIncrement(fail);
+
+	if (value != 5)
+		atomicCounterIncrement(fail);
+
+	if (local_index < int(array.length())) {
+		float first_expected = local_index * 4;
+		float second_expected = -first_expected;
+
+		/* The per-instance value should give the old value on the
+		 * first step.  This is expected to be the byte offset of the
+		 * current array element.
+		 */
+		v = atomicMin(array[local_index], second_expected);
+		if (v != first_expected)
+			atomicCounterIncrement(fail);
+
+		/* The per-instance value should give the new value on the
+		 * second step.  This is expected to be the negative byte
+		 * offset of the current array element.
+		 */
+		v = atomicExchange(array[local_index], first_expected);
+		if (v != second_expected)
+			atomicCounterIncrement(fail);
+
+		color = vec4(0.0, 1.0, 0.0, 1.0);
+	} else {
+		color = vec4(0.0, 0.0, 1.0, 1.0);
+	}
+}
+
+[test]
+atomic counters 1
+
+ssbo 0 260
+ssbo 0 subdata float 0 0
+ssbo 0 subdata float 4 4
+ssbo 0 subdata float 8 8
+ssbo 0 subdata float 12 12
+ssbo 0 subdata float 16 16
+ssbo 0 subdata float 20 20
+ssbo 0 subdata float 24 24
+ssbo 0 subdata float 28 28
+ssbo 0 subdata float 32 32
+ssbo 0 subdata float 36 36
+ssbo 0 subdata float 40 40
+ssbo 0 subdata float 44 44
+ssbo 0 subdata float 48 48
+ssbo 0 subdata float 52 52
+ssbo 0 subdata float 56 56
+ssbo 0 subdata float 60 60
+ssbo 0 subdata float 64 64
+ssbo 0 subdata float 68 68
+ssbo 0 subdata float 72 72
+ssbo 0 subdata float 76 76
+ssbo 0 subdata float 80 80
+ssbo 0 subdata float 84 84
+ssbo 0 subdata float 88 88
+ssbo 0 subdata float 92 92
+ssbo 0 subdata float 96 96
+ssbo 0 subdata float 100 100
+ssbo 0 subdata float 104 104
+ssbo 0 subdata float 108 108
+ssbo 0 subdata float 112 112
+ssbo 0 subdata float 116 116
+ssbo 0 subdata float 120 120
+ssbo 0 subdata float 124 124
+ssbo 0 subdata float 128 128
+ssbo 0 subdata float 132 132
+ssbo 0 subdata float 136 136
+ssbo 0 subdata float 140 140
+ssbo 0 subdata float 144 144
+ssbo 0 subdata float 148 148
+ssbo 0 subdata float 152 152
+ssbo 0 subdata float 156 156
+ssbo 0 subdata float 160 160
+ssbo 0 subdata float 164 164
+ssbo 0 subdata float 168 168
+ssbo 0 subdata float 172 172
+ssbo 0 subdata float 176 176
+ssbo 0 subdata float 180 180
+ssbo 0 subdata float 184 184
+ssbo 0 subdata float 188 188
+ssbo 0 subdata float 192 192
+ssbo 0 subdata float 196 196
+ssbo 0 subdata float 200 200
+ssbo 0 subdata float 204 204
+ssbo 0 subdata float 208 208
+ssbo 0 subdata float 212 212
+ssbo 0 subdata float 216 216
+ssbo 0 subdata float 220 220
+ssbo 0 subdata float 224 224
+ssbo 0 subdata float 228 228
+ssbo 0 subdata float 232 232
+ssbo 0 subdata float 236 236
+ssbo 0 subdata float 240 240
+ssbo 0 subdata float 244 244
+ssbo 0 subdata float 248 248
+ssbo 0 subdata float 252 252
+ssbo 0 subdata float 256 5
+
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2
+
+probe atomic counter 0 == 0
-- 
2.14.4



More information about the Piglit mailing list