diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-01-07 14:18:07 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-01-07 17:32:15 +0300 |
commit | 03ee71e86c8ac46bc40e8236c54141832a686478 (patch) | |
tree | 1140879c3f370dff14fc6f133378c962c2cac96d | |
parent | 3776d8978c19ecd3e4d8037aa26ac956cc52c1b9 (diff) |
Add test for pure initializer gl_FragDepth.
Tests that the builtin is considered active.
6 files changed, 117 insertions, 0 deletions
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 <metal_stdlib> +#include <simd/simd.h> + +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 |