summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-10-05 08:53:26 +0200
committerGitHub <noreply@github.com>2022-10-05 08:53:26 +0200
commit4774e32593f1aa8140a01b9ee4dada9074004356 (patch)
tree3d075af03864a23f6e266102e26b88690eafa7c2 /src/shader_recompiler
parentMerge pull request #9005 from liamwhite/micro-fit (diff)
parentshader_recompiler: add extended LDC to GLASM backend (diff)
downloadyuzu-4774e32593f1aa8140a01b9ee4dada9074004356.tar
yuzu-4774e32593f1aa8140a01b9ee4dada9074004356.tar.gz
yuzu-4774e32593f1aa8140a01b9ee4dada9074004356.tar.bz2
yuzu-4774e32593f1aa8140a01b9ee4dada9074004356.tar.lz
yuzu-4774e32593f1aa8140a01b9ee4dada9074004356.tar.xz
yuzu-4774e32593f1aa8140a01b9ee4dada9074004356.tar.zst
yuzu-4774e32593f1aa8140a01b9ee4dada9074004356.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
index b5c08d611..7e8f37563 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
@@ -13,9 +13,6 @@ namespace Shader::Backend::GLASM {
namespace {
void GetCbuf(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset,
std::string_view size) {
- if (!binding.IsImmediate()) {
- throw NotImplementedException("Indirect constant buffer loading");
- }
const Register ret{ctx.reg_alloc.Define(inst)};
if (offset.type == Type::U32) {
// Avoid reading arrays out of bounds, matching hardware's behavior
@@ -24,7 +21,27 @@ void GetCbuf(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU
return;
}
}
- ctx.Add("LDC.{} {},c{}[{}];", size, ret, binding.U32(), offset);
+
+ if (binding.IsImmediate()) {
+ ctx.Add("LDC.{} {},c{}[{}];", size, ret, binding.U32(), offset);
+ return;
+ }
+
+ const ScalarU32 idx{ctx.reg_alloc.Consume(binding)};
+ for (u32 i = 0; i < Info::MAX_INDIRECT_CBUFS; i++) {
+ ctx.Add("SEQ.S.CC RC.x,{},{};"
+ "IF NE.x;"
+ "LDC.{} {},c{}[{}];",
+ idx, i, size, ret, i, offset);
+
+ if (i != Info::MAX_INDIRECT_CBUFS - 1) {
+ ctx.Add("ELSE;");
+ }
+ }
+
+ for (u32 i = 0; i < Info::MAX_INDIRECT_CBUFS; i++) {
+ ctx.Add("ENDIF;");
+ }
}
bool IsInputArray(Stage stage) {