From: Mikko Rasa Date: Tue, 30 Nov 2021 21:46:59 +0000 (+0200) Subject: Tweaks and fixes to OpNames in SPIR-V X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6ef956d2f41512081e6c19d41a1230e177547dde;p=libs%2Fgl.git Tweaks and fixes to OpNames in SPIR-V Interface blocks without an instance name must not have a non-empty OpName or the reflection code gets confused. --- diff --git a/source/glsl/spirv.cpp b/source/glsl/spirv.cpp index 1f7d6a1b..e1ba981b 100644 --- a/source/glsl/spirv.cpp +++ b/source/glsl/spirv.cpp @@ -1512,7 +1512,7 @@ void SpirVGenerator::visit(StructDeclaration &strct) return; Id type_id = allocate_id(strct, 0); - writer.write_op_name(type_id, strct.name); + writer.write_op_name(type_id, (strct.block_name.empty() ? strct.name : strct.block_name)); if(!strct.block_name.empty()) writer.write_op_decorate(type_id, DECO_BLOCK); @@ -1670,7 +1670,8 @@ void SpirVGenerator::visit(VariableDeclaration &var) } } - writer.write_op_name(var_id, var.name); + if(var.name.find(' ')==string::npos) + writer.write_op_name(var_id, var.name); } void SpirVGenerator::visit_entry_point(FunctionDeclaration &func, Id func_id) @@ -1776,6 +1777,7 @@ void SpirVGenerator::visit(FunctionDeclaration &func) { Id param_id = allocate_id(*func.parameters[i], param_type_ids[i]); writer.write_op(content.functions, OP_FUNCTION_PARAMETER, param_type_ids[i], param_id); + writer.write_op_name(param_id, func.parameters[i]->name); // TODO This is probably incorrect if the parameter is assigned to. variable_load_ids[func.parameters[i].get()] = param_id; }