Repository navigation
fix(kyty): accept devices without shaderResourceMinLod - #336
Open
discordbarca wants to merge 2 commits into
Open
discordbarca wants to merge 2 commits into
discordbarca wants to merge 2 commits into
Conversation
The Intel Windows driver (101.8974, Intel Arc iGPU) reports shaderResourceMinLod = false, so device selection refused it and 20 of the kyty_shim tests failed before reaching the GPU (see simnJS#203). Make the feature optional: - device selection logs it instead of rejecting the device, and the feature is only enabled when the driver reports it; - a new Spirv::Profile::shader_resource_min_lod flag carries support into the recompiler (and into the shader store header); - without it, an implicit-LOD sample with a clamp queries its LOD with OpImageQueryLod, adds the bias, clamps with FMax and samples at that explicit LOD (the same fold the explicit-LOD path already uses); only anisotropic filtering is lost. With explicit gradients the clamp is dropped. Devices that support the feature emit the same SPIR-V as before.
Compile image_sample_cl, image_sample_b_cl and image_sample_d_cl pixel shaders with and without Spirv::Profile::shader_resource_min_lod and check the SPIR-V: with the feature it uses the MinLod capability and operand; without it there is no MinLod at all, implicit and biased samples query their LOD and sample at an explicit Lod, and the gradient sample keeps its gradients. Every variant must pass spirv-val. Registered as kyty_shim_recompiler_min_lod_fallback.
discordbarca
temporarily deployed
to
repository-maintenance
November 26, 2026 19:47 — with
GitHub Actions
Inactive
simnJS
requested changes
Nov 26, 2026
simnJS
left a comment
Owner
There was a problem hiding this comment.
Please add a behavioral regression for a sampler with nonzero mip LOD bias. The fallback takes the second component of OpImageQueryLod, which includes the queried LOD adjustment, and sends it to an explicit-LOD sample using the same sampler. This can apply the bias twice and select a different mip. The gradient fallback also drops the minimum LOD clamp. Cover both cases with distinguishable mip values so the test verifies sampling results. Vulkan LOD operation and query
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Device selection refused any GPU without
shaderResourceMinLod. The Intel Windows driver (101.8974, Intel Arc iGPU in a Core Ultra 7 255H) reports it asfalse, so 20 of the 104kyty_shim_tests failed before reaching the GPU (Intel(R) Graphics: shaderResourceMinLod is not supported). This was reported in #203: #203 (comment)This PR makes the feature optional:
vulkanWindow.cpp: logs the missing feature instead of rejecting the device; enablesshaderResourceMinLodonly when the driver reports it; addsGraphicContext::shader_resource_min_lod_enabled.Spirv::Profile::shader_resource_min_lod(set inSpirvProfile, serialized inSerialize.h, so it is also part of the shader store header) carries support into the recompiler.spirvEmitterImage.cpp: without the feature, an implicit-LOD sample with a clamp component queries its LOD withOpImageQueryLod(.y), adds the bias, clamps withFMax(lod, min_lod)and samples with an explicitLod. This is the same fold the explicit-LOD path already uses, and the same query the mip-stats path uses. Only anisotropic filtering is lost on that sample. With explicit gradients the clamp is dropped.Devices that support the feature take the old path and emit the same SPIR-V as before.
Tested
Windows 11 Pro 25H2 (26200.9974), WinLibs GCC 15.2.0 UCRT, LLVM 21.1.8, Vulkan SDK 1.4.363.0 validation layer.
ctest --test-dir build -R '^kyty_shim_' -V --timeout 300withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Tested on688dbf145dplus this change; the rebase onto currentAnyKytywas clean and touched none of these files.ANYPS5_GPU=Intel)ANYPS5_GPU=5070)kyty_shim_rt_corpusis skipped in every run (no manifest).VUID-lines in all runs.shaderResourceMinLodnow pass on Intel.kyty_shim_packed_unorm_blendchecks every device regardless ofANYPS5_GPU. Its 10 off-by-one-LSBdst=5mismatches are on NVIDIA; Intel has 0. This failure is the same before and after.kyty_shim_pm4_shader_registerstimed out once during the Intel run. That test always uses NVIDIA, and it passed in 0.5 s on rerun with bothANYPS5_GPU=Inteland=5070.New test
kyty_shim_recompiler_min_lod_fallback: compilesimage_sample_cl,image_sample_b_clandimage_sample_d_clpixel shaders with and withoutshader_resource_min_lod, and checks the SPIR-V. With the feature, theMinLodcapability and operand are used. Without it there is noMinLod, implicit and biased samples useOpImageQueryLodwith an explicitLod, and the gradient sample keeps its gradients. Every variant passesspirv-val. It passes along with the other 5kyty_shim_recompiler_*tests.Still not covered: the rendered output of the fallback is not compared against the
MinLodpath on a GPU, and no game was run on the Intel GPU.Checklist
AnyKyty; no other open PR implements the same functions.mdfiles or images added to the repository