mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
When targeting SPIR-V 1.5, using gl_ViewportIndex will emit OpCapability ShaderViewportIndex and using gl_Layer will emit OpCapability CapabilityShaderLayer. OpCapability ShaderViewportIndexLayerEXT will only get emitted if the target < SPIR-V 1.5
This commit is contained in:
parent
3b334b2b8e
commit
670536b663
@ -714,8 +714,12 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
glslangIntermediate->getStage() == EShLangTessControl ||
|
||||
glslangIntermediate->getStage() == EShLangTessEvaluation) {
|
||||
|
||||
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
||||
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
||||
if (builder.getSpvVersion() < spv::Spv_1_5) {
|
||||
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
||||
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
||||
}
|
||||
else
|
||||
builder.addCapability(spv::CapabilityShaderViewportIndex);
|
||||
}
|
||||
return spv::BuiltInViewportIndex;
|
||||
|
||||
@ -739,8 +743,11 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
glslangIntermediate->getStage() == EShLangTessControl ||
|
||||
glslangIntermediate->getStage() == EShLangTessEvaluation) {
|
||||
|
||||
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
||||
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
||||
if (builder.getSpvVersion() < spv::Spv_1_5) {
|
||||
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
||||
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
||||
} else
|
||||
builder.addCapability(spv::CapabilityShaderLayer);
|
||||
}
|
||||
return spv::BuiltInLayer;
|
||||
|
||||
|
@ -7548,7 +7548,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
BuiltInVariable("gl_Layer", EbvLayer, symbolTable);
|
||||
BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable);
|
||||
|
||||
if (language != EShLangGeometry) {
|
||||
if (language != EShLangGeometry && spvVersion.spv < glslang::EShTargetSpv_1_5) {
|
||||
symbolTable.setVariableExtensions("gl_Layer", Num_viewportEXTs, viewportEXTs);
|
||||
symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user