From 63075f18305c556b7d9a04b1db5f9d94110d1cc3 Mon Sep 17 00:00:00 2001 From: wheremyfoodat Date: Sun, 12 Mar 2023 04:39:27 +0200 Subject: [PATCH] [PICA] Indexed add --- include/PICA/shader.hpp | 3 +-- src/core/PICA/shader_interpreter.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/PICA/shader.hpp b/include/PICA/shader.hpp index d6761546..9875bb39 100644 --- a/include/PICA/shader.hpp +++ b/include/PICA/shader.hpp @@ -180,8 +180,7 @@ public: } void setBufferIndex(u32 index) { - if (index != 0) Helpers::panic("How many bits is the shader buffer index reg meant to be?"); - bufferIndex = (index >> 2) & 0xfff; + bufferIndex = index & 0xfff; } void setOpDescriptorIndex(u32 index) { diff --git a/src/core/PICA/shader_interpreter.cpp b/src/core/PICA/shader_interpreter.cpp index 13111a5e..5d72c7b8 100644 --- a/src/core/PICA/shader_interpreter.cpp +++ b/src/core/PICA/shader_interpreter.cpp @@ -136,12 +136,12 @@ bool PICAShader::isCondTrue(u32 instruction) { void PICAShader::add(u32 instruction) { const u32 operandDescriptor = operandDescriptors[instruction & 0x7f]; - const u32 src1 = (instruction >> 12) & 0x7f; + u32 src1 = (instruction >> 12) & 0x7f; const u32 src2 = (instruction >> 7) & 0x1f; // src2 coming first because PICA moment const u32 idx = (instruction >> 19) & 3; const u32 dest = (instruction >> 21) & 0x1f; - if (idx) Helpers::panic("[PICA] ADD: idx != 0"); + src1 = getIndexedSource(src1, idx); vec4f srcVec1 = getSourceSwizzled<1>(src1, operandDescriptor); vec4f srcVec2 = getSourceSwizzled<2>(src2, operandDescriptor);