From e0da25b9c6b62f9cb00e8a6bb153f69842d80957 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 5 Oct 2022 05:37:01 +0200 Subject: [PATCH] early-access version 2990 --- README.md | 2 +- .../glasm/emit_glasm_context_get_set.cpp | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3b9f85c47..fb8bd7cf4 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2989. +This is the source code for early-access 2990. ## Legal Notice 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 100755 --- 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) {