Support for CapabilityShaderViewportIndex and CapabilityShaderLayer (#2432)
* 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 * When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5 * Revert "When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5" This reverts commit dccca82f4076ea6e2bc01dd6d1e5d290c59fab20. * Using gl_Layer and gl_ViewportIndex outside of the geometry shader stage still requires one of the viewport extensions even when targeting SPIR-V 1.5 (Fixes a problem introduced by 670536b663f396815645b2f907f0ee92117b44f0)
This commit is contained in:
parent
ed8bd0453f
commit
56350cadfe
@ -714,9 +714,13 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
|||||||
glslangIntermediate->getStage() == EShLangTessControl ||
|
glslangIntermediate->getStage() == EShLangTessControl ||
|
||||||
glslangIntermediate->getStage() == EShLangTessEvaluation) {
|
glslangIntermediate->getStage() == EShLangTessEvaluation) {
|
||||||
|
|
||||||
|
if (builder.getSpvVersion() < spv::Spv_1_5) {
|
||||||
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
||||||
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
builder.addCapability(spv::CapabilityShaderViewportIndex);
|
||||||
|
}
|
||||||
return spv::BuiltInViewportIndex;
|
return spv::BuiltInViewportIndex;
|
||||||
|
|
||||||
case glslang::EbvSampleId:
|
case glslang::EbvSampleId:
|
||||||
@ -739,8 +743,11 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
|||||||
glslangIntermediate->getStage() == EShLangTessControl ||
|
glslangIntermediate->getStage() == EShLangTessControl ||
|
||||||
glslangIntermediate->getStage() == EShLangTessEvaluation) {
|
glslangIntermediate->getStage() == EShLangTessEvaluation) {
|
||||||
|
|
||||||
|
if (builder.getSpvVersion() < spv::Spv_1_5) {
|
||||||
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5);
|
||||||
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
||||||
|
} else
|
||||||
|
builder.addCapability(spv::CapabilityShaderLayer);
|
||||||
}
|
}
|
||||||
return spv::BuiltInLayer;
|
return spv::BuiltInLayer;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user