@@ -15927,11 +15927,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
1592715927 auto called_func = maybe_get_called_function(instruction);
1592815928 if (called_func)
1592915929 {
15930- for (auto &par : called_func->arguments)
15931- {
15932- par.storage = StorageClassInput;
15933- par.force_const = true;
15934- }
15930+ called_func->used_as_lambda = true;
1593515931 }
1593615932 break;
1593715933 }
@@ -15976,11 +15972,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
1597615972 auto called_func = maybe_get_called_function(instruction);
1597715973 if (called_func)
1597815974 {
15979- for (auto &par : called_func->arguments)
15980- {
15981- par.storage = StorageClassInput;
15982- par.force_const = true;
15983- }
15975+ called_func->used_as_lambda = true;
1598415976 }
1598515977 break;
1598615978 }
@@ -16020,11 +16012,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
1602016012 auto called_func = maybe_get_called_function(instruction);
1602116013 if (called_func)
1602216014 {
16023- for (auto &par : called_func->arguments)
16024- {
16025- par.storage = StorageClassInput;
16026- par.force_const = true;
16027- }
16015+ called_func->used_as_lambda = true;
1602816016 }
1602916017
1603016018 register_read(id, ops[2], false);
@@ -16682,13 +16670,13 @@ string CompilerGLSL::to_qualifiers_glsl(uint32_t id)
1668216670 return res;
1668316671}
1668416672
16685- string CompilerGLSL::argument_decl(const SPIRFunction::Parameter &arg)
16673+ string CompilerGLSL::argument_decl(const SPIRFunction::Parameter &arg, bool is_lambda )
1668616674{
1668716675 // glslangValidator seems to make all arguments pointer no matter what which is rather bizarre ...
1668816676 auto &type = expression_type(arg.id);
1668916677 const char *direction = "";
16690- const char *constness = arg.force_const ? "const " : "";
16691- if (arg.storage == StorageClassInput)
16678+ const char *constness = is_lambda ? "const " : "";
16679+ if (is_lambda == StorageClassInput)
1669216680 {
1669316681 direction = "in ";
1669416682 }
@@ -17611,7 +17599,7 @@ void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
1761117599 // Since we want to make the GLSL debuggable and somewhat sane, use fallback names for variables which are duplicates.
1761217600 add_local_variable_name(arg.id);
1761317601
17614- arglist.push_back(argument_decl(arg));
17602+ arglist.push_back(argument_decl(arg, func.used_as_lambda ));
1761517603
1761617604 // Hold a pointer to the parameter so we can invalidate the readonly field if needed.
1761717605 auto *var = maybe_get<SPIRVariable>(arg.id);
@@ -17627,7 +17615,7 @@ void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
1762717615 // Since we want to make the GLSL debuggable and somewhat sane, use fallback names for variables which are duplicates.
1762817616 add_local_variable_name(arg.id);
1762917617
17630- arglist.push_back(argument_decl(arg));
17618+ arglist.push_back(argument_decl(arg, func.used_as_lambda ));
1763117619
1763217620 // Hold a pointer to the parameter so we can invalidate the readonly field if needed.
1763317621 auto *var = maybe_get<SPIRVariable>(arg.id);
0 commit comments