Skip to content

Reproduce MinLod readback differences with a source-built texture fixture #809

Open

Description

@R0Y00

Refs #804. All 29 local records previously blocked by the MinLod operand compiled and built a D3D12 pipeline on WARP and RTX after the bridge fix. Under the tested synthetic bindings 19 wrote color on both adapters. Seven matched byte for byte and twelve had finite floating-point differences. That comparison alone does not identify the cause.

Claim one sampling form or adapter in a comment. Build on #804's source-built mip fixture. Start with one texture containing distinguishable colors at each mip, a defined sampler and coordinates, and one MinLod instruction form. Use an independent expected output with a stated error tolerance if filtering requires one.

  • Run the translated shader and a direct desktop HLSL control on WARP and a physical adapter with the same texture, sampler and coordinates. Record the first differing pixel and channel. Separate finite output differences, unchanged clear values, timeouts and capability skips.
  • Start at an exact mip level. Then vary one dimension such as the clamp near a mip boundary, gradients, or filter. Include a wrong-clamp or swapped-mip negative control and record the expected mismatch.
  • Record the commit, DXC version, flags, adapter and driver, Windows build and debug-layer status. Publish the smallest source-built reproducer with results, or the tested range if the difference stays unreproduced. Keep archive shaders and other binary inputs local.

Activity

  1. lukaslw-lab commented on Nov 23, 2026

    @lukaslw-lab
    Contributor

    I'll take plain Sample + MinLod on an RTX 3080 Ti (Windows driver 32.0.16.1047) and WARP 1.0.22 (app-local Agility SDK), Windows 10 build 19045, building on #804's mip fixture (spirv_minlod_* passes on both at 66669bb).

    • One texture with a distinct color per mip, an exact-mip clamp first, then a fractional clamp near a mip boundary.
    • A direct desktop HLSL control and a swapped-mip negative control.
    • Report the first differing pixel and channel, or the tested range if nothing reproduces.

    Shared code I expect to touch: tests/spirv_window/minlod.py and the quad-LOD check in tests/pixel_aot_render.cpp.

    AI-assisted (Claude Code).

  2. lukaslw-lab commented on Nov 23, 2026

    @lukaslw-lab
    Contributor

    Results for plain Sample + MinLod are in #816. Translated and direct-HLSL results are bit-identical on each adapter. The RTX/WARP differences appear only with linear mip filtering, where the adapters quantize the mip blend weight differently.

    Windows 10 build 19045, Agility SDK 1.620.2, DXC 1.9.2609, at af94238:

    Clamp (MIN_MAG_POINT_MIP_LINEAR) Exact green, blue WARP 1.0.22 RTX 3080 Ti (32.0.16.1047)
    1.25 0.75, 0.25 exact 0.7499962, 0.2500038
    1.3 0.7, 0.3 0.6992188, 0.3007813 0.7031205, 0.2968795
    1.001953125 0.9980469, 0.0019531 1, 0 1, 0
    • Point mip filtering: clamps 0–3, 1.4375, 1.5625 and 3.75 read the nearest mip exactly on both adapters. The 1.5 tie read mip 2 on both.
    • Linear mip filtering: both adapters use 1/256 weight steps. At 1.3 the results match WARP rounding the weight (77/256) and the RTX truncating it (76/256), and the RTX adds up to 7.6e-6.
    • Negative controls: a wrong mip and a wrong blend both fail at pixel (0, 0).
    • Not established: whether this explains the twelve archive differences, since their sampler state and coordinates aren't known here. The 1/128 test tolerance comes from these measurements, not from a specified precision.
    • Still open for others: AMD and Intel adapters, and the SampleBias, SampleGrad and SampleCmp forms.

    AI-assisted (Claude Code).

  3. stan495 commented on Nov 23, 2026

    @stan495
    Contributor

    I reproduced #816's source-built Sample + MinLod fixture on a Radeon RX 7900 XTX and Windows in-box WARP. Both spirv_minlod_levels_* tests passed at af942385c9561a9ee4d5d202d79bae9a084fb87f, with zero capability skips.

    The first pixel (0, 0) with MIN_MAG_POINT_MIP_LINEAR returned these G/B values for both the translated shader and the direct HLSL control.

    Clamp RX 7900 XTX G / B In-box WARP G / B
    1.25 0.75 / 0.25 0.75 / 0.25
    1.3 0.69921875 / 0.30078125 0.69921875 / 0.30078125
    1.001953125 1 / 0 1 / 0

    The unmodified fixture passed on both backends. A second run logged every raw RGBA word alongside the existing 1/128 reference comparison. For each of the nine linear-mip clamps, all 64 pixels (256 channel words) were bit-identical between the translated shader and the direct HLSL control on each backend. The Radeon and this WARP also matched each other across all nine linear-mip readbacks. At 1.3, the blue weight was exactly 77/256, matching the WARP result reported in #816. At 1.001953125 both backends returned the unmixed green mip.

    Point mip filtering matched the expected colors exactly, with the 1.5 tie selecting mip 2 on both backends for both shaders. Both negative controls returned the expected renderer exit code 1 at pixel (0, 0) for both shaders on both backends. The first differing channel was G (channel 1) in each case.

    Negative control Expected G / B Actual G / B
    Clamp 1 checked against mip 2 0 / 1 1 / 0
    Clamp 1.25 checked against the 1.5 blend 0.5 / 0.5 0.75 / 0.25

    Windows 11 Pro 25H2 build 26200.9974, Ryzen 7 7800X3D, Radeon RX 7900 XTX driver 32.0.32029.2010. The renderer confirmed AMD Radeon RX 7900 XTX (1002:744c) for hardware and Microsoft Basic Render Driver for WARP. WARP came from Windows System32\d3d10warp.dll version 10.0.26100.9818. The D3D12 debug layer was enabled on both backends. DXC was 1.8.2502.11 (239921522) from Windows SDK 10.0.26100.0.

    .\tools\setup-spirv-tools.ps1
    cmake --preset dev
    cmake --build --preset dev --target offscreen_check
    $env:XBOX2WINDOWS_ADAPTER = '7900 XTX'
    $env:X2W_REQUIRE_SPIRV_TOOLS = '1'
    ctest --preset dev --no-tests=error -R '^spirv_minlod_levels_(hardware|warp)$' -V

    For the diagnostic run, I rebuilt offscreen_check with temporary logging that emits the raw FP32 RGBA channels in raster order. I set X2W_MINLOD_FULL_READBACK=1 and repeated the CTest command above with the diagnostic enabled. The Python check compared 256 channel words per shader for each clamp. The same 1/128 reference tolerance applied.

    The bridge used the repository-pinned SPIRV-Tools 262bdab, SPIRV-Headers b824a46, and patched SPIRV-Cross 57e4efc. The fixture assembled and validated with --target-env vulkan1.2, translated with --hlsl --shader-model 66, and compiled with dxc -T ps_6_6 -E main, with -DCLAMP=<clamp> for the HLSL control. These measurements cover the source-built fixture's plain Sample form with constant coordinates and R8G8B8A8_UNORM mips.

    AI-assisted. I ran the measurements on the hardware listed above.

  4. lukaslw-lab commented on Nov 23, 2026

    @lukaslw-lab
    Contributor

    Thanks @stan495, the Radeon run narrows down what #816 left open.

    Clamp (MIN_MAG_POINT_MIP_LINEAR) RTX 3080 Ti RX 7900 XTX WARP 1.0.22 and in-box 10.0.26100.9818
    1.25 0.7499962 / 0.2500038 0.75 / 0.25 0.75 / 0.25
    1.3 0.7031205 / 0.2968795 0.69921875 / 0.30078125 0.69921875 / 0.30078125
    • Of the adapters measured so far, only the RTX 3080 Ti lands on 76/256 at 1.3 and carries the offset of up to 7.6e-6. The Radeon matched WARP bit for bit at all nine linear-mip clamps.
    • Your full readback also covers a gap in shader: measure MinLod mip selection and blending against an HLSL control #816, which reported only pixel (0, 0): all 64 pixels were bit-identical between the translated shader and the HLSL control on both of your backends.
    • Every adapter stays within the 1/128 tolerance, so the test needs no change.

    AI-assisted (Claude Code).

  5. R0Y00 commented on Nov 23, 2026

    @R0Y00
    OwnerAuthor

    The plain Sample fixture has landed in #816 (6cd0f15). Thanks @stan495 for checking every pixel on Radeon and in-box WARP. The different linear-mip values are useful evidence of adapter behavior in this fixture. For the next run, keep the same texture and sampler and sweep both sides of the half step between blue weights 76/256 and 77/256. Capture the raw channel words on the same adapter for both the SPIR-V translation and direct HLSL. That would distinguish rounding from truncation more clearly than the single 1.3 measurement. The twelve archive differences remain open pending equivalent sampler and coordinate evidence.

  6. lukaslw-lab commented on Nov 23, 2026

    @lukaslw-lab
    Contributor

    The half-step sweep distinguishes the two: WARP 1.0.22 rounds the blend weight to the nearest 1/256 (ties to even), and the RTX 3080 Ti truncates it. Just above 76.5/256, WARP switches to 77/256, while the RTX stays at 76/256 up to 76.99976/256.

    Setup: the #816 fixture at 6cd0f15, with the same texture, sampler (MIN_MAG_POINT_MIP_LINEAR) and tools as #816. Blue weight from 76/256 to 77/256 in 1/4096 steps, plus points just around 76.5/256 and ties at 75.5/256 and 77.5/256. Raw RGBA words of all 64 pixels, for both the SPIR-V translation and the direct HLSL control.

    Blue weight × 256 WARP 1.0.22 RTX 3080 Ti (32.0.16.1047)
    75.5 (tie) 76 (3e980000) 75 (3e960096)
    76.0 to 76.49976 76 (3e980000) 76 (3e980098)
    76.5 (tie) 76 (3e980000) 76 (3e980098)
    76.50024 to 76.99976 77 (3e9a0000) 76 (3e980098)
    77.0 77 (3e9a0000) 77 (3e9a009a)
    77.5 (tie) 78 (3e9c0000) 77 (3e9a009a)
    • The ties at 75.5, 76.5 and 77.5 give 76, 76 and 78 on WARP, which is ties to even.
    • On the RTX, the blue word for step k is exactly k·256/65535 and green is 1 − blue. That accounts for the offset of up to 7.6e-6 reported in shader: measure MinLod mip selection and blending against an HLSL control #816.
    • At every point, all 64 pixels were identical, and the translation matched the HLSL control bit for bit on each adapter.

    Windows 10 build 19045, Agility SDK 1.620.2, DXC 1.9.2609, debug layer on.

    AI-assisted (Claude Code).

  7. R0Y00 commented on Nov 23, 2026

    @R0Y00
    OwnerAuthor

    The three tie cases distinguish ties-to-even from half-up on WARP 1.0.22, and the samples just above 76.5/256 distinguish nearest from the RTX 3080 Ti result. This closes the rounding question for those builds and this source-built plain Sample case. The next useful independent sweep is on the RX 7900 XTX and in-box WARP, which matched at the original nine clamps. The twelve archive differences still need matching sampler and coordinate evidence.

  8. R0Y00 commented on Nov 23, 2026

    @R0Y00
    OwnerAuthor

    #824 adds the SM 6.0 smoke path for Sample, SampleBias with offset and SampleGrad. Its Windows 10 in-box WARP probe also saw point-filtered Sample at clamp 1.5625 read mip 1 in both translated and direct HLSL, while explicit SampleLevel read mip 2. The detailed level/blend fixture remains at SM 6.6. For each independent sweep, please record the runtime and shader model alongside the adapter and sampler so the two point-selection behaviors can be compared on the same inputs.

  9. lukaslw-lab commented on Nov 23, 2026

    @lukaslw-lab
    Contributor

    Runtime and shader-model check for #824's point-selection difference, on the #816 four-mip fixture (MIN_MAG_MIP_POINT) at 929e659:

    • Windows 10 build 19045 in-box runtime with in-box WARP 10.0.19041.7811 (SM 6.0) drops the fraction of a MinLod clamp: 0.5625, 1.5, 1.5625, 1.75 and 2.5625 read mips 0, 1, 1, 1 and 2. SampleLevel with the same values reads the nearest mip (1, 2, 2, 2, 3).
    • The RTX 3080 Ti (32.0.16.1047) on the same in-box runtime reads the nearest mip for both, as do WARP 1.0.22 and the RTX under Agility SDK 1.620.2 at both SM 6.0 and SM 6.6. The difference follows the in-box WARP build, not the runtime or shader model.
    • The SPIR-V translation and the direct HLSL control agreed in every case.

    For the record, my earlier half-step sweep ran at SM 6.6 (ps_6_6) under Agility SDK 1.620.2 with MIN_MAG_POINT_MIP_LINEAR.

    AI-assisted (Claude Code).

  10. R0Y00 commented on Nov 23, 2026

    @R0Y00
    OwnerAuthor

    Thanks for rerunning the same point-filtered fixture across the two WARP builds and adding the direct HLSL control. Please capture the table in a focused docs PR: list the clamp values and observed mips, the WARP build/runtime and shader model, and keep the mip-linear half-step sweep separate. The result documents a difference between the tested WARP builds. Since translated and direct HLSL agreed, keep the current translator and comparison rules. An independent AMD or Intel result on the same fixture is still welcome.

  11. R0Y00 commented on Nov 23, 2026

    @R0Y00
    OwnerAuthor

    #852 records the point-filter selection table and the separate mip-linear half-step sweep. The translated and direct HLSL results agreed on every tested adapter and runtime. This issue remains open for the same five-clamp point sweep on AMD or Intel at SM 6.0, a Radeon half-step sweep, and evidence linking those measurements to the twelve archive cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions