GPU: Handle invalid floating point uniform writes

This commit is contained in:
wheremyfoodat 2024-05-02 00:22:13 +03:00
parent 6a424a7a66
commit 70f733ffb8

View file

@ -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)) {