From dbd4c3ce11a6f08eb6cb893602b5ed7f179a300a Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Fri, 12 Jul 2019 14:33:02 -0700 Subject: [PATCH] spirv: Generate missing SampleMaskOverrideCoverageNV capability op The SampleMaskOverrideCoverageNV capability should be declared when gl_SampleMask is used. --- SPIRV/GlslangToSpv.cpp | 1 + SPIRV/disassemble.cpp | 1 + SPIRV/doc.cpp | 1 + Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 73a8f6a..fabaee9 100644 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -7738,6 +7738,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol decoration = (spv::Decoration)spv::DecorationMax; builder.addDecoration(id, decoration); if (decoration != spv::DecorationMax) { + builder.addCapability(spv::CapabilitySampleMaskOverrideCoverageNV); builder.addExtension(spv::E_SPV_NV_sample_mask_override_coverage); } } diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp index 3269f97..80ebac4 100644 --- a/SPIRV/disassemble.cpp +++ b/SPIRV/disassemble.cpp @@ -734,6 +734,7 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV"; case CapabilityMeshShadingNV: return "MeshShadingNV"; case CapabilityImageFootprintNV: return "ImageFootprintNV"; + case CapabilitySampleMaskOverrideCoverageNV:return "SampleMaskOverrideCoverageNV"; // NV Decorations case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index 85a3a2e..ffa2af8 100644 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -926,6 +926,7 @@ const char* CapabilityString(int info) case CapabilityMeshShadingNV: return "MeshShadingNV"; case CapabilityImageFootprintNV: return "ImageFootprintNV"; // case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT + case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; #endif case CapabilityFragmentDensityEXT: return "FragmentDensityEXT"; diff --git a/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out b/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out index 84b763b..3a9872e 100644 --- a/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out +++ b/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out @@ -1,10 +1,10 @@ spv.sampleMaskOverrideCoverage.frag -Validation failed // Module Version 10000 // Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader + Capability SampleMaskOverrideCoverageNV Extension "SPV_NV_sample_mask_override_coverage" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 -- 2.7.4