diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 66ea41a38..c23aa9218 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -479,7 +479,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI return spv::BuiltInSamplePosition; case glslang::EbvSampleMask: - builder.addCapability(spv::CapabilitySampleRateShading); return spv::BuiltInSampleMask; case glslang::EbvLayer: diff --git a/Test/baseResults/hlsl.inoutquals.frag.out b/Test/baseResults/hlsl.inoutquals.frag.out index c589f5b1d..f02ba6dee 100644 --- a/Test/baseResults/hlsl.inoutquals.frag.out +++ b/Test/baseResults/hlsl.inoutquals.frag.out @@ -210,7 +210,6 @@ gl_FragCoord origin is upper left // Id's are bound by 88 Capability Shader - Capability SampleRateShading 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 68 78 82 86 diff --git a/Test/baseResults/spv.arbPostDepthCoverage.frag.out b/Test/baseResults/spv.arbPostDepthCoverage.frag.out index 7c5a3b667..b7ac2b669 100644 --- a/Test/baseResults/spv.arbPostDepthCoverage.frag.out +++ b/Test/baseResults/spv.arbPostDepthCoverage.frag.out @@ -4,7 +4,6 @@ spv.arbPostDepthCoverage.frag // Id's are bound by 18 Capability Shader - Capability SampleRateShading Capability SampleMaskPostDepthCoverage Extension "SPV_KHR_post_depth_coverage" 1: ExtInstImport "GLSL.std.450" diff --git a/Test/baseResults/spv.sample.frag.out b/Test/baseResults/spv.sample.frag.out new file mode 100755 index 000000000..166ce943d --- /dev/null +++ b/Test/baseResults/spv.sample.frag.out @@ -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 diff --git a/Test/baseResults/spv.sampleId.frag.out b/Test/baseResults/spv.sampleId.frag.out new file mode 100755 index 000000000..11ade8779 --- /dev/null +++ b/Test/baseResults/spv.sampleId.frag.out @@ -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 diff --git a/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out b/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out index 3a974fb49..848b4a048 100644 --- a/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out +++ b/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out @@ -4,7 +4,6 @@ spv.sampleMaskOverrideCoverage.frag // Id's are bound by 20 Capability Shader - Capability SampleRateShading Extension "SPV_NV_sample_mask_override_coverage" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/Test/baseResults/spv.samplePosition.frag.out b/Test/baseResults/spv.samplePosition.frag.out new file mode 100755 index 000000000..5f4a0b93e --- /dev/null +++ b/Test/baseResults/spv.samplePosition.frag.out @@ -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 diff --git a/Test/spv.sample.frag b/Test/spv.sample.frag new file mode 100644 index 000000000..b62afe279 --- /dev/null +++ b/Test/spv.sample.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) in sample vec4 samp; +layout(location = 0) out vec4 color; + +void main() +{ + color = samp; +} \ No newline at end of file diff --git a/Test/spv.sampleId.frag b/Test/spv.sampleId.frag new file mode 100644 index 000000000..d5473f79a --- /dev/null +++ b/Test/spv.sampleId.frag @@ -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; +} \ No newline at end of file diff --git a/Test/spv.samplePosition.frag b/Test/spv.samplePosition.frag new file mode 100644 index 000000000..b73dd61fa --- /dev/null +++ b/Test/spv.samplePosition.frag @@ -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; +} \ No newline at end of file diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 9e1f068a5..4a396273d 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -280,6 +280,9 @@ INSTANTIATE_TEST_CASE_P( "spv.precisionNonESSamp.frag", "spv.prepost.frag", "spv.qualifiers.vert", + "spv.sample.frag", + "spv.sampleId.frag", + "spv.samplePosition.frag", "spv.sampleMaskOverrideCoverage.frag", "spv.shaderBallot.comp", "spv.shaderDrawParams.vert",