From 1c9df7c02c6caf21c586782ad1b388570faeb0e5 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Mon, 29 Jul 2024 01:42:56 +0300 Subject: [PATCH] Simply vertex cache code --- src/core/PICA/gpu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/PICA/gpu.cpp b/src/core/PICA/gpu.cpp index 998bacf9..6cbdb100 100644 --- a/src/core/PICA/gpu.cpp +++ b/src/core/PICA/gpu.cpp @@ -174,7 +174,9 @@ void GPU::drawArrays() { constexpr u32 maxAttrSizeInFloats = 16 * 4; auto& vertices = vertexBuffer.vertices; - setVsOutputMask(regs[PICA::InternalRegs::VertexShaderOutputMask]); + if constexpr (mode != ShaderExecMode::Hardware) { + setVsOutputMask(regs[PICA::InternalRegs::VertexShaderOutputMask]); + } // Base address for vertex attributes // The vertex base is always on a quadword boundary because the PICA does weird alignment shit any time possible @@ -247,8 +249,9 @@ void GPU::drawArrays() { if constexpr (mode != ShaderExecMode::Hardware) { vertices[i] = vertices[cache.bufferPositions[tag]]; } else { + const u32 cachedBufferPosition = cache.bufferPositions[tag] * maxAttrSizeInFloats; std::memcpy( - &vertexBuffer.vsInputs[i * maxAttrSizeInFloats], &vertexBuffer.vsInputs[cache.bufferPositions[tag] * maxAttrSizeInFloats], + &vertexBuffer.vsInputs[i * maxAttrSizeInFloats], &vertexBuffer.vsInputs[cachedBufferPosition], sizeof(float) * maxAttrSizeInFloats ); }