Merge pull request #965 from chaoc/spv-khr-post-depth-coverage

Implement SPV_KHR_post_depth_coverage
This commit is contained in:
John Kessenich
2017-07-05 14:48:19 -06:00
committed by GitHub
20 changed files with 185 additions and 6 deletions

View File

@@ -0,0 +1,43 @@
spv.arbPostDepthCoverage.frag
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 18
Capability Shader
Capability SampleRateShading
Capability SampleMaskPostDepthCoverage
Extension "SPV_KHR_post_depth_coverage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 13
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 EarlyFragmentTests
ExecutionMode 4 PostDepthCoverage
Source GLSL 450
SourceExtension "GL_ARB_post_depth_coverage"
SourceExtension "GL_EXT_post_depth_coverage"
Name 4 "main"
Name 8 "readSampleMaskIn"
Name 13 "gl_SampleMaskIn"
Decorate 8(readSampleMaskIn) Location 0
Decorate 13(gl_SampleMaskIn) Flat
Decorate 13(gl_SampleMaskIn) BuiltIn SampleMask
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(readSampleMaskIn): 7(ptr) Variable Output
9: TypeInt 32 0
10: 9(int) Constant 1
11: TypeArray 6(int) 10
12: TypePointer Input 11
13(gl_SampleMaskIn): 12(ptr) Variable Input
14: 6(int) Constant 0
15: TypePointer Input 6(int)
4(main): 2 Function None 3
5: Label
16: 15(ptr) AccessChain 13(gl_SampleMaskIn) 14
17: 6(int) Load 16
Store 8(readSampleMaskIn) 17
Return
FunctionEnd

View File

@@ -0,0 +1,7 @@
spv.arbPostDepthCoverage_Error.frag
ERROR: 0:7: 'early_fragment_tests' : can only apply to a standalone qualifier
ERROR: 0:7: 'post_depth_coverage' : can only apply to a standalone qualifier
ERROR: 2 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View File

@@ -0,0 +1,23 @@
spv.extPostDepthCoverage.frag
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 6
Capability Shader
Capability SampleMaskPostDepthCoverage
Extension "SPV_KHR_post_depth_coverage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 EarlyFragmentTests
ExecutionMode 4 PostDepthCoverage
Source ESSL 310
SourceExtension "GL_EXT_post_depth_coverage"
Name 4 "main"
2: TypeVoid
3: TypeFunction 2
4(main): 2 Function None 3
5: Label
Return
FunctionEnd

View File

@@ -0,0 +1,4 @@
spv.extPostDepthCoverage_Error.frag
ERROR: Linking fragment stage: post_depth_coverage requires early_fragment_tests
SPIR-V is not generated for failed compile or link

View File

@@ -0,0 +1,13 @@
#version 450
#extension GL_ARB_post_depth_coverage : enable
#extension GL_EXT_post_depth_coverage : enable //according to ARB_post_depth_coverage,
//if both enabled, this one should be ignored
precision highp int;
layout(post_depth_coverage) in;
layout (location = 0) out int readSampleMaskIn;
void main () {
readSampleMaskIn = gl_SampleMaskIn[0];
}

View File

@@ -0,0 +1,12 @@
#version 310 es
#extension GL_ARB_post_depth_coverage : enable
precision highp float;
layout(post_depth_coverage, location = 0) in float a; // should fail since post_depth_coverage may only
// be declared on in only (not with variable declarations)
void main () {
}

View File

@@ -0,0 +1,9 @@
#version 310 es
#extension GL_EXT_post_depth_coverage : enable
layout(post_depth_coverage) in;
layout(early_fragment_tests) in;
void main () {
}

View File

@@ -0,0 +1,9 @@
#version 450
#extension GL_EXT_post_depth_coverage : enable
layout(post_depth_coverage) in; // should fail since for GL_EXT_post_depth_coverage
// explicit declaration of early_fragment_tests is required
void main () {
}