fix(shader): fall back when SPIR-V optimization invalidates a module #4241
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4241"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T02:02:25Z.
What
ValidateAndOptimizeSpirvalready validates the input before optimization, but it threw when SPIRV-Tools produced output that failed validation. For valid input, it now reports that validation failure to stderr and returns the validated pre-optimization module, so an optimizer regression does not abort shader preparation. Valid optimized modules are still selected as before.The new optimizer regression check verifies that invalid optimized output selects the valid input and that valid output remains selected. The exact specialized module from #4205 was not provided, so this tests the fallback decision rather than reproducing that game's shader. The output remains subject to Vulkan/SPIR-V validation by the existing caller path.
Tested
Linux x86_64, CMake/Ninja Release build with SPIRV-Tools enabled:
agc_spirv_optimizer_testsafter rebasing on currentmain.ctest --test-dir /tmp/AnyPS5-4205-build -R '^agc_spirv_optimizer$' --output-on-failure: passed (1/1).tools/check_conventions.py --base upstream/main --head HEAD: passed.git diff --check upstream/main...HEAD: passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (n/a).mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T07:37:25Z.
Closing: using the unoptimized module when the optimized one fails validation is a fallback, and those aren't allowed (#182). #4018 fixed this validation error at its cause in the structurizer; if #4205 still fails on main, it needs that kind of fix.
Pull request closed