Fix out-of-bounds texture size query extracts in the SPIR-V translator

The SPIR-V generator emitted OpCompositeExtract with the guest's component index even when it exceeded the image's size vector. A 2D texture's OpImageQuerySizeLod returns a v2int, so a guest request for the third component (depth) produced an extract of index 2, which is invalid SPIR-V. RADV crashed while compiling those variants during shader preparation.

Return the constant 1 for a component past the texture's dimensions, the depth of a 1D/2D/cube texture, and apply the same guard in the GLSL generator. build_xlate.py now expects the added patch.
This commit is contained in:
DieMitchell
2026-11-09 15:28:14 +01:00
committed by tangerineturtle1
parent 4223e0aa5c
commit 21eb3de1c2
2 changed files with 42 additions and 2 deletions

View File

@@ -99,8 +99,8 @@ def prepare_sources() -> Path:
for junk in list(src.glob("src/*/obj")) + list(src.glob("src/*/bin")):
shutil.rmtree(junk)
patches = sorted((XLATE / "patches").glob("*.patch"))
if len(patches) != 36:
sys.exit(f"expected 36 patches, found {len(patches)}")
if len(patches) != 37:
sys.exit(f"expected 37 patches, found {len(patches)}")
# build/xlate is inside this checkout, and git inside a repository reads a "diff --git" patch's paths from the
# repository's top: those hunks fall outside the directory handed to --directory, git skips every file of the patch
# and still exits 0. 0021-prmt-byte-permute.patch is the only one written in that form, so it used to be skipped in