From: Ari Suonpaa Date: Thu, 4 Jun 2020 12:17:07 +0000 (+0300) Subject: Add tests for SNORM clamping X-Git-Tag: upstream/1.3.5~1338 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52b52b8130e55ea0687a0346189891c352411456;p=platform%2Fupstream%2FVK-GL-CTS.git Add tests for SNORM clamping Added tests that verify the smallest integer value in SNORM format gets properly clamped to -1. Also reorganized texture conversion test group and added image support checking for Amber test case framework. VK-GL-CTS Issue: 2303 New tests: dEQP-VK.texture.conversion.* Components: Vulkan Change-Id: I10d10ec4c5a3520d81bfe584c3fa19149d763806 --- diff --git a/android/cts/master/vk-master-2020-03-01.txt b/android/cts/master/vk-master-2020-03-01.txt index eadf27d..839ea86 100644 --- a/android/cts/master/vk-master-2020-03-01.txt +++ b/android/cts/master/vk-master-2020-03-01.txt @@ -198392,7 +198392,20 @@ dEQP-VK.texture.swizzle.texture_coordinate.astc_12x12_srgb_block_2d_npot_sparse_ dEQP-VK.texture.subgroup_lod.texturelod dEQP-VK.texture.subgroup_lod.texturegrad dEQP-VK.texture.subgroup_lod.texelfetch -dEQP-VK.texture.conversion.b10g11r11-negative-values +dEQP-VK.texture.conversion.ufloat_negative_values.b10g11r11 +dEQP-VK.texture.conversion.snorm_clamp.a2b10g10r10_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.a2r10g10b10_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.a8b8g8r8_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.b8g8r8a8_snorm +dEQP-VK.texture.conversion.snorm_clamp.b8g8r8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16b16a16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16b16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8b8a8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8b8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8_snorm dEQP-VK.geometry.layered.1d_array.64_1_4.render_to_default_layer dEQP-VK.geometry.layered.1d_array.64_1_4.render_to_one dEQP-VK.geometry.layered.1d_array.64_1_4.render_to_all diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index fd863a4..2b4ecd3 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -556628,7 +556628,20 @@ dEQP-VK.texture.swizzle.texture_coordinate.astc_12x12_srgb_block_2d_npot_sparse_ dEQP-VK.texture.subgroup_lod.texturelod dEQP-VK.texture.subgroup_lod.texturegrad dEQP-VK.texture.subgroup_lod.texelfetch -dEQP-VK.texture.conversion.b10g11r11-negative-values +dEQP-VK.texture.conversion.ufloat_negative_values.b10g11r11 +dEQP-VK.texture.conversion.snorm_clamp.a2b10g10r10_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.a2r10g10b10_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.a8b8g8r8_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.b8g8r8a8_snorm +dEQP-VK.texture.conversion.snorm_clamp.b8g8r8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16b16a16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16b16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8b8a8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8b8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8_snorm dEQP-VK.geometry.input.basic_primitive.points dEQP-VK.geometry.input.basic_primitive.lines dEQP-VK.geometry.input.basic_primitive.line_strip diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber new file mode 100644 index 0000000..d517cbd --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a2b10g10r10-snorm-pack32.amber @@ -0,0 +1,51 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +# The fill value has the most significant bit enabled for each component. +IMAGE texture FORMAT A2B10G10R10_SNORM_PACK32 DIM_1D WIDTH 1 FILL 2684879360 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber new file mode 100644 index 0000000..271b445 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a2r10g10b10-snorm-pack32.amber @@ -0,0 +1,51 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +# The fill value has the most significant bit enabled for each component. +IMAGE texture FORMAT A2R10G10B10_SNORM_PACK32 DIM_1D WIDTH 1 FILL 2684879360 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber new file mode 100644 index 0000000..1b9f5bb --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/a8b8g8r8-snorm-pack32.amber @@ -0,0 +1,51 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +# The fill value has the most significant bit enabled for each component. +IMAGE texture FORMAT A8B8G8R8_SNORM_PACK32 DIM_1D WIDTH 1 FILL 2155905152 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber new file mode 100644 index 0000000..b46007c --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 3; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT B8G8R8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber new file mode 100644 index 0000000..e849aea --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/b8g8r8a8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT B8G8R8A8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber new file mode 100644 index 0000000..20df541 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 1; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber new file mode 100644 index 0000000..15fe4ec --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 2; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16G16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber new file mode 100644 index 0000000..7575ef4 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 3; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16G16B16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber new file mode 100644 index 0000000..6a8dcfb --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r16g16b16a16-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R16G16B16A16_SNORM DIM_1D WIDTH 1 FILL -32768 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber new file mode 100644 index 0000000..50ae6ca --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 1; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber new file mode 100644 index 0000000..f310950 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 2; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8G8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber new file mode 100644 index 0000000..d7b9997 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 3; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8G8B8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber new file mode 100644 index 0000000..0f316dc --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/texture/conversion/snorm_clamp/r8g8b8a8-snorm.amber @@ -0,0 +1,50 @@ +#!amber +# Copyright 2020 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 +# +# http://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 vert_shader PASSTHROUGH + +SHADER fragment frag_shader GLSL +#version 430 +layout(location = 0) out vec4 frag_out; +uniform layout(set=0, binding=0) sampler1D tex_sampler; +void main() +{ + vec4 color = texture(tex_sampler, 0.0); + for (int i = 0; i < 4; i++) + { + if (color[i] != -1.0) + { + frag_out = vec4(1, 0, 0, 1); + return; + } + } + + frag_out = vec4(0, 1, 0, 1); +} +END + +IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 32 HEIGHT 32 +IMAGE texture FORMAT R8G8B8A8_SNORM DIM_1D WIDTH 1 FILL -128 +SAMPLER sampler + +PIPELINE graphics pipeline + ATTACH vert_shader + ATTACH frag_shader + BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0 + BIND BUFFER framebuffer AS color LOCATION 0 +END + +RUN pipeline DRAW_RECT POS 0 0 SIZE 32 32 +EXPECT framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 0 255 0 255 diff --git a/external/vulkancts/data/vulkan/amber/texture/conversion/b10g11r11-ufloat-pack32-negative-values.amber b/external/vulkancts/data/vulkan/amber/texture/conversion/ufloat_negative_values/b10g11r11-ufloat-pack32.amber similarity index 100% rename from external/vulkancts/data/vulkan/amber/texture/conversion/b10g11r11-ufloat-pack32-negative-values.amber rename to external/vulkancts/data/vulkan/amber/texture/conversion/ufloat_negative_values/b10g11r11-ufloat-pack32.amber diff --git a/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.cpp b/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.cpp index beac1f2..a0b08e3 100644 --- a/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.cpp +++ b/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.cpp @@ -37,6 +37,7 @@ #include "tcuResource.hpp" #include "tcuTestLog.hpp" #include "vkSpirVProgram.hpp" +#include "vkImageUtil.hpp" namespace vkt { @@ -58,14 +59,14 @@ AmberTestCase::~AmberTestCase (void) delete m_recipe; } -TestInstance* AmberTestCase::createInstance(Context& ctx) const +TestInstance* AmberTestCase::createInstance (Context& ctx) const { return new AmberTestInstance(ctx, m_recipe); } -static amber::EngineConfig* createEngineConfig(Context& ctx) +static amber::EngineConfig* createEngineConfig (Context& ctx) { - amber::EngineConfig* vkConfig = GetVulkanConfig(ctx.getInstance(), + amber::EngineConfig* vkConfig = GetVulkanConfig(ctx.getInstance(), ctx.getPhysicalDevice(), ctx.getDevice(), &ctx.getDeviceFeatures(), &ctx.getDeviceFeatures2(), ctx.getInstanceExtensions(), ctx.getDeviceExtensions(), ctx.getUniversalQueueFamilyIndex(), @@ -160,6 +161,9 @@ void AmberTestCase::checkSupport(Context& ctx) const TCU_THROW(NotSupportedError, message.c_str()); } } + + for (auto req : m_imageRequirements) + checkImageSupport(ctx.getInstanceInterface(), ctx.getPhysicalDevice(), req); } class Delegate : public amber::Delegate @@ -229,7 +233,7 @@ amber::Result Delegate::LoadBufferData (const std::string file_name, return {}; } -bool AmberTestCase::parse(const std::string& readFilename) +bool AmberTestCase::parse (const std::string& readFilename) { std::string script = ShaderSourceProvider::getSource(m_testCtx.getArchive(), readFilename.c_str()); if (script.empty()) @@ -262,7 +266,7 @@ bool AmberTestCase::parse(const std::string& readFilename) return true; } -void AmberTestCase::initPrograms(vk::SourceCollections& programCollection) const +void AmberTestCase::initPrograms (vk::SourceCollections& programCollection) const { std::vector shaders = m_recipe->GetShaderInfo(); for (size_t i = 0; i < shaders.size(); ++i) @@ -380,12 +384,12 @@ tcu::TestStatus AmberTestInstance::iterate (void) return r.IsSuccess() ? tcu::TestStatus::pass("Pass") :tcu::TestStatus::fail("Fail"); } -void AmberTestCase::setSpirVAsmBuildOptions(const vk::SpirVAsmBuildOptions& asm_options) +void AmberTestCase::setSpirVAsmBuildOptions (const vk::SpirVAsmBuildOptions& asm_options) { m_asm_options = asm_options; } -void AmberTestCase::addRequirement(const std::string& requirement) +void AmberTestCase::addRequirement (const std::string& requirement) { if (requirement.find(".") != std::string::npos) m_required_features.insert(requirement); @@ -393,5 +397,10 @@ void AmberTestCase::addRequirement(const std::string& requirement) m_required_extensions.insert(requirement); } +void AmberTestCase::addImageRequirement (vk::VkImageCreateInfo info) +{ + m_imageRequirements.push_back(info); +} + } // cts_amber } // vkt diff --git a/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.hpp b/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.hpp index f0c61c1..55b8ef2 100644 --- a/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.hpp +++ b/external/vulkancts/modules/vulkan/amber/vktAmberTestCase.hpp @@ -88,6 +88,8 @@ public: // An instance or device extension will not have a period in its name. void addRequirement(const std::string& requirement); + void addImageRequirement(vk::VkImageCreateInfo info); + private: bool parse (const std::string& readFilename); @@ -108,14 +110,17 @@ private: // An example entry is: "VariablePointerFeatures.variablePointers". // Use a set for consistent ordering. std::set m_required_features; + + std::vector m_imageRequirements; }; -AmberTestCase* createAmberTestCase (tcu::TestContext& testCtx, - const char* name, - const char* description, - const char* category, - const std::string& filename, - const std::vector requirements = std::vector()); +AmberTestCase* createAmberTestCase (tcu::TestContext& testCtx, + const char* name, + const char* description, + const char* category, + const std::string& filename, + const std::vector requirements = std::vector(), + const std::vector imageRequirements = std::vector()); void createAmberTestsFromIndexFile (tcu::TestContext& testCtx, tcu::TestCaseGroup* group, diff --git a/external/vulkancts/modules/vulkan/amber/vktAmberTestCaseUtil.cpp b/external/vulkancts/modules/vulkan/amber/vktAmberTestCaseUtil.cpp index c68e9d2..59be9be 100644 --- a/external/vulkancts/modules/vulkan/amber/vktAmberTestCaseUtil.cpp +++ b/external/vulkancts/modules/vulkan/amber/vktAmberTestCaseUtil.cpp @@ -173,12 +173,14 @@ void createAmberTestsFromIndexFile (tcu::TestContext& testCtx, tcu::TestCaseGrou } while (testCase); } -AmberTestCase* createAmberTestCase (tcu::TestContext& testCtx, - const char* name, - const char* description, - const char* category, - const std::string& filename, - const std::vector requirements) +AmberTestCase* createAmberTestCase (tcu::TestContext& testCtx, + const char* name, + const char* description, + const char* category, + const std::string& filename, + const std::vector requirements, + const std::vector imageRequirements) + { // shader_test files are saved in /external/vulkancts/data/vulkan/amber// std::string readFilename("vulkan/amber/"); @@ -191,6 +193,9 @@ AmberTestCase* createAmberTestCase (tcu::TestContext& testCtx, for (auto req : requirements) testCase->addRequirement(req); + for (auto req : imageRequirements) + testCase->addImageRequirement(req); + return testCase; } diff --git a/external/vulkancts/modules/vulkan/texture/vktTextureConversionTests.cpp b/external/vulkancts/modules/vulkan/texture/vktTextureConversionTests.cpp index f061d39..38653c0 100644 --- a/external/vulkancts/modules/vulkan/texture/vktTextureConversionTests.cpp +++ b/external/vulkancts/modules/vulkan/texture/vktTextureConversionTests.cpp @@ -35,11 +35,94 @@ namespace texture namespace { +void populateUfloatNegativeValuesTests (tcu::TestCaseGroup* group) +{ + tcu::TestContext& testCtx = group->getTestContext(); + VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_STORAGE_BIT; + + VkImageCreateInfo info = + { + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType + DE_NULL, // const void* pNext + 0, // VkImageCreateFlags flags + VK_IMAGE_TYPE_2D, // VkImageType imageType + VK_FORMAT_B10G11R11_UFLOAT_PACK32, // VkFormat format + {50u, 50u, 1u}, // VkExtent3D extent + 1u, // uint32_t mipLevels + 1u, // uint32_t arrayLayers + VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples + VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling + usage, // VkImageUsageFlags usage + VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode + 0u, // uint32_t queueFamilyIndexCount + DE_NULL, // const uint32_t* pQueueFamilyIndices + VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout + }; + + group->addChild(cts_amber::createAmberTestCase(testCtx, "b10g11r11", "", "texture/conversion/ufloat_negative_values", "b10g11r11-ufloat-pack32.amber", + std::vector(), std::vector(1, info))); +} + +void populateSnormClampTests (tcu::TestCaseGroup* group) +{ + tcu::TestContext& testCtx = group->getTestContext(); + VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; + + VkImageCreateInfo info = + { + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType + DE_NULL, // const void* pNext + 0, // VkImageCreateFlags flags + VK_IMAGE_TYPE_1D, // VkImageType imageType + VK_FORMAT_UNDEFINED, // VkFormat format + {1u, 1u, 1u}, // VkExtent3D extent + 1u, // uint32_t mipLevels + 1u, // uint32_t arrayLayers + VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples + VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling + usage, // VkImageUsageFlags usage + VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode + 0u, // uint32_t queueFamilyIndexCount + DE_NULL, // const uint32_t* pQueueFamilyIndices + VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout + }; + + struct TestParams + { + std::string testName; + std::string amberFile; + VkFormat format; + } params[] = + { + { "a2b10g10r10_snorm_pack32", "a2b10g10r10-snorm-pack32.amber", VK_FORMAT_A2B10G10R10_SNORM_PACK32 }, + { "a2r10g10b10_snorm_pack32", "a2r10g10b10-snorm-pack32.amber", VK_FORMAT_A2R10G10B10_SNORM_PACK32 }, + { "a8b8g8r8_snorm_pack32", "a8b8g8r8-snorm-pack32.amber", VK_FORMAT_A8B8G8R8_SNORM_PACK32 }, + { "b8g8r8a8_snorm", "b8g8r8a8-snorm.amber", VK_FORMAT_B8G8R8A8_SNORM }, + { "b8g8r8_snorm", "b8g8r8-snorm.amber", VK_FORMAT_B8G8R8_SNORM }, + { "r16g16b16a16_snorm", "r16g16b16a16-snorm.amber", VK_FORMAT_R16G16B16A16_SNORM }, + { "r16g16b16_snorm", "r16g16b16-snorm.amber", VK_FORMAT_R16G16B16_SNORM }, + { "r16g16_snorm", "r16g16-snorm.amber", VK_FORMAT_R16G16_SNORM }, + { "r16_snorm", "r16-snorm.amber", VK_FORMAT_R16_SNORM }, + { "r8g8b8a8_snorm", "r8g8b8a8-snorm.amber", VK_FORMAT_R8G8B8A8_SNORM }, + { "r8g8b8_snorm", "r8g8b8-snorm.amber", VK_FORMAT_R8G8B8_SNORM }, + { "r8g8_snorm", "r8g8-snorm.amber", VK_FORMAT_R8G8_SNORM }, + { "r8_snorm", "r8-snorm.amber", VK_FORMAT_R8_SNORM } + }; + + for (const auto& param : params) + { + info.format = param.format; + group->addChild(cts_amber::createAmberTestCase(testCtx, param.testName.c_str(), "", "texture/conversion/snorm_clamp", param.amberFile.c_str(), + std::vector(), std::vector(1, info))); + } +} + void populateTextureConversionTests (tcu::TestCaseGroup* group) { tcu::TestContext& testCtx = group->getTestContext(); - group->addChild(cts_amber::createAmberTestCase(testCtx, "b10g11r11-negative-values", "", "texture/conversion", "b10g11r11-ufloat-pack32-negative-values.amber")); + group->addChild(createTestGroup(testCtx, "ufloat_negative_values", "Tests for converting negative floats to unsigned floats", populateUfloatNegativeValuesTests)); + group->addChild(createTestGroup(testCtx, "snorm_clamp", "Tests for SNORM corner cases when smallest negative number gets clamped to -1", populateSnormClampTests)); } } // anonymous diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt index 1dd8062..6d07ceb 100644 --- a/external/vulkancts/mustpass/master/vk-default.txt +++ b/external/vulkancts/mustpass/master/vk-default.txt @@ -558694,7 +558694,20 @@ dEQP-VK.texture.swizzle.texture_coordinate.astc_12x12_srgb_block_2d_npot_sparse_ dEQP-VK.texture.subgroup_lod.texturelod dEQP-VK.texture.subgroup_lod.texturegrad dEQP-VK.texture.subgroup_lod.texelfetch -dEQP-VK.texture.conversion.b10g11r11-negative-values +dEQP-VK.texture.conversion.ufloat_negative_values.b10g11r11 +dEQP-VK.texture.conversion.snorm_clamp.a2b10g10r10_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.a2r10g10b10_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.a8b8g8r8_snorm_pack32 +dEQP-VK.texture.conversion.snorm_clamp.b8g8r8a8_snorm +dEQP-VK.texture.conversion.snorm_clamp.b8g8r8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16b16a16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16b16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16g16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r16_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8b8a8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8b8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8g8_snorm +dEQP-VK.texture.conversion.snorm_clamp.r8_snorm dEQP-VK.geometry.input.basic_primitive.points dEQP-VK.geometry.input.basic_primitive.lines dEQP-VK.geometry.input.basic_primitive.line_strip