summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2021-06-29 05:44:03 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:40 +0200
commit2e5af95541adf581364ee3864be57f9b2b9a230f (patch)
tree939e3d203ecc1ea98fae168745004c28cdb9b007
parentshader: Account for 33-bit IADD3 scenario (diff)
downloadyuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.tar
yuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.tar.gz
yuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.tar.bz2
yuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.tar.lz
yuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.tar.xz
yuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.tar.zst
yuzu-2e5af95541adf581364ee3864be57f9b2b9a230f.zip
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.h8
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp2
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.h6
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp4
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp5
-rw-r--r--src/shader_recompiler/exception.h8
-rw-r--r--src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp2
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:
template <typename... Args>
void Add(const char* format_str, IR::Inst& inst, Args&&... args) {
- code += fmt::format(format_str, reg_alloc.Define(inst), std::forward<Args>(args)...);
+ code += fmt::format(fmt::runtime(format_str), reg_alloc.Define(inst),
+ std::forward<Args>(args)...);
// TODO: Remove this
code += '\n';
}
template <typename... Args>
void LongAdd(const char* format_str, IR::Inst& inst, Args&&... args) {
- code += fmt::format(format_str, reg_alloc.LongDefine(inst), std::forward<Args>(args)...);
+ code += fmt::format(fmt::runtime(format_str), reg_alloc.LongDefine(inst),
+ std::forward<Args>(args)...);
// TODO: Remove this
code += '\n';
}
template <typename... Args>
void Add(const char* format_str, Args&&... args) {
- code += fmt::format(format_str, std::forward<Args>(args)...);
+ code += fmt::format(fmt::runtime(format_str), std::forward<Args>(args)...);
// TODO: Remove this
code += '\n';
}
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() {
func += comparison;
const auto ssbo_name{fmt::format("{}_ssbo{}", stage_name, index)};
- func += fmt::format(return_statement, ssbo_name, ssbo_addr);
+ func += fmt::format(fmt::runtime(return_statement), ssbo_name, ssbo_addr);
}};
std::string write_func{"void WriteGlobal32(uint64_t addr,uint data){"};
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:
const auto var_def{var_alloc.AddDefine(inst, type)};
if (var_def.empty()) {
// skip assigment.
- code += fmt::format(format_str + 3, std::forward<Args>(args)...);
+ code += fmt::format(fmt::runtime(format_str + 3), std::forward<Args>(args)...);
} else {
- code += fmt::format(format_str, var_def, std::forward<Args>(args)...);
+ code += fmt::format(fmt::runtime(format_str), var_def, std::forward<Args>(args)...);
}
// TODO: Remove this
code += '\n';
@@ -131,7 +131,7 @@ public:
template <typename... Args>
void Add(const char* format_str, Args&&... args) {
- code += fmt::format(format_str, std::forward<Args>(args)...);
+ code += fmt::format(fmt::runtime(format_str), std::forward<Args>(args)...);
// TODO: Remove this
code += '\n';
}
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,
: fmt ::format("bitfieldExtract({},int({}),{})", cbuf_cast,
bit_offset, num_bits)};
if (!component_indexing_bug) {
- const auto result{fmt::format(extraction, swizzle)};
+ const auto result{fmt::format(fmt::runtime(extraction), swizzle)};
ctx.Add("{}={};", ret, result);
return;
}
const auto cbuf_offset{fmt::format("{}>>2", offset_var)};
for (u32 i = 0; i < 4; ++i) {
const auto swizzle_string{fmt::format(".{}", "xyzw"[i])};
- const auto result{fmt::format(extraction, swizzle_string)};
+ const auto result{fmt::format(fmt::runtime(extraction), swizzle_string)};
ctx.Add("if(({}&3)=={}){}={};", cbuf_offset, i, ret, result);
}
}
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) {
template <typename... Args>
void Name(EmitContext& ctx, Id object, std::string_view format_str, Args&&... args) {
- ctx.Name(object,
- fmt::format(format_str, StageName(ctx.stage), std::forward<Args>(args)...).c_str());
+ ctx.Name(object, fmt::format(fmt::runtime(format_str), StageName(ctx.stage),
+ std::forward<Args>(args)...)
+ .c_str());
}
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 {
public:
template <typename... Args>
LogicError(const char* message, Args&&... args)
- : Exception{fmt::format(message, std::forward<Args>(args)...)} {}
+ : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
};
class RuntimeError : public Exception {
public:
template <typename... Args>
RuntimeError(const char* message, Args&&... args)
- : Exception{fmt::format(message, std::forward<Args>(args)...)} {}
+ : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
};
class NotImplementedException : public Exception {
public:
template <typename... Args>
NotImplementedException(const char* message, Args&&... args)
- : Exception{fmt::format(message, std::forward<Args>(args)...)} {
+ : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {
Append(" is not implemented");
}
};
@@ -60,7 +60,7 @@ class InvalidArgument : public Exception {
public:
template <typename... Args>
InvalidArgument(const char* message, Args&&... args)
- : Exception{fmt::format(message, std::forward<Args>(args)...)} {}
+ : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {}
};
} // 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) {
switch (stmt->type) {
case StatementType::Code:
ret += fmt::format("{} Block {:04x} -> {:04x} (0x{:016x});\n", indent,
- stmt->block->begin, stmt->block->end,
+ stmt->block->begin.Offset(), stmt->block->end.Offset(),
reinterpret_cast<uintptr_t>(stmt->block));
break;
case StatementType::Goto: