-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2331 from aitor-lunarg/force-depth-passthrough
MSL: Add option to force depth write in fragment shaders
- Loading branch information
Showing
13 changed files
with
236 additions
and
10 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
...opt/shaders-msl/frag/force-depth-write-early-tests.input-attachment-is-ds-attachment.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 | ||
{ | ||
float4 color [[color(0)]]; | ||
}; | ||
|
||
[[ early_fragment_tests ]] fragment main0_out main0(texture2d<float> inputDepth [[texture(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.color = inputDepth.read(uint2(gl_FragCoord.xy)); | ||
return out; | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
...rence/opt/shaders-msl/frag/force-depth-write-false.input-attachment-is-ds-attachment.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,19 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_out | ||
{ | ||
float4 color [[color(0)]]; | ||
float gl_FragDepth [[depth(any)]]; | ||
}; | ||
|
||
fragment main0_out main0(texture2d<float> inputDepth [[texture(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.color = inputDepth.read(uint2(gl_FragCoord.xy)); | ||
out.gl_FragDepth = 1.0; | ||
return out; | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
reference/opt/shaders-msl/frag/force-depth-write.input-attachment-is-ds-attachment.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,19 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_out | ||
{ | ||
float4 color [[color(0)]]; | ||
float gl_FragDepth [[depth(any)]]; | ||
}; | ||
|
||
fragment main0_out main0(texture2d<float> inputDepth [[texture(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.color = inputDepth.read(uint2(gl_FragCoord.xy)); | ||
out.gl_FragDepth = gl_FragCoord.z; | ||
return out; | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
...nce/shaders-msl/frag/force-depth-write-early-tests.input-attachment-is-ds-attachment.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 | ||
{ | ||
float4 color [[color(0)]]; | ||
}; | ||
|
||
[[ early_fragment_tests ]] fragment main0_out main0(texture2d<float> inputDepth [[texture(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.color = inputDepth.read(uint2(gl_FragCoord.xy)); | ||
return out; | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
reference/shaders-msl/frag/force-depth-write-false.input-attachment-is-ds-attachment.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,19 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_out | ||
{ | ||
float4 color [[color(0)]]; | ||
float gl_FragDepth [[depth(any)]]; | ||
}; | ||
|
||
fragment main0_out main0(texture2d<float> inputDepth [[texture(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.color = inputDepth.read(uint2(gl_FragCoord.xy)); | ||
out.gl_FragDepth = 1.0; | ||
return out; | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
reference/shaders-msl/frag/force-depth-write.input-attachment-is-ds-attachment.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,19 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_out | ||
{ | ||
float4 color [[color(0)]]; | ||
float gl_FragDepth [[depth(any)]]; | ||
}; | ||
|
||
fragment main0_out main0(texture2d<float> inputDepth [[texture(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.color = inputDepth.read(uint2(gl_FragCoord.xy)); | ||
out.gl_FragDepth = gl_FragCoord.z; | ||
return out; | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
shaders-msl/frag/force-depth-write-early-tests.input-attachment-is-ds-attachment.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,12 @@ | ||
#version 450 | ||
|
||
layout(early_fragment_tests) in; | ||
|
||
layout (input_attachment_index = 0, binding = 0) uniform subpassInput inputDepth; | ||
|
||
layout (location = 0) out vec4 color; | ||
|
||
void main() | ||
{ | ||
color = subpassLoad(inputDepth); | ||
} |
11 changes: 11 additions & 0 deletions
11
shaders-msl/frag/force-depth-write-false.input-attachment-is-ds-attachment.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,11 @@ | ||
#version 450 | ||
|
||
layout (input_attachment_index = 0, binding = 0) uniform subpassInput inputDepth; | ||
|
||
layout (location = 0) out vec4 color; | ||
|
||
void main() | ||
{ | ||
color = subpassLoad(inputDepth); | ||
gl_FragDepth = 1.0f; | ||
} |
10 changes: 10 additions & 0 deletions
10
shaders-msl/frag/force-depth-write.input-attachment-is-ds-attachment.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,10 @@ | ||
#version 450 | ||
|
||
layout (input_attachment_index = 0, binding = 0) uniform subpassInput inputDepth; | ||
|
||
layout (location = 0) out vec4 color; | ||
|
||
void main() | ||
{ | ||
color = subpassLoad(inputDepth); | ||
} |
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
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
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