Skip to content

docs: require Vulkan validation layer for AGC, shader and VideoOut tests - #7367

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
hamb3r:docs/vulkan-validation-rules
Oct 19, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
hamb3r:docs/vulkan-validation-rules

Conversation

@hamb3r

@hamb3r hamb3r commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

What

Document the required local test command and validation rules for AGC driver, shader recompiler, and VideoOut changes in CONTRIBUTING.md and AGENTS.md:

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R <pattern> -V

Motivation (recent cases caught during review)

Recent reviews revealed multiple instances where tests passed their assertions and CTest reported Passed, but underlying Vulkan/SPIR-V specification violations were present and only surfaced when reviewers manually attached the validation layer with verbose logging:

Documenting this workflow in CONTRIBUTING.md and AGENTS.md ensures contributors and AI agents validate their changes proactively before opening PRs, saving reviewer round-trips.

Why this specific workflow is required (and why standard ctest runs miss regressions)

  1. ctest -V is required because validation errors do not fail the process exit code:
    Production GPU drivers frequently accept invalid SPIR-V or out-of-spec Vulkan API usage silently and return exit code 0. Even with VK_LAYER_KHRONOS_validation enabled, the layer prints VUID- errors to stdout/stderr without aborting the process. Because the test binary still exits with 0, ctest reports Passed, and ctest --output-on-failure suppresses the entire output log. Both human contributors and AI agents see a green test result while VUID- errors remain hidden unless -V (--verbose) is passed and the log is explicitly checked.
  2. ANYPS5_NO_SHADER_CACHE=1 prevents false passes from cached shaders:
    Without disabling the on-disk shader cache, runtime tests can load previously compiled SPIR-V binaries from earlier runs instead of exercising and validating the newly modified shader recompiler paths.
  3. ANYPS5_REQUIRE_VULKAN=1 prevents silent test skipping:
    Ensures the test fails explicitly if Vulkan or the requested layer fails to initialize rather than skipping silently.

Why this is enforced via CONTRIBUTING.md / AGENTS.md and environment variables rather than hardcoded in CMake or CI

  1. No forced LunarG Vulkan SDK requirement for non-graphics contributors:
    Developers working on relinker, libkernel, audio, input, or networking typically have standard GPU drivers installed without VK_LAYER_KHRONOS_validation. Hardcoding VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation into CMakeLists.txt test properties by default would cause tests to fail with VK_ERROR_LAYER_NOT_PRESENT on machines without the validation layers installed.
  2. No CMake reconfiguration or rebuild overhead:
    Adding a CMake build option (e.g. -DANYPS5_ENABLE_VULKAN_VALIDATION=ON) would require reconfiguring and rebuilding targets when switching between normal performance runs and validation runs. Using environment variables matches the existing AnyPS5 runtime configuration design (ANYPS5_REQUIRE_VULKAN, ANYPS5_NO_SHADER_CACHE).
  3. CI 30-second timeout budget and isolated scope:
    CI runs GPU tests in parallel on software lavapipe without a shader cache under a strict 30-second per-test budget, where enabling heavy runtime validation across all tests risks timeouts and would fail on unrelated pre-existing upstream VUIDs. Requiring focused -V validation runs on the touched tests for AGC, shader recompiler, and VideoOut PRs catches regressions at the source without slowing down CI or breaking non-GPU workflows.

Tested

Verified python3 tools/check_conventions.py --base origin/main passes on Windows 10 Pro.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@hamb3r
hamb3r force-pushed the docs/vulkan-validation-rules branch from c822c13 to 557c950 Compare October 18, 2026 02:48
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 CONTRIBUTING.md

@github-actions github-actions Bot added the docs label Oct 18, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 18, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@hamb3r
hamb3r force-pushed the docs/vulkan-validation-rules branch from 557c950 to 53f69aa Compare October 18, 2026 19:16
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, we'd like to adopt this. Two small changes before merge:

  1. If the validation layer isn't installed, the loader only prints one line and the run still exits 0, so "zero VUIDs" can pass with no validation at all. Could you add a step to check that the log has no was not found but was requested by env var VK_INSTANCE_LAYERS line?
  2. Please word the bar as "no new validation errors compared with main" rather than zero, since main isn't known to be clean of them.

@hamb3r
hamb3r force-pushed the docs/vulkan-validation-rules branch from 53f69aa to 97cf551 Compare October 19, 2026 07:16
@hamb3r

hamb3r commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Updated!

  1. Added explicit check confirming neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS so a missing validation layer doesn't silently pass.
  2. Defined the exact comparison procedure: running the same focused tests on main and the change from the same machine and GPU, and confirming the change introduces no new VUID- validation errors compared with main.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks @hamb3r, both points are in exactly as asked: the check for the loader's "not found" line catches a missing layer, and comparing against main on the same machine and GPU makes the rule workable on tests that already log validation errors. We'll run CI on this head and merge once it's green.

@oneandonlydean
oneandonlydean merged commit 2f091d6 into boykopovar:main Oct 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants