forked from KhronosGroup/SPIRV-Cross
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for pure initializer gl_FragDepth.
Tests that the builtin is considered active.
- Loading branch information
1 parent
3776d89
commit 03ee71e
Showing
6 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
17 changes: 17 additions & 0 deletions
17
reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#version 450 | ||
|
||
const float _3_init = 0.5; | ||
void main() | ||
{ | ||
gl_FragDepth = _3_init; | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
25 changes: 25 additions & 0 deletions
25
shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
25 changes: 25 additions & 0 deletions
25
shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |