Skip to content

Runtime: apply ResourceMinLODClamp to sampled cube views - #1211

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/cube-resource-min-lod
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/cube-resource-min-lod

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1006 (comment)

What and why

TextureCube and TextureCubeArray SRVs encode ResourceMinLODClamp, but their sampled Vulkan views omitted it. Include the cube descriptor type in the existing sampled-color path. The test requests LOD zero with a point sampler through four views starting at resource mip 1. A separate color for each resource face and mip distinguishes selecting the wrong cube, face or level.

Tested

  • Targeted Windows CTest: ctest --test-dir build-review/runtime -R "^d3d12_descriptor$" -V. All 256 cube and cube-array RGBA samples matched on RTX 5080 (32.0.16.1692) and Radeon Graphics (32.0.21045.16010).
  • With only the runtime fix removed on base 2e5c0f2, RTX 5080 returned mip 1 instead of mip 2 for all 128 samples in the two restricted views. The other 128 still matched.
  • A separate native D3D12 comparison sampled actual TextureCube and TextureCubeArray resources on RTX 5080, Radeon Graphics and WARP. Each matched all 256 expected values. The Vulkan fixture exercises Leonida's face-indexed binding 3. Fractional cube limits and direction-to-face translation were outside this test.
  • AI-assisted. No translator changes.

Checklist

  • No game data, keys or decryption, including logs.
  • New translator rule documented in the contract table (not applicable).

Cube descriptors carry a minimum resource LOD but were excluded when building the sampled Vulkan view. Include them alongside array views so a point sample from a restricted cube cannot select an earlier mip.
@dcastell1

Copy link
Copy Markdown
Contributor

Tested a57ae52 on an RTX 5090 (Blackwell), Windows 11 Pro 10.0.26300.9974, NVIDIA 621.24, MSVC 19.44, official Vulkan SDK 1.4.363.1:

  • d3d12_descriptor_test: exit 0 with LEONIDA_VK_VALIDATION=1, 0 VUID-/validation errors.
  • Cube and cube-array minLOD views are included in the sampled-color result (the test’s five-view, mip-1 point-sampler set); MSAA, B4G4R4A4/B5G5R5A1 and the bindless descriptor checks are unchanged.
  • VK_LOADER_LAYERS_DISABLE=~implicit~ was set because ReShade and the Epic/NVIDIA layers are installed.

No game files were used.

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for running with validation on the 5090. One detail for reproducing the result: the cube-specific subsection has four views, two TextureCube and two TextureCubeArray, each with 64 samples. The output line for those is "cube minimum LOD: 256/256 samples matched across cube and cube-array views".

@kapitche

Copy link
Copy Markdown
Contributor

Tested a57ae52 on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass.

@whattheflop

Copy link
Copy Markdown
Contributor

AI-assisted verification at a57ae52048fd0448c24a4866753e3cb184d8781f on Windows 11 Pro 10.0.26200.9974. I ran only the stock synthetic cube case through a temporary wrapper, with resource-relative clamps 1.00, 1.25, 1.75 and 2.00. Each TextureCube and TextureCubeArray view started at mip 1, exposed two mips, and requested view-relative LOD 0 with point min/mag/mip filtering. The Vulkan shader used Leonida's face-indexed binding 3. The native D3D12 WARP comparison sampled actual cube faces at their centers.

  • RTX 3080 (616.64 / 32.0.16.1664, Vulkan 1.4.351) and Radeon(TM) Graphics (25.10.30.02 / 32.0.21030.2001, Vulkan 1.4.315) both exposed and enabled VK_EXT_image_view_min_lod. Each matched WARP on 512/512 RGBA8 samples (256 fractional plus 256 integer controls), with 0 Vulkan validation errors.
  • On all three paths, both view types gave 64/64 samples from resource mip 1 at clamp 1.25 and 64/64 from mip 2 at 1.75. The integer controls selected mips 1 and 2 respectively. Vulkan also permits flooring the view minimum, so this result is specific to the tested drivers and point sampler. Vulkan sampling rules

MSVC 19.38.33145.0, Windows SDK 10.0.26100.0, Vulkan SDK/loader/validation 1.4.363.0, glslang 16.6.0, WARP d3d10warp.dll 10.0.26100.9818. No game files.

@undeadhuman37

Copy link
Copy Markdown
Contributor

Tested a57ae52 on NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 Home 25H2 (26200.9974), VS 2022 Build Tools, Vulkan SDK 1.4.363.1: pass.

  • Build: 0 warnings. ctest: 58/58 passed.
  • d3d12_descriptor_test: all matched (T#/S# in the bindless set, 64 RGBA8 and RGB9E5 texels, fallback, border colours), exit 0, also with LEONIDA_VK_VALIDATION=1 and 0 validation errors.

AI-assisted. No game files.

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested a57ae52 on AMD Radeon RX 9070 (RDNA4), AMD 26.11.2 (LLPC), Windows 11 Pro 26300, MSVC 14.44: pass.

ctest -R "^d3d12_descriptor$" -V
this PR passes: cube minimum LOD: 256/256 samples matched across cube and cube-array views
control: merge-base (2e5c0f2) d3d12_vulkan_device.cpp + this PR's test fails: 128/256 samples matched; the restricted views return mip 1 instead of mip 2 (e.g. cube view 1, face 0, min mip 2: got 40,100,64,255; expected 40,180,64,255, the same for cube view 3, face 6)

Same pattern as the RTX 5080: half the samples (the two restricted views) wrong without the fix and all right with it. RDNA4 joins the RDNA2 iGPU you measured.

AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit 8dbf3a6 into ItsNotRexed:main Nov 22, 2026
11 checks passed
@quackottu

Copy link
Copy Markdown
Contributor

Tested a57ae52 on RTX 5070, driver 621.24, Windows 11: pass. Build ok; ctest 57/57 (gameinput disabled); each test exe run with Vulkan validation on, 0 validation errors. The only nonzero exits are the known ones unrelated to this PR: d3d12_clear (NVIDIA tie rounding), and vk_binary_occlusion / vk_overlapping_occlusion, which need an input file.

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.

8 participants