From 03ee71e86c8ac46bc40e8236c54141832a686478 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Thu, 7 Jan 2021 12:18:07 +0100 Subject: Add test for pure initializer gl_FragDepth. Tests that the builtin is considered active. --- .../asm/frag/only-initializer-frag-depth.asm.frag | 17 +++++++++++++++ .../asm/frag/only-initializer-frag-depth.asm.frag | 17 +++++++++++++++ .../asm/frag/only-initializer-frag-depth.asm.frag | 8 +++++++ .../asm/frag/only-initializer-frag-depth.asm.frag | 25 ++++++++++++++++++++++ .../asm/frag/only-initializer-frag-depth.asm.frag | 25 ++++++++++++++++++++++ .../asm/frag/only-initializer-frag-depth.asm.frag | 25 ++++++++++++++++++++++ 6 files changed, 117 insertions(+) create mode 100644 reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag diff --git a/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 00000000..dcbe5d13 --- /dev/null +++ b/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,17 @@ +static float gl_FragDepth = 0.5f; +struct SPIRV_Cross_Output +{ + float gl_FragDepth : SV_Depth; +}; + +void frag_main() +{ +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + return stage_output; +} diff --git a/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 00000000..3f552ebb --- /dev/null +++ b/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float gl_FragDepth [[depth(any)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 00000000..1041f711 --- /dev/null +++ b/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,8 @@ +#version 450 + +const float _3_init = 0.5; +void main() +{ + gl_FragDepth = _3_init; +} + diff --git a/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 00000000..17aab1d8 --- /dev/null +++ b/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 10 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpName %main "main" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %float_0_5 = OpConstant %float 0.5 +%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0_5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 00000000..17aab1d8 --- /dev/null +++ b/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 10 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpName %main "main" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %float_0_5 = OpConstant %float 0.5 +%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0_5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 00000000..17aab1d8 --- /dev/null +++ b/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 10 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpName %main "main" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %float_0_5 = OpConstant %float 0.5 +%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0_5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd -- cgit v1.2.3