Merge pull request #1899 from billhollings/forward-volatile-vars-except-builtins

Allow volatile vars that are not builtins to be forwarded.
This commit is contained in:
Hans-Kristian Arntzen 2022-03-23 22:07:10 +01:00 committed by GitHub
commit 44691aa975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9600,8 +9600,8 @@ bool CompilerGLSL::should_forward(uint32_t id) const
auto *var = maybe_get<SPIRVariable>(id);
if (var)
{
// Never forward volatile variables, e.g. SPIR-V 1.6 IsHelperInvocation.
return !has_decoration(id, DecorationVolatile);
// Never forward volatile builtin variables, e.g. SPIR-V 1.6 HelperInvocation.
return !(has_decoration(id, DecorationBuiltIn) && has_decoration(id, DecorationVolatile));
}
// For debugging emit temporary variables for all expressions
@ -9615,9 +9615,11 @@ bool CompilerGLSL::should_forward(uint32_t id) const
if (expr && expr->expression_dependencies.size() >= max_expression_dependencies)
return false;
if (expr && expr->loaded_from && has_decoration(expr->loaded_from, DecorationVolatile))
if (expr && expr->loaded_from
&& has_decoration(expr->loaded_from, DecorationBuiltIn)
&& has_decoration(expr->loaded_from, DecorationVolatile))
{
// Never forward volatile variables.
// Never forward volatile builtin variables, e.g. SPIR-V 1.6 HelperInvocation.
return false;
}