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.
Merge pull request KhronosGroup#2220 from KhronosGroup/pr-2208
Land PR 2208 and fix more issues with sample mask
- Loading branch information
Showing
33 changed files
with
682 additions
and
80 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
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
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
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
26 changes: 26 additions & 0 deletions
26
reference/shaders-hlsl-no-opt/asm/frag/sample-mask-load-store-array-uint.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,26 @@ | ||
static uint gl_SampleMaskIn[1]; | ||
static uint gl_SampleMask[1]; | ||
struct SPIRV_Cross_Input | ||
{ | ||
uint gl_SampleMaskIn : SV_Coverage; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
uint gl_SampleMask : SV_Coverage; | ||
}; | ||
|
||
void frag_main() | ||
{ | ||
uint copy_sample_mask[1] = gl_SampleMaskIn; | ||
gl_SampleMask = copy_sample_mask; | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
gl_SampleMaskIn[0] = stage_input.gl_SampleMaskIn; | ||
frag_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.gl_SampleMask = gl_SampleMask[0]; | ||
return stage_output; | ||
} |
26 changes: 26 additions & 0 deletions
26
reference/shaders-hlsl-no-opt/asm/frag/sample-mask-load-store-array.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,26 @@ | ||
static int gl_SampleMaskIn[1]; | ||
static int gl_SampleMask[1]; | ||
struct SPIRV_Cross_Input | ||
{ | ||
uint gl_SampleMaskIn : SV_Coverage; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
uint gl_SampleMask : SV_Coverage; | ||
}; | ||
|
||
void frag_main() | ||
{ | ||
int copy_sample_mask[1] = gl_SampleMaskIn; | ||
gl_SampleMask = copy_sample_mask; | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
gl_SampleMaskIn[0] = stage_input.gl_SampleMaskIn; | ||
frag_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.gl_SampleMask = gl_SampleMask[0]; | ||
return stage_output; | ||
} |
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
59 changes: 59 additions & 0 deletions
59
reference/shaders-msl-no-opt/asm/frag/sample-mask-load-store-array-uint.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,59 @@ | ||
#pragma clang diagnostic ignored "-Wmissing-prototypes" | ||
#pragma clang diagnostic ignored "-Wmissing-braces" | ||
|
||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
template<typename T, size_t Num> | ||
struct spvUnsafeArray | ||
{ | ||
T elements[Num ? Num : 1]; | ||
|
||
thread T& operator [] (size_t pos) thread | ||
{ | ||
return elements[pos]; | ||
} | ||
constexpr const thread T& operator [] (size_t pos) const thread | ||
{ | ||
return elements[pos]; | ||
} | ||
|
||
device T& operator [] (size_t pos) device | ||
{ | ||
return elements[pos]; | ||
} | ||
constexpr const device T& operator [] (size_t pos) const device | ||
{ | ||
return elements[pos]; | ||
} | ||
|
||
constexpr const constant T& operator [] (size_t pos) const constant | ||
{ | ||
return elements[pos]; | ||
} | ||
|
||
threadgroup T& operator [] (size_t pos) threadgroup | ||
{ | ||
return elements[pos]; | ||
} | ||
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup | ||
{ | ||
return elements[pos]; | ||
} | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
uint gl_SampleMask [[sample_mask]]; | ||
}; | ||
|
||
fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask]]) | ||
{ | ||
main0_out out = {}; | ||
spvUnsafeArray<uint, 1> copy_sample_mask = spvUnsafeArray<uint, 1>({ uint(gl_SampleMaskIn) }); | ||
out.gl_SampleMask = copy_sample_mask[0]; | ||
return out; | ||
} | ||
|
Oops, something went wrong.