Skip to content

startup: lower cube image sampling in gfx2hlsl - #2960

Merged
pigalot merged 7 commits into
R0Y00:mainfrom
legacy-code-archaeologist:startup/gfx2hlsl-image-cube
Nov 28, 2026
Merged

pigalot merged 7 commits into
R0Y00:mainfrom
legacy-code-archaeologist:startup/gfx2hlsl-image-cube

Conversation

@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor

Change

tools/startup/gfx2hlsl.py lowers image_sample, image_sample_lz, image_sample_l and image_sample_b on dim:SQ_RSRC_IMG_CUBE to TextureCube<float4> Sample, SampleLevel and SampleBias, and writes the manifest kind texcube. Fixes #2943.

  • Address. A gfx10 cube sample addresses (s, t, face). Mesa's prepare_cube_coords (src/amd/common/nir/ac_nir_lower_tex.c) builds s = sc/|ma| + 1.5 and t = tc/|ma| + 1.5. LLVM 15.0.7 ConstantFoldAMDGCNCubeIntrinsic defines v_cubema as twice the major coordinate. So s and t lie in [1, 2].
  • Direction. An emitted helper x2w_cube_dir rebuilds a direction whose major component is ±1. Its other components carry the per-face signs of the existing v_cubesc/v_cubetc lowering, so projecting it again returns the same face coordinates.
  • Refused by name. Cube loads, image_sample_d, image_get_lod, a16, d16, compute stages, and constant samplers with DISABLE_CUBE_WRAP (word 0 bit 28, Mesa gfx10-rsrc.json).
  • Runtime. This touches only the translator and test harness. The runtime binding of texcube views is startup: bind cube views of console-layout textures in slot 70 #2938, which is still a draft. On main, d3d12_draw.inl reads an unknown srv kind as a buffer, so this must land after startup: bind cube views of console-layout textures in slot 70 #2938. That is why this PR is a draft too. Once both land, the sentence in startup: bind cube views of console-layout textures in slot 70 #2938's docs that gfx2hlsl "does not emit that kind yet" is out of date.

Verification

Commit 44a7d7d3 on main 6ee878d8, Windows 10.0.26100.9711 (24H2), dev preset. Debug layer unavailable on both adapters.

  • ctest --preset dev --no-tests=error -R '^startup_image_cube_' -V: 3/3 passed.
    • NVIDIA Quadro M1000M (driver 32.0.15.7371): 22 reference draws matched; 17 controls and mutants each read the texel they predict.
    • WARP (Microsoft Basic Render Driver 10.0.26100.9711): the same.
  • ctest --preset dev --no-tests=error -R '^startup_image_|^startup_gfx2hlsl_cube' -j 2: 53/53 passed, no skips. The baseline before the change was 50/50.
  • python -B tests/startup_image_cube_check.py binary <llvm-mc 15>: all 16 fixture programs reassemble to the recorded words. Run locally through clang -cc1as -show-encoding of LLVM 15.0.7.
  • The full python-linux list from the workflow, through tools/run_checks_parallel.py: all ok. startup_run_sh and startup_build_rev exit 77 on Windows.
  • python -B tests/docs_links_check.py: ok.
  • With the translator change reverted, the new controls fail with image dimension SQ_RSRC_IMG_CUBE.

Evidence and follow-up

Fixture. offscreen_check --startup-image-cube binds six 2x2 R32G32B32A32_FLOAT faces as a TextureCube. Texel (x, y) of face f holds ((1 + x + 2y + 4f) / 32, x, y, f). All sources are source-built.

  • Seven programs pass (s, t, face) as constants, without v_cube*. The reference is only the address meaning, so a wrong face, sign or axis in the helper reads another texel, chosen by the desktop driver's own face selection.
  • 13 helper mutants: for each face, the u sign flipped and u/v exchanged, plus faces 2 and 3 exchanged. Each must read the texel a D3D lookup of the mutated direction gives.
  • Guest-input controls: face + 1, s and t exchanged, and the face placed in the LOD or bias dword.
  • Six v_cube chains, one per face, must match both the reference and a desktop pixel shader that samples the same direction.

Changed expectations, intended.

  • The cube refusals in startup_image_sample_l_check.py and startup_image_sample_b_check.py become acceptance checks.
  • In startup_image_3d_check.py, the 1D words with the dim field set to cube now form a valid three-register cube sample: the disassembler sizes the address from the dimension. Its unverified-dimension case therefore uses MSAA, which is still refused.

Limits (all documented in docs/experiments/startup-image-cube.md):

  • That the console's face order and orientation equal D3D's rests on LLVM's cube table matching the D3D cube face table. It is not measured on the console.
  • Only one mip is bound, so LOD and bias values on a cube are untested. The _l and _b draws only show that the extra dword is not read as a coordinate.
  • A cube-array view samples layer 0. GFX10 MIMG has no array bit, so this cannot be refused from the instruction.
  • Heap and register samplers do not validate DISABLE_CUBE_WRAP.
  • Only pixel stages are drawn.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

🤖 Generated with Claude Code

image_sample, image_sample_lz, image_sample_l and image_sample_b on
dim:SQ_RSRC_IMG_CUBE now lower to TextureCube<float4>, with the
manifest kind texcube. The gfx10 address (s, t, face), where
s = sc/|ma| + 1.5 (Mesa prepare_cube_coords) and ma is twice the major
coordinate (LLVM ConstantFoldAMDGCNCubeIntrinsic), is rebuilt into a
direction by an emitted helper x2w_cube_dir. Cube loads, image_sample_d,
image_get_lod, a16, d16, compute stages and constant samplers with
DISABLE_CUBE_WRAP stay refused by name.

offscreen_check --startup-image-cube binds six 2x2 faces as a
TextureCube. tests/startup_image_cube_check.py draws literal face
addresses against the address meaning, 13 helper mutants, guest-input
controls and the v_cube chain per face against a desktop TextureCube
draw. The cube cases of the sample_l and sample_b checks change from
refusal to acceptance; the 3D check's unverified-dimension case moves
to MSAA, since the same words now form a valid cube sample.

The runtime binding of texcube views is R0Y00#2938; this must land after it.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor Author

Cross-check against the native path: on cpp-migration (f934df52), cube_axes in src/gfx1013_direct_compute.inl already rebuilds a cube direction for the direct C++ frontend. It uses the same per-face table as x2w_cube_dir here: u = 2s - 3, v = 2t - 3, +X (1, -v, -u), -X (-1, -v, u), +Y (u, 1, v), -Y (u, -1, -v), +Z (u, -v, 1), -Z (-u, -v, -1). So both translators agree on the face convention.

There are two differences, both outside what the fixture draws:

  • The native path keeps face >> 3 as a cube-array layer for a TextureCubeArray. This lowering samples layer 0 of a TextureCube.
  • For face ids 6 and 7, the native path's selects resolve to +Z and -Z. Here they map to face 5.

AI-assisted.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR #2960 implements cube image sampling in gfx2hlsl. Complex translation that needs careful review.

What works

  • Address reconstruction: correct derivation from Mesa prepare_cube_coords. s,t in [1,2], face ID from
    cubesc/cubetc/cubema registers. The s-1, t-1 face positioning is exactly right.
  • x2w_cube_dir: reconstructs a direction vector whose major component is +/-1 for the face. Other components
    carry u=2(s-1.5), v=2(t-1.5) with per-face signs from the existing v_cube* lowering. Projecting again
    returns the same face coordinates. Correct for all 6 faces.
  • Refusal list is thorough: image_load/image_load_mip (cube loads not defined on TextureCube), image_sample_d
    (cube derivatives not converted), image_get_lod, a16, d16, compute stages, DISABLE_CUBE_WRAP constant sampler.
  • Clear dependency note: "this must land after #2938" for texcube runtime binding. Good practice.
  • Experiment doc startup-image-cube.md is excellent: documents the Mesa source, LLVM intrinsics, refused forms,
    and known limitations (cube-array). The 254-line gfx2hlsl.py change is well-organized.
  • Test harness adds cube support to check_startup_image_3d with a six-face TextureCube fixture.

Issues

  1. Cube-array limitation: The doc correctly notes gfx10 MIMG has no array bit so cube-array views cannot
    be distinguished from cube views from the instruction. The helper keeps face bits (id & 7) and samples
    layer 0 of a TextureCube which is wrong for cube-array. This should at least be a refuse-with-reason or
    a dev-build assertion when a cube-array descriptor is bound.
  2. DISABLE_CUBE_WRAP constant sampler: The guest filters without crossing face edges when the bit is set, but
    D3D12 TextureCube always filters across edges. The refusal is correct, but the note says "With the bit
    clear both cross" — are they guaranteed to match even without the bit? Border texel values may differ
    between the GPU-computed and the HLSL-projected direction.
  3. x2w_cube_dir projection math: u = 2(s-1.5) = 2s-3. For s in [1,2]: u in [-1, 1]. When projecting
    the direction back, does this handle the case where the major component is not unique (corner of a cube
    face)? The math assumes one component is strictly largest, which is true for face coordinates but could
    be ambiguous at face corners.
  4. Test dependency on #2938 runtime: The PR is a draft and cannot be tested end-to-end without the runtime.
    Thegfx2hlsl-only translations can be checked but the draw-time binding cannot. Consider adding a unit test
    that checks the emitted HLSL directly.

Recommendations

  • Add a refuse-with-reason for cube-array (if possible to detect from the descriptor).
  • Verify DISABLE_CUBE_WRAP equality at face corners with a test harness edge case.
  • Add inline comments near x2w_cube_dir explaining why u,v are computed as 2(s-1.5).

Overall: solid implementation. The experiment doc is thorough and the refusal cases are well-reasoned.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What works

  1. Comprehensive lowering of all four sample forms (image_sample,
    _lz, _l, _b) to HLSL TypeCube Sample/SampleLevel/SampleBias.
  2. Excellent experiment doc tracing Mesa's prepare_cube_coords and
    LLVM's ConstantFoldAMDGCNCubeIntrinsic, with clear enumeration of
    refused forms and limits (cube-array ambiguity, face-wrap, bias).
  3. The x2w_cube_dir helper correctly reconstructs the direction vector
    with per-face component ordering matching the standard cube layout.

Issues

  1. Compute dispatch has no texcube view binding; the refusal is
    correct but the error message format should be consistent with other
    unbound-type refusals in the manifest binding code.
  2. Cube-array is silently sampled as layer 0 (helper keeps id & 7).
    The doc notes this, but if cube-array textures appear in the title
    the silent fallback will produce wrong results. Consider adding an
    explicit refusal if the descriptor can be checked.
  3. The experiment doc mentions bias is refused outside pixel stage
    (matches 2D handling). Verify the same check exists in the code.

Recommendations

  • Verify tests/startup_image_cube_check.py covers all four lowered forms
    (Sample, SampleLevel, SampleBias) and not just implicit LOD.
  • If cube-array is expected in the title, add an explicit refusal in
    gfx2hlsl and update the experiment doc.
  • Consider adding srv binding for texcube in the startup draw dispatcher
    for a subsequent PR.

Overall

Strong implementation with excellent documentation. Clear enum of
limitations and correct refusal of derivatives. Approvable.

Resolve tools/startup/gfx2hlsl.py: keep the cube DISABLE_CUBE_WRAP
refusal and the cube direction next to main's sampler joins and its
three-coordinate get_lod guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tedin7

tedin7 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

This PR now conflicts with main. Conflicting files:

  • tools/startup/gfx2hlsl.py

Could you merge main into your branch (a merge commit, no force push needed) and resolve these? Thank you.

AI-assisted; commands listed were executed locally. (git merge-tree origin/main <head>)

@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor Author

Thanks for review @tedin7
On it as soon as I get home in like 2 hours, if it is urgent someone else can take over.

Resolve tools/startup/gfx2hlsl.py: keep both uses_bvh/bvh and uses_cube_dir/texcube in Pipeline.
@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor Author

@tedin7 Merged \upstream/main\ (\35f7197e) into \startup/gfx2hlsl-image-cube\ in commit \982cdfe9\ (keeping both \uses_bvh/\�vh\ and \uses_cube_dir/\ excube\ in \ ools/startup/gfx2hlsl.py).

Re-verified locally on \982cdfe9\ (\dev\ preset):

  • \cmake --build --preset dev --target offscreen_check: ok
  • \ctest --preset dev --no-tests=error -R '^startup_image_cube_' -V: 3/3 passed (\startup_image_cube_controls, \startup_image_cube_warp, \startup_image_cube_hardware\ on NVIDIA Quadro M1000M driver 32.0.15.7371 and WARP 10.0.26100.9711)
  • \ctest --preset dev --no-tests=error -R '^startup_image_|^startup_gfx2hlsl_cube|^startup_gfx2hlsl_bvh' -j 2: 59/59 passed
  • \python -B tests/docs_links_check.py: passed (70 Markdown files, 584 links)

Keeping #2960 as a draft until #2938 lands.

AI-assisted.

@legacy-code-archaeologist
legacy-code-archaeologist marked this pull request as ready for review November 28, 2026 00:39
@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor Author

Merged upstream/main (38129ba3, which includes #2938 7fcde81f runtime texcube view binding) into startup/gfx2hlsl-image-cube, updated docs/experiments/startup-image-cube.md to reflect that #2938 has landed, and marked this PR ready for review.

Local verification (dev preset, Windows 10.0.26100, WARP 10.0.26100.9711 & Intel(R) HD Graphics 530 31.0.101.2111):

  • cmake --build --preset dev --target offscreen_check d3d12_xs_shim startup_stream_consumer: passed
  • ctest --preset dev --no-tests=error -R '^(startup_image_cube|startup_image_3d|startup_image_2d_array|startup_image_sample_l|startup_image_sample_b|startup_address_console_cube_order)' -V: 24/24 passed (156.92s, 0 skips — including startup_image_cube_{controls,warp,hardware} and startup_address_console_cube_order_{warp,hardware})
  • python -B tests/docs_links_check.py: passed (128 Markdown files, 629 links)

AI-assisted.

@pigalot pigalot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Independently reviewed f7da3f69 integrated over main 86beae95 (tree cb3475be). The merge is clean and git diff --cached --check origin/main is clean.

What I traced.

  • x2w_cube_dir against LLVM's ConstantFoldAMDGCNCubeIntrinsic table: for each face I took (sc, tc, major), solved u = sc/|major|, v = tc/|major| with the major component ±1, and got the six returned rows exactly:
    • +X (1, -v, -u);
    • -X (-1, -v, u);
    • +Y (u, 1, v);
    • -Y (u, -1, -v);
    • +Z (u, -v, 1);
    • -Z (-u, -v, -1).
  • u = 2(s - 1.5) follows from s = sc/|ma| + 1.5 with |ma| = 2|major|. Over a face, s spans 1 and u spans 2, so the implicit LOD from the derivatives is the same on both sides within a face.
  • Address order: image_sample_b takes the bias first and image_sample_l the level last, as for the other dimensions. The image_compare and gather paths still refuse a cube dimension, because they check dim themselves.
  • Refusals:
    • load and load_mip, image_sample_d, image_get_lod, a16, d16 and compute stages are refused by name;
    • a constant sampler with SQ_IMG_SAMP_WORD0 bit 28 (DISABLE_CUBE_WRAP) is refused;
    • the runtime already maps srv ... texcube to a TextureCube view (d3d12_draw.inl, kind 5).

What I ran. I built offscreen_check d3d12_xs_shim startup_stream_consumer in dev and release, then ran:

ctest --test-dir out/build/<preset> --no-tests=error -j 6 -R '^startup_image_(cube|3d|2d_array|sample_b|sample_l|sample_lod|sample_a16|sample_c|gather_lz|load_mip|load_d16)[a-z0-9_]*$' -E '_hardware$'
python .agentic/scripts/with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^startup_image_(...)[a-z0-9_]*_hardware$'
  • 26 non-hardware tests and 12 _hardware tests pass in Debug and in Release /O2, with no skips. These include startup_image_cube_{controls,warp,hardware}.
  • On main 86beae95 the new tests are not registered (tests/cmake/startup_image_cube.cmake is new), and main's translator refuses the cube dimension.

Mutants in tools/startup/gfx2hlsl.py. Each was applied alone, then startup_image_cube_{controls,warp} was run, and the source restored afterwards (git diff --quiet clean).

Mutant Result
raw float3(s, t, face) instead of x2w_cube_dir(...) killed: translation control
DISABLE_CUBE_WRAP read from bit 27 instead of 28 killed: the bit-28 sampler is accepted
cube Load refusal removed killed
cube compute refusal removed killed
cube image_sample_d refusal removed killed
SQ_RSRC_IMG_CUBE removed from three killed
u = clamp(s - 1.5, -1, 1) (scale 1 instead of 2) survives
v = 2(t - 1.5) without the clamp survives (see below)

Finding: the face scale is not pinned. Every draw samples a 2×2 face at a texel centre (s, t ∈ {1.25, 1.75}), and the v_cube chain directions land on texel centres too. On a 2×2 face with point sampling, only the sign of u and v picks the texel, so any positive factor in u = k(s - 1.5) reads the same texel. The helper-row mutants in the check catch the sign, axis and face errors, but not this one.

  • To reproduce: change 2.0 * (s - 1.5) to (s - 1.5) in the emitted helper, then run ctest --test-dir out/build/dev -R '^startup_image_cube_(controls|warp)$'. Both pass.
  • Suggested direction (unconfirmed): add one case that a wrong scale changes, for example a 4×4 face. At s = 1.125, factor 2 gives texel 0 and factor 1 gives texel 1. A linear-filter case at a non-centre coordinate, with the expected blend, would also do.

Non-blocking: the edge clamp is an assumption. x2w_cube_dir clamps u and v to the face. Without the clamp, an out-of-range s would instead select a neighbouring face on the desktop. No case has s or t outside [1, 2], so neither behaviour is tested, and I don't know which one gfx10 hardware has. The comment states the clamp as fact. Calling it an assumption there, or in docs/experiments/startup-image-cube.md, would help.

Verdict: changes requested for the face-scale gap. The lowering itself matches my derivation; the fixture just cannot tell the right scale from a wrong one.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10; debug layer enabled.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on f7da3f69.

This reply was AI-assisted.

Switch --startup-image-cube to six 4x4 faces (96 distinct texels) with outer-ring texel centers so dropping the 2.0 * scale on u or v shifts texels on both WARP and hardware, add scale-2 translator mutants and controls, and clarify that clamping outside [1, 2] is an untested assumption.

AI-assisted.
@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor Author

@pigalot Thank you for catching that! Fixed in dda0ca83:

  1. 4×4 cube faces & scale-2 verification (tests/startup_image_3d.cpp, tests/offscreen_check.cpp, tests/startup_image_cube_check.py):

    • Switched --startup-image-cube to six 4×4 faces (96 distinct texels ((1 + x + 4y + 16f) / 128, x, y, f)).
    • Updated CASES to outer-ring texel centers (1.125, 1.875) and DIRECTIONS to exact binary32 directions landing on 4×4 texel centers ({1.125, 1.375, 1.625, 1.875}) with x != y.
    • Added explicit clamp(2.0 * (s - 1.5), -1.0, 1.0) / clamp(2.0 * (t - 1.5), -1.0, 1.0) assertions in controls() and two new translator scale mutants (u scale 2 dropped, v scale 2 dropped) in mutants() (15 mutants / 19 controls+mutants total).
    • Verified with a temporary source mutation that replacing 2.0 * (s - 1.5) with (s - 1.5) in tools/startup/gfx2hlsl.py fails both startup_image_cube_controls and startup_image_cube_warp (rc=8).
  2. Clamping outside [1, 2] documented as an untested assumption (tools/startup/gfx2hlsl.py, docs/experiments/startup-image-cube.md):

    • Clarified in the x2w_cube_dir comment and in docs/experiments/startup-image-cube.md that clamping u and v to [-1, 1] when s or t lies outside [1, 2] is an untested assumption.
  3. Verified (dev and release /O2, Windows 11 24H2 10.0.26100.9711, debug_layer=unavailable on both adapters):

    • ctest --preset dev --no-tests=error -R '^startup_image_(cube|3d|2d_array)' -V: 9/9 passed (cube controls/warp/hardware plus existing startup_image_3d and startup_image_2d_array tests).
    • ctest --preset release --no-tests=error -R '^startup_image_cube_' -V: 3/3 passed (22 cube draws matched their references; 19 controls and mutants read the texel they predict on both Microsoft Basic Render Driver 10.0.26100.9711 and NVIDIA Quadro M1000M 32.0.15.7371).
    • python -B tests/docs_links_check.py: self-test passed (128 Markdown files, 629 links). (llvm-mc is not present locally, so binary reassembly runs on CI.)

AI-assisted.

@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor Author

Note on the dda0ca83 Linux CI failure: tests/startup_image_cube_check.py, Assemble and translate gfx1013 fixtures, and Build and test on Windows all passed; Run platform-independent Python checks on Linux failed on an unrelated ~1.5 ms mtime flake in tests/startup_gfx2hlsl_watch_check.py (FAIL failure left unchanged by later passes, which passes locally). I don't have permissions to rerun the failed workflow job (gh run rerun --failed), so please rerun the failed Linux check on your side when convenient.

AI-assisted.

@R0Y00 R0Y00 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.

Re-reviewed dda0ca8 on main 24eb18b (trial tree 48bfb76ab462f962c47d520ee39e2264d48e5c12). The 4x4 faces distinguish the earlier scale issue: at (1.125, 1.875, +X), dropping the U factor reads (1,3,+X), and dropping the V factor reads (0,2,+X), instead of the expected (0,3,+X). Both mutants failed as expected on WARP and RTX. The edge clamp is documented as an assumption.

cmake --build <build> --target offscreen_check
ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^startup_image_cube_(controls|warp|hardware)$"

Debug and Release /O2 each passed 3/3, no skips. Each adapter matched 22 reference draws and 19 controls/mutants. Windows 11 26200.9974, RTX 4060 Laptop 32.0.16.1656, inbox WARP 10.0.26100.9818, D3D12 debug layer enabled on both adapters. The local watcher check passed, and the rerun of the Linux workflow is green on the same head.

@pigalot, the earlier face-scale finding is now exercised on the updated head. Could you recheck your change request?

@pigalot pigalot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I retested dda0ca83 merged over main a166a753. The merge is clean (tree 86d88383) and git diff --cached --check is clean.

My earlier finding (face scale 2.0 * (s - 1.5) not pinned): addressed. The faces are now 4x4 and the literal cases use outer-ring texel centres (1.125 and 1.875), so a scale of 1 moves every literal case to another texel. I edited x2w_cube_dir in tools/startup/gfx2hlsl.py and ran startup_image_cube_controls, _warp and _hardware:

Mutant Result
u = clamp(s - 1.5, -1.0, 1.0) killed in all three
v = clamp(t - 1.5, -1.0, 1.0) killed in all three
u = clamp(2.0 * (s - 1.0), -1.0, 1.0) killed in all three

All three are caught first by the helper-text asserts. So I ran the draw mode again from a copy of the test with those two asserts removed. Unmutated, it reports "22 cube draws matched their references; 19 controls and mutants read the texel they predict". With either scale dropped, it fails with "image 3D readback differs" on WARP. So the draws pin the scale on their own. The new in-test u scale 2 dropped and v scale 2 dropped mutants cover the same thing on both adapters.

What I ran. I built offscreen_check in dev and release, then ran:

ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R 'startup_image_|startup_gfx2hlsl_image' -E '_hardware'
python .agentic\scripts\with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '(startup_image_|startup_gfx2hlsl_image).*_hardware'
  • Results: 41/41 non-hardware and 18/18 hardware tests pass in both Debug and Release /O2, with no skips. These include the neighbours whose checks changed with the 4x4 texel formula: startup_image_3d, _2d_array, _sample_b and _sample_l.
  • Negative control: tests/cmake/startup_image_cube.cmake and startup_image_cube_check.py don't exist on main a166a753, so main registers no cube test.

Verdict: approve on dda0ca83. This supersedes my changes-requested review on f7da3f69.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0 DXC, Python 3.12.10; I did not check the debug-layer status.
CI: Build and test on Windows passes on dda0ca83.

This reply was AI-assisted.

@pigalot
pigalot merged commit 152e93b into R0Y00:main Nov 28, 2026
9 of 10 checks passed
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.

startup: gfx2hlsl refuses cube image sampling (dim:SQ_RSRC_IMG_CUBE)

5 participants