diff options
Diffstat (limited to 'src')
7 files changed, 19 insertions, 16 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.h b/src/shader_recompiler/backend/glasm/emit_context.h index 9f86e55d3..1da51a996 100644 --- a/src/shader_recompiler/backend/glasm/emit_context.h +++ b/src/shader_recompiler/backend/glasm/emit_context.h | |||
| @@ -37,21 +37,23 @@ public: | |||
| 37 | 37 | ||
| 38 | template <typename... Args> | 38 | template <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, reg_alloc.Define(inst), std::forward<Args>(args)...); | 40 | code += fmt::format(fmt::runtime(format_str), reg_alloc.Define(inst), |
| 41 | std::forward<Args>(args)...); | ||
| 41 | // TODO: Remove this | 42 | // TODO: Remove this |
| 42 | code += '\n'; | 43 | code += '\n'; |
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | template <typename... Args> | 46 | template <typename... Args> |
| 46 | void LongAdd(const char* format_str, IR::Inst& inst, Args&&... args) { | 47 | void LongAdd(const char* format_str, IR::Inst& inst, Args&&... args) { |
| 47 | code += fmt::format(format_str, reg_alloc.LongDefine(inst), std::forward<Args>(args)...); | 48 | code += fmt::format(fmt::runtime(format_str), reg_alloc.LongDefine(inst), |
| 49 | std::forward<Args>(args)...); | ||
| 48 | // TODO: Remove this | 50 | // TODO: Remove this |
| 49 | code += '\n'; | 51 | code += '\n'; |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | template <typename... Args> | 54 | template <typename... Args> |
| 53 | void Add(const char* format_str, Args&&... args) { | 55 | void Add(const char* format_str, Args&&... args) { |
| 54 | code += fmt::format(format_str, std::forward<Args>(args)...); | 56 | code += fmt::format(fmt::runtime(format_str), std::forward<Args>(args)...); |
| 55 | // TODO: Remove this | 57 | // TODO: Remove this |
| 56 | code += '\n'; | 58 | code += '\n'; |
| 57 | } | 59 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 36527bbd4..0dcdff152 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -597,7 +597,7 @@ std::string EmitContext::DefineGlobalMemoryFunctions() { | |||
| 597 | func += comparison; | 597 | func += comparison; |
| 598 | 598 | ||
| 599 | const auto ssbo_name{fmt::format("{}_ssbo{}", stage_name, index)}; | 599 | const auto ssbo_name{fmt::format("{}_ssbo{}", stage_name, index)}; |
| 600 | func += fmt::format(return_statement, ssbo_name, ssbo_addr); | 600 | func += fmt::format(fmt::runtime(return_statement), ssbo_name, ssbo_addr); |
| 601 | }}; | 601 | }}; |
| 602 | std::string write_func{"void WriteGlobal32(uint64_t addr,uint data){"}; | 602 | std::string write_func{"void WriteGlobal32(uint64_t addr,uint data){"}; |
| 603 | std::string write_func_64{"void WriteGlobal64(uint64_t addr,uvec2 data){"}; | 603 | std::string write_func_64{"void WriteGlobal64(uint64_t addr,uvec2 data){"}; |
diff --git a/src/shader_recompiler/backend/glsl/emit_context.h b/src/shader_recompiler/backend/glsl/emit_context.h index dd7397489..d9b639d29 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.h +++ b/src/shader_recompiler/backend/glsl/emit_context.h | |||
| @@ -51,9 +51,9 @@ public: | |||
| 51 | const auto var_def{var_alloc.AddDefine(inst, type)}; | 51 | const auto var_def{var_alloc.AddDefine(inst, type)}; |
| 52 | if (var_def.empty()) { | 52 | if (var_def.empty()) { |
| 53 | // skip assigment. | 53 | // skip assigment. |
| 54 | code += fmt::format(format_str + 3, std::forward<Args>(args)...); | 54 | code += fmt::format(fmt::runtime(format_str + 3), std::forward<Args>(args)...); |
| 55 | } else { | 55 | } else { |
| 56 | code += fmt::format(format_str, var_def, std::forward<Args>(args)...); | 56 | code += fmt::format(fmt::runtime(format_str), var_def, std::forward<Args>(args)...); |
| 57 | } | 57 | } |
| 58 | // TODO: Remove this | 58 | // TODO: Remove this |
| 59 | code += '\n'; | 59 | code += '\n'; |
| @@ -131,7 +131,7 @@ public: | |||
| 131 | 131 | ||
| 132 | template <typename... Args> | 132 | template <typename... Args> |
| 133 | void Add(const char* format_str, Args&&... args) { | 133 | void Add(const char* format_str, Args&&... args) { |
| 134 | code += fmt::format(format_str, std::forward<Args>(args)...); | 134 | code += fmt::format(fmt::runtime(format_str), std::forward<Args>(args)...); |
| 135 | // TODO: Remove this | 135 | // TODO: Remove this |
| 136 | code += '\n'; | 136 | code += '\n'; |
| 137 | } | 137 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index d5424301b..580063fa9 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | |||
| @@ -61,14 +61,14 @@ void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding, | |||
| 61 | : fmt ::format("bitfieldExtract({},int({}),{})", cbuf_cast, | 61 | : fmt ::format("bitfieldExtract({},int({}),{})", cbuf_cast, |
| 62 | bit_offset, num_bits)}; | 62 | bit_offset, num_bits)}; |
| 63 | if (!component_indexing_bug) { | 63 | if (!component_indexing_bug) { |
| 64 | const auto result{fmt::format(extraction, swizzle)}; | 64 | const auto result{fmt::format(fmt::runtime(extraction), swizzle)}; |
| 65 | ctx.Add("{}={};", ret, result); | 65 | ctx.Add("{}={};", ret, result); |
| 66 | return; | 66 | return; |
| 67 | } | 67 | } |
| 68 | const auto cbuf_offset{fmt::format("{}>>2", offset_var)}; | 68 | const auto cbuf_offset{fmt::format("{}>>2", offset_var)}; |
| 69 | for (u32 i = 0; i < 4; ++i) { | 69 | for (u32 i = 0; i < 4; ++i) { |
| 70 | const auto swizzle_string{fmt::format(".{}", "xyzw"[i])}; | 70 | const auto swizzle_string{fmt::format(".{}", "xyzw"[i])}; |
| 71 | const auto result{fmt::format(extraction, swizzle_string)}; | 71 | const auto result{fmt::format(fmt::runtime(extraction), swizzle_string)}; |
| 72 | ctx.Add("if(({}&3)=={}){}={};", cbuf_offset, i, ret, result); | 72 | ctx.Add("if(({}&3)=={}){}={};", cbuf_offset, i, ret, result); |
| 73 | } | 73 | } |
| 74 | } | 74 | } |
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 0926dcf14..865f34291 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -244,8 +244,9 @@ std::string_view StageName(Stage stage) { | |||
| 244 | 244 | ||
| 245 | template <typename... Args> | 245 | template <typename... Args> |
| 246 | void Name(EmitContext& ctx, Id object, std::string_view format_str, Args&&... args) { | 246 | void Name(EmitContext& ctx, Id object, std::string_view format_str, Args&&... args) { |
| 247 | ctx.Name(object, | 247 | ctx.Name(object, fmt::format(fmt::runtime(format_str), StageName(ctx.stage), |
| 248 | fmt::format(format_str, StageName(ctx.stage), std::forward<Args>(args)...).c_str()); | 248 | std::forward<Args>(args)...) |
| 249 | .c_str()); | ||
| 249 | } | 250 | } |
| 250 | 251 | ||
| 251 | void DefineConstBuffers(EmitContext& ctx, const Info& info, Id UniformDefinitions::*member_type, | 252 | void DefineConstBuffers(EmitContext& ctx, const Info& info, Id UniformDefinitions::*member_type, |
diff --git a/src/shader_recompiler/exception.h b/src/shader_recompiler/exception.h index 43f08162d..337e7f0c8 100644 --- a/src/shader_recompiler/exception.h +++ b/src/shader_recompiler/exception.h | |||
| @@ -37,21 +37,21 @@ class LogicError : public Exception { | |||
| 37 | public: | 37 | public: |
| 38 | template <typename... Args> | 38 | template <typename... Args> |
| 39 | LogicError(const char* message, Args&&... args) | 39 | LogicError(const char* message, Args&&... args) |
| 40 | : Exception{fmt::format(message, std::forward<Args>(args)...)} {} | 40 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | class RuntimeError : public Exception { | 43 | class RuntimeError : public Exception { |
| 44 | public: | 44 | public: |
| 45 | template <typename... Args> | 45 | template <typename... Args> |
| 46 | RuntimeError(const char* message, Args&&... args) | 46 | RuntimeError(const char* message, Args&&... args) |
| 47 | : Exception{fmt::format(message, std::forward<Args>(args)...)} {} | 47 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | class NotImplementedException : public Exception { | 50 | class NotImplementedException : public Exception { |
| 51 | public: | 51 | public: |
| 52 | template <typename... Args> | 52 | template <typename... Args> |
| 53 | NotImplementedException(const char* message, Args&&... args) | 53 | NotImplementedException(const char* message, Args&&... args) |
| 54 | : Exception{fmt::format(message, std::forward<Args>(args)...)} { | 54 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} { |
| 55 | Append(" is not implemented"); | 55 | Append(" is not implemented"); |
| 56 | } | 56 | } |
| 57 | }; | 57 | }; |
| @@ -60,7 +60,7 @@ class InvalidArgument : public Exception { | |||
| 60 | public: | 60 | public: |
| 61 | template <typename... Args> | 61 | template <typename... Args> |
| 62 | InvalidArgument(const char* message, Args&&... args) | 62 | InvalidArgument(const char* message, Args&&... args) |
| 63 | : Exception{fmt::format(message, std::forward<Args>(args)...)} {} | 63 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | } // namespace Shader | 66 | } // namespace Shader |
diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp index 10d05dc4c..06fde0017 100644 --- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp | |||
| @@ -174,7 +174,7 @@ std::string DumpTree(const Tree& tree, u32 indentation = 0) { | |||
| 174 | switch (stmt->type) { | 174 | switch (stmt->type) { |
| 175 | case StatementType::Code: | 175 | case StatementType::Code: |
| 176 | ret += fmt::format("{} Block {:04x} -> {:04x} (0x{:016x});\n", indent, | 176 | ret += fmt::format("{} Block {:04x} -> {:04x} (0x{:016x});\n", indent, |
| 177 | stmt->block->begin, stmt->block->end, | 177 | stmt->block->begin.Offset(), stmt->block->end.Offset(), |
| 178 | reinterpret_cast<uintptr_t>(stmt->block)); | 178 | reinterpret_cast<uintptr_t>(stmt->block)); |
| 179 | break; | 179 | break; |
| 180 | case StatementType::Goto: | 180 | case StatementType::Goto: |