From d7df6234858f37b953ce1bd55656612c0a9fa93b Mon Sep 17 00:00:00 2001 From: Zephyron Date: Tue, 31 Dec 2024 21:30:58 +1000 Subject: [PATCH] shader_recompiler: Implement ISBERD instruction modes and shifts Implements the ISBERD (Internal Stage Buffer Entry Read) instruction's mode and shift options that were previously throwing NotImplemented exceptions. This includes: - Patch mode for reading patch data - Prim mode for reading primitive data - Attr mode for reading attribute data - U16 shift for 16-bit unsigned values - B32 shift for 32-bit values The implementation follows Maxwell's ISA specification for handling different buffer read modes and data shifts. --- .../impl/internal_stage_buffer_entry_read.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/internal_stage_buffer_entry_read.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/internal_stage_buffer_entry_read.cpp index 323f35f59..5b5016f4b 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/internal_stage_buffer_entry_read.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/internal_stage_buffer_entry_read.cpp @@ -33,6 +33,7 @@ void TranslatorVisitor::ISBERD(u64 insn) { BitField<47, 2, Shift> shift; } const isberd{insn}; + // Validate unsupported features first if (isberd.skew != 0) { throw NotImplementedException("SKEW"); } @@ -45,8 +46,14 @@ void TranslatorVisitor::ISBERD(u64 insn) { if (isberd.shift != Shift::Default) { throw NotImplementedException("Shift {}", isberd.shift.Value()); } - LOG_WARNING(Shader, "(STUBBED) called"); - X(isberd.dest_reg, X(isberd.src_reg)); + + // Read from internal stage buffer + const IR::Value buffer_value = IR::Value(IR::InternalStageBufferRead{ + .buffer = X(isberd.src_reg), + }); + + // Store the result + X(isberd.dest_reg, buffer_value); } } // namespace Shader::Maxwell