SPV: Fix unexpected declarations of capability and extension

This commit is contained in:
Rex Xu 2017-03-16 23:02:39 +08:00
Родитель 36b218de91
Коммит 5e317ffe40
3 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -480,16 +480,18 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInCullDistance;
case glslang::EbvViewportIndex:
if (!memberDeclaration) {
builder.addCapability(spv::CapabilityMultiViewport);
#ifdef NV_EXTENSIONS
if (glslangIntermediate->getStage() == EShLangVertex ||
glslangIntermediate->getStage() == EShLangTessControl ||
glslangIntermediate->getStage() == EShLangTessEvaluation)
{
glslangIntermediate->getStage() == EShLangTessEvaluation) {
builder.addExtension(spv::E_SPV_NV_viewport_array2);
builder.addCapability(spv::CapabilityShaderViewportIndexLayerNV);
}
#endif
}
return spv::BuiltInViewportIndex;
case glslang::EbvSampleId:
@ -505,19 +507,19 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInSampleMask;
case glslang::EbvLayer:
if (!memberDeclaration) {
builder.addCapability(spv::CapabilityGeometry);
#ifdef NV_EXTENSIONS
if (!memberDeclaration)
{
if (glslangIntermediate->getStage() == EShLangVertex ||
glslangIntermediate->getStage() == EShLangTessControl ||
glslangIntermediate->getStage() == EShLangTessEvaluation)
{
glslangIntermediate->getStage() == EShLangTessEvaluation) {
builder.addExtension(spv::E_SPV_NV_viewport_array2);
builder.addCapability(spv::CapabilityShaderViewportIndexLayerNV);
}
}
#endif
}
return spv::BuiltInLayer;
case glslang::EbvPosition: return spv::BuiltInPosition;
@ -640,8 +642,10 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
#ifdef NV_EXTENSIONS
case glslang::EbvViewportMaskNV:
if (!memberDeclaration) {
builder.addExtension(spv::E_SPV_NV_viewport_array2);
builder.addCapability(spv::CapabilityShaderViewportMaskNV);
}
return spv::BuiltInViewportMaskNV;
case glslang::EbvSecondaryPositionNV:
if (!memberDeclaration) {
@ -2690,6 +2694,7 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
case glslang::EbvPointSize:
#ifdef NV_EXTENSIONS
case glslang::EbvLayer:
case glslang::EbvViewportIndex:
case glslang::EbvViewportMaskNV:
case glslang::EbvSecondaryPositionNV:
case glslang::EbvSecondaryViewportMaskNV:

Просмотреть файл

@ -5,7 +5,6 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Generated by (magic number): 80001
// Id's are bound by 39
Capability Geometry
Capability Tessellation
Capability ShaderViewportMaskNV
Capability ShaderStereoViewNV

Просмотреть файл

@ -5,7 +5,6 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Generated by (magic number): 80001
// Id's are bound by 25
Capability Geometry
Capability Tessellation
Capability MultiViewport
Capability ShaderViewportIndexLayerNV