Test SRGB formats with UNIFORM_TEXEL_BUFFERs
authorAntto Mäkinen <antto.makinen@siru.fi>
Thu, 3 Mar 2022 08:47:51 +0000 (10:47 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 17 Mar 2022 17:46:12 +0000 (17:46 +0000)
This commit adds new tests that verify the implementation properly
linearizes the sRGB values when it fetches the contents of a uniform
texel buffer.

New tests:
dEQP-VK.texture.texel_buffer.uniform.srgb.*

Components: Vulkan
VK-GL-CTS issue: 3364

Change-Id: I2058f3b6613ad81acd2ebc190af1992637190ee3

android/cts/main/vk-master-2021-03-01/texture.txt
android/cts/main/vk-master/texture.txt
external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber [new file with mode: 0644]
external/vulkancts/modules/vulkan/texture/vktTextureTexelBufferTests.cpp
external/vulkancts/mustpass/main/vk-default/texture.txt

index bcc6499..a95bf11 100644 (file)
@@ -5425,6 +5425,12 @@ dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8b8a8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8b8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8_snorm
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8b8a8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.b8g8r8a8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.b8g8r8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8b8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8_srgb
 dEQP-VK.texture.texel_buffer.uniform.packed.a2b10g10r10-uint-pack32
 dEQP-VK.texture.texel_buffer.uniform.packed.a2b10g10r10-unorm-pack32
 dEQP-VK.texture.texel_buffer.uniform.packed.a8b8g8r8-sint-pack32
index 82bad8f..afe8bce 100644 (file)
@@ -14680,6 +14680,12 @@ dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8b8a8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8b8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8_snorm
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8b8a8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.b8g8r8a8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.b8g8r8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8b8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8_srgb
 dEQP-VK.texture.texel_buffer.uniform.packed.a2b10g10r10-uint-pack32
 dEQP-VK.texture.texel_buffer.uniform.packed.a2b10g10r10-unorm-pack32
 dEQP-VK.texture.texel_buffer.uniform.packed.a8b8g8r8-sint-pack32
diff --git a/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber b/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8_srgb.amber
new file mode 100644 (file)
index 0000000..94e708e
--- /dev/null
@@ -0,0 +1,102 @@
+#!amber
+# Copyright 2022 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER vertex vertShaderTex GLSL
+#version 430
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texCoordsIn;
+layout(location = 0) out vec2 texCoordsOut;
+void main() {
+  gl_Position = position;
+  texCoordsOut = texCoordsIn;
+}
+END
+
+SHADER fragment fragShaderTex GLSL
+#version 430
+layout(location = 0) in vec2 texCoordsIn;
+layout(location = 0) out vec4 colorOut;
+layout(set=0, binding=0) uniform sampler2D referenceSampler;
+layout(set=0, binding=1) uniform samplerBuffer bufferSampler;
+void main() {
+
+  vec4 referenceValue = texture(referenceSampler, texCoordsIn);
+  vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5)));
+
+  if (bufferValue == referenceValue)
+      colorOut = vec4(0., 1., 0., 1.);
+  else
+      colorOut = vec4(1., 0., 0., 1.);
+}
+END
+
+IMAGE texture FORMAT B8G8R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0
+0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0
+0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0
+0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0
+0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255
+0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255
+END
+
+IMAGE texture2 FORMAT B8G8R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0
+0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0
+0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0
+0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0
+0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255
+0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+BUFFER position DATA_TYPE vec2<float> DATA
+-1. -1.
+ 1. -1.
+-1.  1.
+ 1. -1.
+ 1.  1.
+-1.  1.
+END
+
+BUFFER texcoords DATA_TYPE vec2<float> DATA
+0.0 0.0
+1.0 0.0
+0.0 1.0
+1.0 0.0
+1.0 1.0
+0.0 1.0
+END
+
+PIPELINE graphics pipeline
+  ATTACH vertShaderTex
+  ATTACH fragShaderTex
+  BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1
+  VERTEX_DATA position LOCATION 0
+  VERTEX_DATA texcoords LOCATION 1
+  FRAMEBUFFER_SIZE 8 8
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR pipeline
+RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
+EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber b/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/b8g8r8a8_srgb.amber
new file mode 100644 (file)
index 0000000..150bd37
--- /dev/null
@@ -0,0 +1,110 @@
+#!amber
+# Copyright 2022 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER vertex vertShaderTex GLSL
+#version 430
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texCoordsIn;
+layout(location = 0) out vec2 texCoordsOut;
+void main() {
+  gl_Position = position;
+  texCoordsOut = texCoordsIn;
+}
+END
+
+SHADER fragment fragShaderTex GLSL
+#version 430
+layout(location = 0) in vec2 texCoordsIn;
+layout(location = 0) out vec4 colorOut;
+layout(set=0, binding=0) uniform sampler2D referenceSampler;
+layout(set=0, binding=1) uniform samplerBuffer bufferSampler;
+void main() {
+
+  vec4 referenceValue = texture(referenceSampler, texCoordsIn);
+  vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5)));
+
+  if (bufferValue == referenceValue)
+      colorOut = vec4(0., 1., 0., 1.);
+  else
+      colorOut = vec4(1., 0., 0., 1.);
+}
+END
+
+IMAGE texture FORMAT B8G8R8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212
+255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115
+255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222
+255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255
+80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235
+20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205
+90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215
+130 215 35 255 11 255 33 251 90 255 55 255 110
+50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0
+55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0
+66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0
+68 255 255 0 0 222 233
+END
+
+IMAGE texture2 FORMAT B8G8R8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212
+255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115
+255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222
+255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255
+80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235
+20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205
+90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215
+130 215 35 255 11 255 33 251 90 255 55 255 110
+50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0
+55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0
+66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0
+68 255 255 0 0 222 233
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+BUFFER position DATA_TYPE vec2<float> DATA
+-1. -1.
+ 1. -1.
+-1.  1.
+ 1. -1.
+ 1.  1.
+-1.  1.
+END
+
+BUFFER texcoords DATA_TYPE vec2<float> DATA
+0.0 0.0
+1.0 0.0
+0.0 1.0
+1.0 0.0
+1.0 1.0
+0.0 1.0
+END
+
+PIPELINE graphics pipeline
+  ATTACH vertShaderTex
+  ATTACH fragShaderTex
+  BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1
+  VERTEX_DATA position LOCATION 0
+  VERTEX_DATA texcoords LOCATION 1
+  FRAMEBUFFER_SIZE 8 8
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR pipeline
+RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
+EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber b/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8_srgb.amber
new file mode 100644 (file)
index 0000000..b0a3f46
--- /dev/null
@@ -0,0 +1,102 @@
+#!amber
+# Copyright 2022 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER vertex vertShaderTex GLSL
+#version 430
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texCoordsIn;
+layout(location = 0) out vec2 texCoordsOut;
+void main() {
+  gl_Position = position;
+  texCoordsOut = texCoordsIn;
+}
+END
+
+SHADER fragment fragShaderTex GLSL
+#version 430
+layout(location = 0) in vec2 texCoordsIn;
+layout(location = 0) out vec4 colorOut;
+layout(set=0, binding=0) uniform sampler2D referenceSampler;
+layout(set=0, binding=1) uniform samplerBuffer bufferSampler;
+void main() {
+
+  vec4 referenceValue = texture(referenceSampler, texCoordsIn);
+  vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5)));
+
+  if (bufferValue.r == referenceValue.r)
+      colorOut = vec4(0., 1., 0., 1.);
+  else
+      colorOut = vec4(1., 0., 0., 1.);
+}
+END
+
+IMAGE texture FORMAT R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+185 120 185 20 185 120 189 120
+145 122 185 10 185 12 188 122
+135 222 15 12 185 121 186 113
+175 124 5 130 185 100 185 123
+177 221 6 140 185 101 182 29
+188 121 67 150 185 120 184 127
+189 27 88 22 185 120 15 123
+111 18 185 24 185 120 17 220
+END
+
+IMAGE texture2 FORMAT R8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+185 120 185 20 185 120 189 120
+145 122 185 10 185 12 188 122
+135 222 15 12 185 121 186 113
+175 124 5 130 185 100 185 123
+177 221 6 140 185 101 182 29
+188 121 67 150 185 120 184 127
+189 27 88 22 185 120 15 123
+111 18 185 24 185 120 17 220
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+BUFFER position DATA_TYPE vec2<float> DATA
+-1. -1.
+ 1. -1.
+-1.  1.
+ 1. -1.
+ 1.  1.
+-1.  1.
+END
+
+BUFFER texcoords DATA_TYPE vec2<float> DATA
+0.0 0.0
+1.0 0.0
+0.0 1.0
+1.0 0.0
+1.0 1.0
+0.0 1.0
+END
+
+PIPELINE graphics pipeline
+  ATTACH vertShaderTex
+  ATTACH fragShaderTex
+  BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1
+  VERTEX_DATA position LOCATION 0
+  VERTEX_DATA texcoords LOCATION 1
+  FRAMEBUFFER_SIZE 8 8
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR pipeline
+RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
+EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber b/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8_srgb.amber
new file mode 100644 (file)
index 0000000..cb4f32f
--- /dev/null
@@ -0,0 +1,102 @@
+#!amber
+# Copyright 2022 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER vertex vertShaderTex GLSL
+#version 430
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texCoordsIn;
+layout(location = 0) out vec2 texCoordsOut;
+void main() {
+  gl_Position = position;
+  texCoordsOut = texCoordsIn;
+}
+END
+
+SHADER fragment fragShaderTex GLSL
+#version 430
+layout(location = 0) in vec2 texCoordsIn;
+layout(location = 0) out vec4 colorOut;
+layout(set=0, binding=0) uniform sampler2D referenceSampler;
+layout(set=0, binding=1) uniform samplerBuffer bufferSampler;
+void main() {
+
+  vec4 referenceValue = texture(referenceSampler, texCoordsIn);
+  vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5)));
+
+  if (bufferValue == referenceValue)
+      colorOut = vec4(0., 1., 0., 1.);
+  else
+      colorOut = vec4(1., 0., 0., 1.);
+}
+END
+
+IMAGE texture FORMAT R8G8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+152 10 255 20 254 3 255 7 255 55 255 255 251 255 255
+272 81 205 22 244 20 255 20 255 155 112 255 111 215 190 255 0
+126 44 201 23 133 229 255 10 255 207 255 255 125 255 255
+56 120 101 48 177 2 255 10 255 207 0 255 132 33 0 255 0
+45 130 189 89 77 88 255 120 255 201 255 211 233 255 255
+135 134 202 42 88 76 255 9 255 41 0 255 36 244 0 255 0
+185 34 133 199 87 176 255 12 255 244 255 255 2 255 255
+142 88 177 99 150 190 255 16 17 25 39 39 11 151 23 255 0
+END
+
+IMAGE texture2 FORMAT R8G8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+152 10 255 20 254 3 255 7 255 55 255 255 251 255 255
+272 81 205 22 244 20 255 20 255 155 112 255 111 215 190 255 0
+126 44 201 23 133 229 255 10 255 207 255 255 125 255 255
+56 120 101 48 177 2 255 10 255 207 0 255 132 33 0 255 0
+45 130 189 89 77 88 255 120 255 201 255 211 233 255 255
+135 134 202 42 88 76 255 9 255 41 0 255 36 244 0 255 0
+185 34 133 199 87 176 255 12 255 244 255 255 2 255 255
+142 88 177 99 150 190 255 16 17 25 39 39 11 151 23 255 0
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+BUFFER position DATA_TYPE vec2<float> DATA
+-1. -1.
+ 1. -1.
+-1.  1.
+ 1. -1.
+ 1.  1.
+-1.  1.
+END
+
+BUFFER texcoords DATA_TYPE vec2<float> DATA
+0.0 0.0
+1.0 0.0
+0.0 1.0
+1.0 0.0
+1.0 1.0
+0.0 1.0
+END
+
+PIPELINE graphics pipeline
+  ATTACH vertShaderTex
+  ATTACH fragShaderTex
+  BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1
+  VERTEX_DATA position LOCATION 0
+  VERTEX_DATA texcoords LOCATION 1
+  FRAMEBUFFER_SIZE 8 8
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR pipeline
+RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
+EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber b/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8_srgb.amber
new file mode 100644 (file)
index 0000000..f893158
--- /dev/null
@@ -0,0 +1,104 @@
+#!amber
+# Copyright 2022 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER vertex vertShaderTex GLSL
+#version 430
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texCoordsIn;
+layout(location = 0) out vec2 texCoordsOut;
+void main() {
+  gl_Position = position;
+  texCoordsOut = texCoordsIn;
+}
+END
+
+SHADER fragment fragShaderTex GLSL
+#version 430
+layout(location = 0) in vec2 texCoordsIn;
+layout(location = 0) out vec4 colorOut;
+layout(set=0, binding=0) uniform sampler2D referenceSampler;
+layout(set=0, binding=1) uniform samplerBuffer bufferSampler;
+void main() {
+
+  vec4 referenceValue = texture(referenceSampler, texCoordsIn);
+  vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5)));
+
+  if (bufferValue == referenceValue)
+      colorOut = vec4(0., 1., 0., 1.);
+  else
+      colorOut = vec4(1., 0., 0., 1.);
+}
+END
+
+IMAGE texture FORMAT R8G8B8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+125 87 23 255 0 0 155 0 0 255 110 110 212 11 0 255 11 10 115 12 11 255 0 0
+215 8 21 255 0 0 55 0 0 255 180 230 220 22 13 215 12 231 215 44 23 255 0 0
+152 35 0 255 0 0 155 0 0 255 88 20 255 12 23 121 122 123 241 4 10
+2 255 1 0 255 0 0 255 0 0 255 77 0 255 0 0 255 0 0 255 0 0 255 0
+230 255 66 0 255 0 0 255 0 0 255 54 74 255 0 0 255 0 0 255 0 0 255 0
+33 255 0 0 255 0 0 155 0 0 255 76 75 255 0
+23 120 233 0 0 255 0 0 155 43 34 212 111 120 255 0 10 252 22 123 215 33 30 223
+44 220 35 22 24 255 0 0 215 120 33 211 122 120 255 130 12 251 22 23 221 210 211 215
+55 0 244 0 87 85 82 0 251 220 32 205
+END
+
+IMAGE texture2 FORMAT R8G8B8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+125 87 23 255 0 0 155 0 0 255 110 110 212 11 0 255 11 10 115 12 11 255 0 0
+215 8 21 255 0 0 55 0 0 255 180 230 220 22 13 215 12 231 215 44 23 255 0 0
+152 35 0 255 0 0 155 0 0 255 88 20 255 12 23 121 122 123 241 4 10
+2 255 1 0 255 0 0 255 0 0 255 77 0 255 0 0 255 0 0 255 0 0 255 0
+230 255 66 0 255 0 0 255 0 0 255 54 74 255 0 0 255 0 0 255 0 0 255 0
+33 255 0 0 255 0 0 155 0 0 255 76 75 255 0
+23 120 233 0 0 255 0 0 155 43 34 212 111 120 255 0 10 252 22 123 215 33 30 223
+44 220 35 22 24 255 0 0 215 120 33 211 122 120 255 130 12 251 22 23 221 210 211 215
+55 0 244 0 87 85 82 0 251 220 32 205
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+BUFFER position DATA_TYPE vec2<float> DATA
+-1. -1.
+ 1. -1.
+-1.  1.
+ 1. -1.
+ 1.  1.
+-1.  1.
+END
+
+BUFFER texcoords DATA_TYPE vec2<float> DATA
+0.0 0.0
+1.0 0.0
+0.0 1.0
+1.0 0.0
+1.0 1.0
+0.0 1.0
+END
+
+PIPELINE graphics pipeline
+  ATTACH vertShaderTex
+  ATTACH fragShaderTex
+  BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1
+  VERTEX_DATA position LOCATION 0
+  VERTEX_DATA texcoords LOCATION 1
+  FRAMEBUFFER_SIZE 8 8
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR pipeline
+RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
+EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber b/external/vulkancts/data/vulkan/amber/texture/texel_buffer/uniform/srgb/r8g8b8a8_srgb.amber
new file mode 100644 (file)
index 0000000..0240d35
--- /dev/null
@@ -0,0 +1,110 @@
+#!amber
+# Copyright 2022 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHADER vertex vertShaderTex GLSL
+#version 430
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec2 texCoordsIn;
+layout(location = 0) out vec2 texCoordsOut;
+void main() {
+  gl_Position = position;
+  texCoordsOut = texCoordsIn;
+}
+END
+
+SHADER fragment fragShaderTex GLSL
+#version 430
+layout(location = 0) in vec2 texCoordsIn;
+layout(location = 0) out vec4 colorOut;
+layout(set=0, binding=0) uniform sampler2D referenceSampler;
+layout(set=0, binding=1) uniform samplerBuffer bufferSampler;
+void main() {
+
+  vec4 referenceValue = texture(referenceSampler, texCoordsIn);
+  vec4 bufferValue = texelFetch(bufferSampler, int((gl_FragCoord.y-0.5) * 8 + (gl_FragCoord.x-0.5)));
+
+  if (bufferValue == referenceValue)
+      colorOut = vec4(0., 1., 0., 1.);
+  else
+      colorOut = vec4(1., 0., 0., 1.);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212
+255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115
+255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222
+255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255
+80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235
+20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205
+90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215
+130 215 35 255 11 255 33 251 90 255 55 255 110
+50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0
+55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0
+66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0
+68 255 255 0 0 222 233
+END
+
+IMAGE texture2 FORMAT R8G8B8A8_SRGB DIM_2D WIDTH 8 HEIGHT 8 DATA
+255 100 0 255 255 80 0 255 255 33 19 255 255 44 70 255 255 9 8 253 155 0 0 212
+255 0 0 255 255 60 60 255 255 40 17 205 255 45 120 255 255 2 8 153 250 0 0 115
+255 0 0 255 255 80 23 255 255 50 12 215 255 46 11 255 255 34 78 255 221 0 0 222
+255 0 0 255 255 80 44 255 255 80 90 155 255 13 12 255 255 32 56 255
+80 255 20 255 40 255 36 251 0 255 110 175 0 225 0 55 0 151 0 51 0 225 0 235
+20 215 32 255 30 255 34 215 20 255 32 255 220 255 0 25 0 215 0 25 0 208 0 205
+90 255 34 255 30 255 0 215 80 255 44 255 110 255 0 152 0 225 0 21 0 203 0 215
+130 215 35 255 11 255 33 251 90 255 55 255 110
+50 255 255 160 11 105 214 0 10 134 158 190 0 255 255 0 0 255 255 0 90 255 255 0
+55 151 205 170 10 103 254 20 0 123 238 35 10 215 250 10 22 255 235 33 80 255 255 0
+66 115 205 120 11 212 244 44 53 250 250 0 20 255 255 0 23 255 253 0 43 255 255 0
+68 255 255 0 0 222 233
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+BUFFER position DATA_TYPE vec2<float> DATA
+-1. -1.
+ 1. -1.
+-1.  1.
+ 1. -1.
+ 1.  1.
+-1.  1.
+END
+
+BUFFER texcoords DATA_TYPE vec2<float> DATA
+0.0 0.0
+1.0 0.0
+0.0 1.0
+1.0 0.0
+1.0 1.0
+0.0 1.0
+END
+
+PIPELINE graphics pipeline
+  ATTACH vertShaderTex
+  ATTACH fragShaderTex
+  BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER texture2 AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 1
+  VERTEX_DATA position LOCATION 0
+  VERTEX_DATA texcoords LOCATION 1
+  FRAMEBUFFER_SIZE 8 8
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR pipeline
+RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
+EXPECT framebuffer IDX 0 0 SIZE 8 8 EQ_RGBA 0 255 0 255
index 9cc00b6..f6e7988 100644 (file)
@@ -39,6 +39,67 @@ tcu::TestCaseGroup* createUniformTexelBufferTests (tcu::TestContext& testCtx)
 {
        de::MovePtr<tcu::TestCaseGroup> uniform  (new tcu::TestCaseGroup(testCtx, "uniform", "Test uniform texel buffer"));
 
+       // .srgb
+       {
+               tcu::TestCaseGroup* const       srgb            = new tcu::TestCaseGroup(testCtx, "srgb", "Test uniform texel buffer with srgb formats");
+               static const char                       dataDir[]       = "texture/texel_buffer/uniform/srgb";
+
+               static const struct {
+                       std::string     testName;
+                       VkFormat        format;
+               }                                                       cases[]         =
+               {
+                       {"r8g8b8a8_srgb", VK_FORMAT_R8G8B8A8_SRGB},
+                       {"b8g8r8a8_srgb", VK_FORMAT_B8G8R8A8_SRGB},
+                       {"b8g8r8_srgb",   VK_FORMAT_B8G8R8_SRGB},
+                       {"r8g8b8_srgb",   VK_FORMAT_R8G8B8_SRGB},
+                       {"r8g8_srgb",     VK_FORMAT_R8G8_SRGB},
+                       {"r8_srgb",       VK_FORMAT_R8_SRGB}
+               };
+
+               uniform->addChild(srgb);
+
+               for (int i = 0; i < DE_LENGTH_OF_ARRAY(cases); ++i)
+               {
+                       const std::string                                                       fileName                        = cases[i].testName + ".amber";
+                       const VkImageUsageFlags                                         usageFlags                      = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
+
+                       const deUint32                                                          width                           = 8;
+                       const deUint32                                                          height                          = 8;
+
+                       VkImageCreateInfo                                                       imageParams                     =
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,    //  VkStructureType         sType;
+                               DE_NULL,                                                                //  const void*             pNext;
+                               DE_NULL,                                                                //  VkImageCreateFlags      flags;
+                               VK_IMAGE_TYPE_2D,                                               //  VkImageType             imageType;
+                               cases[i].format,                                                //  VkFormat                format;
+                               VkExtent3D({width, height, 1u}),                //  VkExtent3D              extent;
+                               1u,                                                                             //  deUint32                mipLevels;
+                               1u,                                                                             //  deUint32                arrayLayers;
+                               VK_SAMPLE_COUNT_1_BIT,                                  //  VkSampleCountFlagBits   samples;
+                               VK_IMAGE_TILING_OPTIMAL,                                //  VkImageTiling           tiling;
+                               usageFlags,                                                             //  VkImageUsageFlags       usage;
+                               VK_SHARING_MODE_EXCLUSIVE,                              //  VkSharingMode           sharingMode;
+                               0u,                                                                             //  deUint32                queueFamilyIndexCount;
+                               DE_NULL,                                                                //  const deUint32*         pQueueFamilyIndices;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                              //  VkImageLayout           initialLayout;
+                       };
+
+                       std::vector<VkImageCreateInfo>                          imageRequirements;
+                       imageRequirements.push_back(imageParams);
+
+                       std::vector<cts_amber::BufferRequirement>       bufferRequirements;
+                       bufferRequirements.push_back({cases[i].format, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT});
+
+                       cts_amber::AmberTestCase*                                       testCase                        =
+                                       cts_amber::createAmberTestCase(testCtx, cases[i].testName.c_str(), "",
+                                                                                                  dataDir, fileName, std::vector<std::string>(),
+                                                                                                  imageRequirements, bufferRequirements);
+                       srgb->addChild(testCase);
+               }
+       }
+
        // .packed
        {
                tcu::TestCaseGroup* const       packed          = new tcu::TestCaseGroup(testCtx, "packed", "Test uniform texel buffer with packed formats");
index 06299be..23bb283 100644 (file)
@@ -14870,6 +14870,12 @@ dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8b8a8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8b8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8g8_snorm
 dEQP-VK.texture.conversion.snorm_clamp_linear.r8_snorm
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8b8a8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.b8g8r8a8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.b8g8r8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8b8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8g8_srgb
+dEQP-VK.texture.texel_buffer.uniform.srgb.r8_srgb
 dEQP-VK.texture.texel_buffer.uniform.packed.a2b10g10r10-uint-pack32
 dEQP-VK.texture.texel_buffer.uniform.packed.a2b10g10r10-unorm-pack32
 dEQP-VK.texture.texel_buffer.uniform.packed.a8b8g8r8-sint-pack32