mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-12 21:20:06 +00:00
SPV: SampleMask does not depend on SampleRateShading.
Fixes #1158. Fixes #1159.
This commit is contained in:
parent
e2c15b4f6e
commit
cbdf871d7f
@ -479,7 +479,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
|||||||
return spv::BuiltInSamplePosition;
|
return spv::BuiltInSamplePosition;
|
||||||
|
|
||||||
case glslang::EbvSampleMask:
|
case glslang::EbvSampleMask:
|
||||||
builder.addCapability(spv::CapabilitySampleRateShading);
|
|
||||||
return spv::BuiltInSampleMask;
|
return spv::BuiltInSampleMask;
|
||||||
|
|
||||||
case glslang::EbvLayer:
|
case glslang::EbvLayer:
|
||||||
|
@ -210,7 +210,6 @@ gl_FragCoord origin is upper left
|
|||||||
// Id's are bound by 88
|
// Id's are bound by 88
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability SampleRateShading
|
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 68 78 82 86
|
EntryPoint Fragment 4 "main" 68 78 82 86
|
||||||
|
@ -4,7 +4,6 @@ spv.arbPostDepthCoverage.frag
|
|||||||
// Id's are bound by 18
|
// Id's are bound by 18
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability SampleRateShading
|
|
||||||
Capability SampleMaskPostDepthCoverage
|
Capability SampleMaskPostDepthCoverage
|
||||||
Extension "SPV_KHR_post_depth_coverage"
|
Extension "SPV_KHR_post_depth_coverage"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
32
Test/baseResults/spv.sample.frag.out
Executable file
32
Test/baseResults/spv.sample.frag.out
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
spv.sample.frag
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80002
|
||||||
|
// Id's are bound by 13
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
Capability SampleRateShading
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Fragment 4 "main" 9 11
|
||||||
|
ExecutionMode 4 OriginUpperLeft
|
||||||
|
Source GLSL 450
|
||||||
|
Name 4 "main"
|
||||||
|
Name 9 "color"
|
||||||
|
Name 11 "samp"
|
||||||
|
Decorate 9(color) Location 0
|
||||||
|
Decorate 11(samp) Sample
|
||||||
|
Decorate 11(samp) Location 0
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeFloat 32
|
||||||
|
7: TypeVector 6(float) 4
|
||||||
|
8: TypePointer Output 7(fvec4)
|
||||||
|
9(color): 8(ptr) Variable Output
|
||||||
|
10: TypePointer Input 7(fvec4)
|
||||||
|
11(samp): 10(ptr) Variable Input
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
12: 7(fvec4) Load 11(samp)
|
||||||
|
Store 9(color) 12
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
52
Test/baseResults/spv.sampleId.frag.out
Executable file
52
Test/baseResults/spv.sampleId.frag.out
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
spv.sampleId.frag
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80002
|
||||||
|
// Id's are bound by 26
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
Capability SampleRateShading
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Fragment 4 "main" 8 18 20
|
||||||
|
ExecutionMode 4 OriginUpperLeft
|
||||||
|
Source GLSL 450
|
||||||
|
Name 4 "main"
|
||||||
|
Name 8 "gl_SampleID"
|
||||||
|
Name 18 "color"
|
||||||
|
Name 20 "samp"
|
||||||
|
Decorate 8(gl_SampleID) Flat
|
||||||
|
Decorate 8(gl_SampleID) BuiltIn SampleId
|
||||||
|
Decorate 18(color) Location 0
|
||||||
|
Decorate 20(samp) Location 0
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeInt 32 1
|
||||||
|
7: TypePointer Input 6(int)
|
||||||
|
8(gl_SampleID): 7(ptr) Variable Input
|
||||||
|
10: 6(int) Constant 3
|
||||||
|
11: TypeBool
|
||||||
|
15: TypeFloat 32
|
||||||
|
16: TypeVector 15(float) 4
|
||||||
|
17: TypePointer Output 16(fvec4)
|
||||||
|
18(color): 17(ptr) Variable Output
|
||||||
|
19: TypePointer Input 16(fvec4)
|
||||||
|
20(samp): 19(ptr) Variable Input
|
||||||
|
23: 15(float) Constant 1073741824
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
9: 6(int) Load 8(gl_SampleID)
|
||||||
|
12: 11(bool) SLessThan 9 10
|
||||||
|
SelectionMerge 14 None
|
||||||
|
BranchConditional 12 13 22
|
||||||
|
13: Label
|
||||||
|
21: 16(fvec4) Load 20(samp)
|
||||||
|
Store 18(color) 21
|
||||||
|
Branch 14
|
||||||
|
22: Label
|
||||||
|
24: 16(fvec4) Load 20(samp)
|
||||||
|
25: 16(fvec4) VectorTimesScalar 24 23
|
||||||
|
Store 18(color) 25
|
||||||
|
Branch 14
|
||||||
|
14: Label
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
@ -4,7 +4,6 @@ spv.sampleMaskOverrideCoverage.frag
|
|||||||
// Id's are bound by 20
|
// Id's are bound by 20
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability SampleRateShading
|
|
||||||
Extension "SPV_NV_sample_mask_override_coverage"
|
Extension "SPV_NV_sample_mask_override_coverage"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
|
55
Test/baseResults/spv.samplePosition.frag.out
Executable file
55
Test/baseResults/spv.samplePosition.frag.out
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
spv.samplePosition.frag
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80002
|
||||||
|
// Id's are bound by 30
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
Capability SampleRateShading
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Fragment 4 "main" 9 22 24
|
||||||
|
ExecutionMode 4 OriginUpperLeft
|
||||||
|
Source GLSL 450
|
||||||
|
Name 4 "main"
|
||||||
|
Name 9 "gl_SamplePosition"
|
||||||
|
Name 22 "color"
|
||||||
|
Name 24 "samp"
|
||||||
|
Decorate 9(gl_SamplePosition) BuiltIn SamplePosition
|
||||||
|
Decorate 22(color) Location 0
|
||||||
|
Decorate 24(samp) Location 0
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeFloat 32
|
||||||
|
7: TypeVector 6(float) 2
|
||||||
|
8: TypePointer Input 7(fvec2)
|
||||||
|
9(gl_SamplePosition): 8(ptr) Variable Input
|
||||||
|
10: TypeInt 32 0
|
||||||
|
11: 10(int) Constant 1
|
||||||
|
12: TypePointer Input 6(float)
|
||||||
|
15: 6(float) Constant 1056964608
|
||||||
|
16: TypeBool
|
||||||
|
20: TypeVector 6(float) 4
|
||||||
|
21: TypePointer Output 20(fvec4)
|
||||||
|
22(color): 21(ptr) Variable Output
|
||||||
|
23: TypePointer Input 20(fvec4)
|
||||||
|
24(samp): 23(ptr) Variable Input
|
||||||
|
27: 6(float) Constant 1073741824
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
13: 12(ptr) AccessChain 9(gl_SamplePosition) 11
|
||||||
|
14: 6(float) Load 13
|
||||||
|
17: 16(bool) FOrdLessThan 14 15
|
||||||
|
SelectionMerge 19 None
|
||||||
|
BranchConditional 17 18 26
|
||||||
|
18: Label
|
||||||
|
25: 20(fvec4) Load 24(samp)
|
||||||
|
Store 22(color) 25
|
||||||
|
Branch 19
|
||||||
|
26: Label
|
||||||
|
28: 20(fvec4) Load 24(samp)
|
||||||
|
29: 20(fvec4) VectorTimesScalar 28 27
|
||||||
|
Store 22(color) 29
|
||||||
|
Branch 19
|
||||||
|
19: Label
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
9
Test/spv.sample.frag
Normal file
9
Test/spv.sample.frag
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(location = 0) in sample vec4 samp;
|
||||||
|
layout(location = 0) out vec4 color;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
color = samp;
|
||||||
|
}
|
12
Test/spv.sampleId.frag
Normal file
12
Test/spv.sampleId.frag
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(location = 0) in vec4 samp;
|
||||||
|
layout(location = 0) out vec4 color;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
if (gl_SampleID < 3)
|
||||||
|
color = samp;
|
||||||
|
else
|
||||||
|
color = 2 * samp;
|
||||||
|
}
|
12
Test/spv.samplePosition.frag
Normal file
12
Test/spv.samplePosition.frag
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(location = 0) in vec4 samp;
|
||||||
|
layout(location = 0) out vec4 color;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
if (gl_SamplePosition.y < 0.5)
|
||||||
|
color = samp;
|
||||||
|
else
|
||||||
|
color = 2 * samp;
|
||||||
|
}
|
@ -280,6 +280,9 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
"spv.precisionNonESSamp.frag",
|
"spv.precisionNonESSamp.frag",
|
||||||
"spv.prepost.frag",
|
"spv.prepost.frag",
|
||||||
"spv.qualifiers.vert",
|
"spv.qualifiers.vert",
|
||||||
|
"spv.sample.frag",
|
||||||
|
"spv.sampleId.frag",
|
||||||
|
"spv.samplePosition.frag",
|
||||||
"spv.sampleMaskOverrideCoverage.frag",
|
"spv.sampleMaskOverrideCoverage.frag",
|
||||||
"spv.shaderBallot.comp",
|
"spv.shaderBallot.comp",
|
||||||
"spv.shaderDrawParams.vert",
|
"spv.shaderDrawParams.vert",
|
||||||
|
Loading…
Reference in New Issue
Block a user