diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-05-31 04:08:17 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:34 +0200 |
commit | 05d41fa9b70af6d469f2f6f1474436c9255e9bc3 (patch) | |
tree | 52bd8f8a6456c46fc9120aafa99b2d4a45b79746 /src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp | |
parent | shader: Implement ISCADD32I (diff) | |
download | yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.tar yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.tar.gz yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.tar.bz2 yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.tar.lz yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.tar.xz yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.tar.zst yuzu-05d41fa9b70af6d469f2f6f1474436c9255e9bc3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp | 8 |
1 files changed, 8 insertions, 0 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 787612def..9ad668b86 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 @@ -18,6 +18,14 @@ void GetCbuf(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU 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 + const u32 imm_offset{offset.imm_u32}; + if (offset.imm_u32 >= 0x10'000) { + ctx.Add("MOV.S {},0;", ret); + return; + } + } ctx.Add("LDC.{} {},c{}[{}];", size, ret, binding.U32(), offset); } |