SPV: PrimitiveId in frag shader will emit Geometry capability

Using PrimitiveId in a fragment shader requires declaring
an OpCapability with either Geometry or Tessellation.
This commit is contained in:
Maciej Jesionowski
2016-09-26 16:49:09 +02:00
parent 5fc501ff07
commit 04b3e8746f
3 changed files with 21 additions and 3 deletions

View File

@@ -499,11 +499,17 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex;
case glslang::EbvBaseVertex:
case glslang::EbvBaseInstance:
case glslang::EbvDrawId:
// TODO: Add SPIR-V builtin ID.
logger->missingFunctionality("shader draw parameters");
return spv::BuiltInMax;
case glslang::EbvPrimitiveId: return spv::BuiltInPrimitiveId;
case glslang::EbvPrimitiveId:
if (glslangIntermediate->getStage() == EShLangFragment)
builder.addCapability(spv::CapabilityGeometry);
return spv::BuiltInPrimitiveId;
case glslang::EbvInvocationId: return spv::BuiltInInvocationId;
case glslang::EbvTessLevelInner: return spv::BuiltInTessLevelInner;
case glslang::EbvTessLevelOuter: return spv::BuiltInTessLevelOuter;