diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.h')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.h b/src/shader_recompiler/backend/glsl/emit_context.h index 2f1062954..423fc6104 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.h +++ b/src/shader_recompiler/backend/glsl/emit_context.h | |||
| @@ -37,7 +37,13 @@ public: | |||
| 37 | 37 | ||
| 38 | template <GlslVarType type, typename... Args> | 38 | template <GlslVarType type, typename... Args> |
| 39 | void Add(const char* format_str, IR::Inst& inst, Args&&... args) { | 39 | void Add(const char* format_str, IR::Inst& inst, Args&&... args) { |
| 40 | code += fmt::format(format_str, var_alloc.Define(inst, type), std::forward<Args>(args)...); | 40 | const auto var_def{var_alloc.AddDefine(inst, type)}; |
| 41 | if (var_def.empty()) { | ||
| 42 | // skip assigment. | ||
| 43 | code += fmt::format(&format_str[3], std::forward<Args>(args)...); | ||
| 44 | } else { | ||
| 45 | code += fmt::format(format_str, var_def, std::forward<Args>(args)...); | ||
| 46 | } | ||
| 41 | // TODO: Remove this | 47 | // TODO: Remove this |
| 42 | code += '\n'; | 48 | code += '\n'; |
| 43 | } | 49 | } |