Skip to content

fix(kyty): ignore exemplar skip_degamma for image heap specializations - #346

Merged
simnJS merged 2 commits into
simnJS:AnyKytyfrom
slopgobblercobbler:fix/kyty-shader-variant-key
Nov 26, 2026
Merged

simnJS merged 2 commits into
simnJS:AnyKytyfrom
slopgobblercobbler:fix/kyty-shader-variant-key

Conversation

@slopgobblercobbler

Copy link
Copy Markdown
Contributor

What

Ignore exemplar skip_degamma on image.heap children in BuildResourceSpecialization (ResourceMaterialization.cpp):

  • For indirect image heap bindings (image.heap == true), neither the SPIR-V emitter (spirvEmitterImage.cpp, where srgb_decode requires indirect_root == NoIndirectImage) nor descriptor binding (descriptors.cpp, which skips resource.heap) reads ResourceSpecialization::Image::skip_degamma.
  • Previously, !table_heap && Prospero::IsSrgbFormat(format) && SamplerSkipsDegamma(...) wrote the first-seen exemplar T#'s sRGB bit from view.kinds into specialization.images[child].skip_degamma, causing identical shaders to produce different ResourceSpecialization keys across sessions depending on texture streaming order.
  • Changing !table_heap to !image.heap keeps skip_degamma for direct sampled images while making image heap specializations independent of exemplar sRGB vs UNorm order.
  • Added focused regression test kyty_shim_image_heap_variant_key (KytyShim/tests/ImageHeapVariantKey.cpp).

Tested

  • Windows 11, NVIDIA GeForce RTX 3070:
    • python tools/check_conventions.py --base origin/AnyKyty passed.
    • python tools/check_kyty_settings.py passed.
    • ctest --test-dir build -R "^(kyty_shim_image_heap_variant_key|kyty_shim_empty_buffer_replay|kyty_shim_generic_compute_replay|kyty_shim_buffer_cache_pages)$" --output-on-failure passed 4/4.
    • Vulkan validation gate (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer) passed with Insert instance layer "VK_LAYER_KHRONOS_validation" confirmed and 0 new VUID- errors vs origin/AnyKyty baseline.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: Part of kyty: the same shaders are translated again in later sessions (specialization differs per run) #316
  • Unblocks: Brainrot (PPSA38500) cross-session shader cache reuse
  • GPUs tested: NVIDIA GeForce RTX 3070 (Windows, VK_LAYER_KHRONOS_validation 0 new VUID errors)
  • AI-assisted: yes

@github-actions

Copy link
Copy Markdown

Please remove PASS_REGULAR_EXPRESSION from the CTest registration. When the success marker matches, CTest ignores the process exit code, so a nonzero exit after printing the marker could still pass. The test already returns a nonzero status on assertion failure, so the exit code is sufficient.

@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

Removed \PASS_REGULAR_EXPRESSION\ from \kyty_shim_image_heap_variant_key\ in \KytyShim/tests/CMakeLists.txt\ so the test exit code gates pass/fail directly.

@github-actions

Copy link
Copy Markdown

Thanks for the update. The current diff confirms that PASS_REGULAR_EXPRESSION is gone, so a success marker can no longer mask a nonzero exit code.

@simnJS simnJS left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the updated test registration. The integration checks passed on the exact candidate for the current target branch.

@simnJS
simnJS merged commit e9c4ba8 into simnJS:AnyKyty Nov 26, 2026
15 checks passed

This branch was previously deployed

1 inactive deployment
repository-maintenance — 1ce046ce Deployed Nov 26, 2026 by slopgobblercobbler via review #85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants