dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_greater_or_equal
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_equal
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_not_equal
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_3
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_4
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_3
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_4
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_3
dEQP-VK.spirv_assembly.instruction.spirv1p4.hlsl_functionality1.member_decorate_string
dEQP-VK.spirv_assembly.instruction.function_params.sampler_param
dEQP-VK.spirv_assembly.instruction.image_query.samples_storage
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_greater_or_equal
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_equal
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_not_equal
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_3
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_4
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_3
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_4
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_3
dEQP-VK.spirv_assembly.instruction.spirv1p4.opcopylogical.different_matrix_layout
dEQP-VK.spirv_assembly.instruction.spirv1p4.opcopylogical.different_matrix_strides
dEQP-VK.spirv_assembly.instruction.spirv1p4.opcopylogical.nested_arrays_different_inner_stride
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthGreater' execution mode.
+# Polygon depth: 0.6
+# FragDepth: 0.7
+# Depth compare op: greater
+# Execution mode: DepthGreater
+# Depth buffer clear value: 0.5
+# Description: FragDepth > Polygon depth: depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.6, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_greater) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.7;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthGreater
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.7
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.7;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthGreater' execution mode.
+# Polygon depth: 0.7
+# FragDepth: 0.6
+# Depth compare op: greater
+# Execution mode: DepthGreater
+# Depth buffer clear value: 0.5
+# Description: FragDepth < Polygon depth: violates the promise that FragDepth is greater than the implicit depth, but the depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.7, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_greater) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.6;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthGreater
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.6
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.6;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthGreater' execution mode.
+# Polygon depth: 0.2
+# FragDepth: 0.3
+# Depth compare op: greater
+# Execution mode: DepthGreater
+# Depth buffer clear value: 0.5
+# Description: FragDepth > Polygon depth: depth test should fail.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.2, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_greater) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.3;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthGreater
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.3
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.5;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthGreater' execution mode.
+# Polygon depth: 0.4
+# FragDepth: 0.3
+# Depth compare op: greater
+# Execution mode: DepthGreater
+# Depth buffer clear value: 0.5
+# Description: FragDepth > Polygon depth: violates the promise that FragDepth is greater than the implicit depth, the depth test should fail.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.4, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_greater) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.3;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthGreater
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.3
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.5;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthGreater' execution mode.
+# Polygon depth: 0.4
+# FragDepth: 0.6
+# Depth compare op: greater
+# Execution mode: DepthGreater
+# Depth buffer clear value: 0.5
+# Description: FragDepth > Polygon depth: depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.4, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_greater) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.6;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthGreater
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.6
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.6;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthLess' execution mode.
+# Polygon depth: 0.2
+# FragDepth: 0.1
+# Depth compare op: less
+# Execution mode: DepthLess
+# Depth buffer clear value: 0.5
+# Description: FragDepth < Polygon depth: depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.2, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_less) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.1;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthLess
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.1
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP less
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.1;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthLess' execution mode.
+# Polygon depth: 0.2
+# FragDepth: 0.3
+# Depth compare op: less
+# Execution mode: DepthLess
+# Depth buffer clear value: 0.5
+# Description: FragDepth > Polygon depth: violates the promise that FragDepth is less than the implicit depth, but the depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.2, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_less) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.3;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthLess
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.3
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP less
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.3;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthLess' execution mode.
+# Polygon depth: 0.7
+# FragDepth: 0.6
+# Depth compare op: less
+# Execution mode: DepthLess
+# Depth buffer clear value: 0.5
+# Description: FragDepth < Polygon depth: depth test should fail.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.7, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_less) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.6;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthLess
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.6
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP less
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.5;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthLess' execution mode.
+# Polygon depth: 0.6
+# FragDepth: 0.7
+# Depth compare op: less
+# Execution mode: DepthLess
+# Depth buffer clear value: 0.5
+# Description: FragDepth > Polygon depth: violates the promise that FragDepth is less than the implicit depth, the depth test should fail.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.6, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_less) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.7;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthLess
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.7
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP less
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.5;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthLess' execution mode.
+# Polygon depth: 0.6
+# FragDepth: 0.3
+# Depth compare op: less
+# Execution mode: DepthLess
+# Depth buffer clear value: 0.5
+# Description: FragDepth < Polygon depth: depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.6, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_less) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.3;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthLess
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.3
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP less
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.3;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthUnchanged' execution mode.
+# Polygon depth: 0.6
+# FragDepth: gl_FragCoord.y
+# Depth compare op: greater
+# Execution mode: DepthUnchanged
+# Depth buffer clear value: 0.5
+# Description: FragDepth == Polygon depth: depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.6, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_unchanged) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = gl_FragCoord.y;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth %gl_FragCoord
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthUnchanged
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpName %gl_FragCoord "gl_FragCoord"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ OpDecorate %gl_FragCoord BuiltIn FragCoord
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_ptr_Input_float = OpTypePointer Input %float
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ %19 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_2
+ %20 = OpLoad %float %19
+ OpStore %gl_FragDepth %20
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.6;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthUnchanged' execution mode.
+# Polygon depth: 0.4
+# FragDepth: gl_FragCoord.y
+# Depth compare op: greater
+# Execution mode: DepthUnchanged
+# Depth buffer clear value: 0.5
+# Description: FragDepth == Polygon depth: depth test should fail.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.4, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_unchanged) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = gl_FragCoord.y;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth %gl_FragCoord
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthUnchanged
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpName %gl_FragCoord "gl_FragCoord"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ OpDecorate %gl_FragCoord BuiltIn FragCoord
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_ptr_Input_float = OpTypePointer Input %float
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ %19 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_2
+ %20 = OpLoad %float %19
+ OpStore %gl_FragDepth %20
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.5;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthUnchanged' execution mode.
+# Polygon depth: 0.6
+# FragDepth: 0.7
+# Depth compare op: greater
+# Execution mode: DepthUnchanged
+# Depth buffer clear value: 0.5
+# Description: FragDepth != Polygon depth: violates the promise that FragDepth is equal to the implicit depth, the depth test should pass.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.6, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_unchanged) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.7;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthUnchanged
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.7
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.7;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
--- /dev/null
+#!amber
+
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# 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.
+
+# Test 'DepthUnchanged' execution mode.
+# Polygon depth: 0.3
+# FragDepth: 0.4
+# Depth compare op: greater
+# Execution mode: DepthUnchanged
+# Depth buffer clear value: 0.5
+# Description: FragDepth != Polygon depth: violates the promise that FragDepth is equal to the implicit depth, the depth test should fail.
+
+SHADER vertex vtex_shader GLSL
+#version 430
+layout(location = 0) in vec4 position;
+
+void main()
+{
+ gl_Position = vec4(position.xy, 0.3, 1.0);
+}
+END
+
+# The fragment shader is generated from following GLSL code:
+# #version 430
+#
+# layout(location = 0) out vec4 outColor;
+# layout(depth_unchanged) out float gl_FragDepth;
+#
+# void main()
+# {
+# outColor = vec4(0.0, 0.0, 0.0, 0.0);
+# gl_FragDepth = 0.4;
+# }
+SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
+
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpExecutionMode %main DepthUnchanged
+ OpSource GLSL 430
+ OpName %main "main"
+ OpName %outColor "outColor"
+ OpName %gl_FragDepth "gl_FragDepth"
+ OpDecorate %outColor Location 0
+ OpDecorate %gl_FragDepth BuiltIn FragDepth
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+%float_out_depth = OpConstant %float 0.4
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %outColor %11
+ OpStore %gl_FragDepth %float_out_depth
+ OpReturn
+ OpFunctionEnd
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+BUFFER depth_buf FORMAT D16_UNORM
+
+PIPELINE graphics my_pipeline
+ ATTACH vtex_shader
+ ATTACH frag_shader
+ DEPTH
+ TEST on
+ WRITE on
+ COMPARE_OP greater
+ CLAMP off
+ BOUNDS min 0.0 max 1.0
+ BIAS constant 0.0 clamp 0.0 slope 0.0
+ END
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER framebuffer AS color LOCATION 0
+ BIND BUFFER depth_buf AS depth_stencil
+END
+
+CLEAR_COLOR my_pipeline 0 0 0 255
+CLEAR_DEPTH my_pipeline 0.5
+CLEAR my_pipeline
+RUN my_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+# ---------------- VERIFY PIPELINE ------------------
+# This pipeline verifies the dept buffer contents.
+# The fragment shader writes color green if the value is expected,
+# otherwise red.
+
+SHADER vertex vtex_shader_verify PASSTHROUGH
+
+SHADER fragment frag_shader_verify GLSL
+#version 430
+
+layout(location = 0) out vec4 outColor;
+uniform layout(set=0, binding=0) sampler2D imageSampler;
+const float expectedValue = 0.5;
+const float tolerance = 0.01;
+
+void main()
+{
+ float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
+ if (abs(value - expectedValue) < tolerance)
+ outColor = vec4(0.0, 1.0, 0.0, 1.0);
+ else
+ outColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+END
+
+BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
+SAMPLER sampler
+
+PIPELINE graphics verify_pipeline
+ ATTACH vtex_shader_verify
+ ATTACH frag_shader_verify
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER framebuffer_verify AS color LOCATION 0
+END
+
+CLEAR_COLOR verify_pipeline 0 0 0 255
+CLEAR verify_pipeline
+RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+EXPECT framebuffer_verify IDX 0 0 SIZE 256 256 EQ_RGBA 0 255 0 255
return earlyFragTests.release();
}
+tcu::TestCaseGroup* createOpExecutionModeTests (tcu::TestContext& testCtx)
+{
+ de::MovePtr<tcu::TestCaseGroup> testGroup (new tcu::TestCaseGroup(testCtx, "execution_mode", "Execution mode tests"));
+
+ static const char dataDir[] = "spirv_assembly/instruction/graphics/execution_mode";
+
+ static const struct Case
+ {
+ const string name;
+ const string desc;
+ } cases[] =
+ {
+ { "depthless_0", "FragDepth < Polygon depth: depth test should pass." },
+ { "depthless_1", "FragDepth > Polygon depth: violates the promise that FragDepth is less than the implicit depth, but the depth test should pass." },
+ { "depthless_2", "FragDepth < Polygon depth: depth test should fail." },
+ { "depthless_3", "FragDepth > Polygon depth: violates the promise that FragDepth is less than the implicit depth, the depth test should fail." },
+ { "depthless_4", "FragDepth < Polygon depth: depth test should pass." },
+ { "depthgreater_0", "FragDepth > Polygon depth: depth test should pass." },
+ { "depthgreater_1", "FragDepth < Polygon depth: violates the promise that FragDepth is greater than the implicit depth, but the depth test should pass." },
+ { "depthgreater_2", "FragDepth > Polygon depth: depth test should fail." },
+ { "depthgreater_3", "FragDepth > Polygon depth: violates the promise that FragDepth is greater than the implicit depth, the depth test should fail." },
+ { "depthgreater_4", "FragDepth > Polygon depth: depth test should pass." },
+ { "depthunchanged_0", "FragDepth == Polygon depth: depth test should pass." },
+ { "depthunchanged_1", "FragDepth == Polygon depth: depth test should fail." },
+ { "depthunchanged_2", "FragDepth != Polygon depth: violates the promise that FragDepth is equal to the implicit depth, the depth test should pass." },
+ { "depthunchanged_3", "FragDepth != Polygon depth: violates the promise that FragDepth is equal to the implicit depth, the depth test should fail." },
+ };
+
+ for (const auto& case_ : cases)
+ {
+ cts_amber::AmberTestCase *testCase = cts_amber::createAmberTestCase(testCtx,
+ case_.name.c_str(),
+ case_.desc.c_str(),
+ dataDir,
+ case_.name + ".amber");
+ testGroup->addChild(testCase);
+ }
+
+ return testGroup.release();
+}
+
tcu::TestCaseGroup* createQueryGroup (tcu::TestContext& testCtx)
{
de::MovePtr<tcu::TestCaseGroup> testGroup (new tcu::TestCaseGroup(testCtx, "image_query", "image query tests"));
graphicsTests->addChild(createSpirvIdsAbuseTests(testCtx));
graphicsTests->addChild(create64bitCompareGraphicsGroup(testCtx));
graphicsTests->addChild(createEarlyFragmentTests(testCtx));
+ graphicsTests->addChild(createOpExecutionModeTests(testCtx));
instructionTests->addChild(computeTests.release());
instructionTests->addChild(graphicsTests.release());
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_greater_or_equal
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_equal
dEQP-VK.spirv_assembly.instruction.graphics.early_fragment.depth_not_equal
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_3
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthless_4
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_3
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthgreater_4
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_0
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_1
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_2
+dEQP-VK.spirv_assembly.instruction.graphics.execution_mode.depthunchanged_3
dEQP-VK.spirv_assembly.instruction.spirv1p4.opcopylogical.different_matrix_layout
dEQP-VK.spirv_assembly.instruction.spirv1p4.opcopylogical.different_matrix_strides
dEQP-VK.spirv_assembly.instruction.spirv1p4.opcopylogical.nested_arrays_different_inner_stride