Files
ARMSX2/pcsx2/ShaderCacheVersion.h
T
jpolo1224 bce46f874f GS/VK: emit the driver-workaround shader wrappers as defines when unused
LEGO Batman (SLUS-21785) crashed on the Vulkan renderer moments after the
BIOS, on an Adreno 740 running driver 512.676.53. Qualcomm's SPIR-V compiler
took a SIGSEGV inside CreateQGLCProgram building a TFX pipeline; our signal
handler turned that into a SIGABRT on the GS thread, so it presented as an
emulator abort rather than a driver fault. The same build ran the game
correctly on OpenGL, which never goes through SPIR-V.

gpu_bitwise_and and gpu_matrix_element were emitted as real functions on
every driver. Where no workaround applies their bodies are just 'a & b' and
'value[column][row]', so the shader means exactly what it did before -- but
each of the ~12 call sites, including one inside the texture loop and three
in the region-clamp path, now costs an OpFunctionCall in the SPIR-V, and
that shape is what the compiler falls over on.

They are #defines now unless their workaround is active, so a driver the
database has no rule for gets the same SPIR-V it had at 108. That is what
introducing the wrappers claimed -- 'the generated SPIR-V is unchanged on any
driver the database has no rule for' -- and it was not true, because the
wrapper went out unconditionally. Mali and PowerVR keep the real bodies.

Every macro argument is parenthesised: the dither lookup passes
'fpos.y & 3', which needs the parens to survive the subscript.

SHADER_CACHE_VERSION 109 -> 110; the shader text changed again.

Diagnosed with jpolo1224 from an on-device tombstone.
2026-07-27 01:05:23 -04:00

15 lines
980 B
C

// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+
/// Version number for GS and other shaders. Increment whenever any of the contents of the
/// shaders change, to invalidate the cache.
// 109: driver-workaround shader wrappers (gpu_bitwise_and / gpu_bitwise_not / gpu_boolean_not /
// gpu_matrix_element). Every TFX and convert shader's source text changed, so a cached blob from
// 108 no longer matches the source that produced it — leaving this alone hands users stale
// binaries and garbage rendering after the update.
// 110: Vulkan emits the gpu_bitwise_and / gpu_matrix_element wrappers as bare #defines when no
// driver workaround is active, so unaffected drivers get the same SPIR-V they had at 108. 109 wrapped
// them in real functions on EVERY driver, and Qualcomm's SPIR-V compiler segfaults compiling a TFX
// pipeline containing those calls.
static constexpr u32 SHADER_CACHE_VERSION = 110; // 108 was upstream PR 14688