From 70f733ffb8437b51cfce6ad386a46d5bddfb6e7f Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Thu, 2 May 2024 00:22:13 +0300 Subject: [PATCH] GPU: Handle invalid floating point uniform writes --- include/PICA/shader.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/PICA/shader.hpp b/include/PICA/shader.hpp index 5b05e0b79..a9216b17f 100644 --- a/include/PICA/shader.hpp +++ b/include/PICA/shader.hpp @@ -256,8 +256,10 @@ class PICAShader { void uploadFloatUniform(u32 word) { floatUniformBuffer[floatUniformWordCount++] = word; - if (floatUniformIndex >= 96) { - Helpers::panic("[PICA] Tried to write float uniform %d", floatUniformIndex); + // Check if the program tries to upload to a non-existent uniform, and empty the queue without writing in that case + if (floatUniformIndex >= 96) [[unlikely]] { + floatUniformWordCount = 0; + return; } if ((f32UniformTransfer && floatUniformWordCount >= 4) || (!f32UniformTransfer && floatUniformWordCount >= 3)) {