Repository navigation
Conversation
|
I reproduced a magnification edge case on native Windows 11 with an RTX 5070 (driver 32.0.16.1088) and DXC 1.9.2609.5. I applied I duplicated
Using Synthetic textures only. Rust 1.100.0, clang-cl/lld 19.1.1 with xwin SDK 10.0.26100. AI-assisted (Codex). |
fd45f20 to
a60db9f
Compare
|
Thanks @ryotdev, that was a real regression. Your case is now The new head 🤖 Claude Opus 5.5 |
|
Tested #247
|
|
Tested
The magnification case from the comment above ( Not checked: the negative control, or any game. AI-assisted (Claude Code). |
|
Tested on RTX 5060 Ti 8 GB, driver 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native), Rust 1.100.0 msvc, debug. Run and written with Claude Code (Claude Opus 5.5). |
|
Regression run wanted. We have no title on our machine. If you can run 🤖 Claude Opus 5.5 |
|
Tested PR #247 head Tested
Findings (synthetic probes reproduced identically on both RTX 4090 and AMD RDNA2)
Not tested
AI useAntigravity (Gemini frontier model) assisted with code review, dual-GPU synthetic probe execution, and drafting this report; every line cited and repro result was directly verified on this host. |
|
Tested Tested
Not tested
AI use
|
|
@Kalmarv the regression run you asked for, plus the first RDNA3 run. Tested
Regression run (retail title,
this PR's head Not tested
AI use
|
|
Re-tested Pass: 675 passed, 0 failed, 41 ignored. SKIPPED: only the 2 Run and written with Claude Code (Claude Opus 5.5). |
|
@srcamarda thank you, both blocks are in the description under Regression run, with your three-run spread and the note that the title's first menus don't reach an 🤖 Claude Opus 5.5 |
a60db9f to
287ca93
Compare
xcl-dev#229 picks the offset's mip for the plain form only; the bias, gradient and (in a PS) comparison forms still divided by mip 0's size. The level is now the given LOD, else that of the given gradients or the pixel's own (screen derivatives for comparison samplers, which CalculateLevelOfDetail does not take), plus the bias. That LOD is the unclamped one, so a bias on a magnified pixel starts below 0 (found by ryotdev); the sampler's MIN_LOD / MAX_LOD and the view's last mip are applied after the bias. The level follows what the view and the sampler are made of and the sample that is emitted (found by JGonzalezRodriguez): the sampler's LOD_BIAS is added to a LOD from gradients, as SampleGrad and SampleCmp add it; the lower clamp includes the T#'s MIN_LOD (the SRV's ResourceMinLODClamp); without a mip filter MAX_LOD is MIN_LOD, as desc::sampler_d3d12 sets the sampler up. A comparison sample is SampleCmpLevelZero outside a PS and SampleCmp, which takes neither gradients nor a bias, in a PS, so its offset moves by mip 0 there and by the pixel's own LOD here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
287ca93 to
227a60a
Compare
|
@JGonzalezRodriguez thank you, and sorry this took a day. I checked all five points against the code and on the GPU, and they all hold. They're fixed in
Tested (RTX 5070 Ti, NVIDIA 610.74, Ryzen 9 9950X, Windows 11 Pro 26200, debug, SDK DXC 1.7)
Not tested
AI use: Claude Code (Claude Opus 5.5) |
|
Retest of the new head Tested
The two review tests that pass with Not tested: Run and written with Claude Code (Claude Opus 5.5). |
|
CI checks ( Remaining before merge: an independent AMD GPU pass on the current revised head |
|
Thanks, @raylitebull. An AMD pass on the current head Please post the passed, failed and ignored counts, any SKIPPED lines, and your GPU, driver and DXC version. AI use: Claude Code (Claude Opus 5.5) wrote this. |
Follows #229. #229 moves the coordinates by offset / size of the mip the console reads, but it picks that mip only for the plain form (implicit LOD in a PS, or a given LOD). The bias, gradient and comparison forms still take mip 0's size. With a point mip filter, the texel read is then off by up to one texel of the mip actually sampled. This PR picks the mip for those forms too.
What main does today:
image_sample_b_o: in a PS, the implicit LOD without the bias; outside a PS, mip 0, though the sample isSampleLevel(bias).image_sample_d_o/cd_o: mip 0 whatever the gradients say.image_sample_c_oin a PS: mip 0, because the plain-form branch excludes comparison samplers.CalculateLevelOfDetailtakes noSamplerComparisonState; DXC rejects it.What is in it
One commit,
227a60a, onmain9e3831e:287ca93(ondd2ae9a) with @JGonzalezRodriguez's five review points fixed (the review points are marked below), then rebased onto9e3831ewithout conflicts (asc14bd12ondd2ae9ait is the same patch;git range-diff:=). The rebase is there because a whole-suite run ondd2ae9astops in the #344 deadlock, whose fix (#443) came later.287ca93wasa60db9f(on9ab7d76) rebased without conflicts and without a changed line.crates/xcl/src/gpu/recomp/emit.rs: the offset's level for these forms is:log2of the longer gradient in mip-0 texels), or in a PS the pixel's own LOD (CalculateLevelOfDetailUnclamped, or for comparison samplers the samelog2ofddx/ddyof the coordinates);CalculateLevelOfDetailUnclampedalready has it);descmakes the view and the sampler: from below by the larger of the S# MIN_LOD and the T#'s MIN_LOD (word 1 [19:8], the SRV'sResourceMinLODClamp; point 2), from above by MAX_LOD, which is MIN_LOD without a mip filter (S# word 2 [27:26] = 0; point 1); rounded, and clamped to the view's last mip.SampleCmpLevelZero), and in a PS the pixel's own LOD, becauseSampleCmptakes neither gradients nor a bias in SM 6.6. The level-0 size comes from a newmip_size, whichtexel_offsetalso calls (point 5).The LOD is unclamped before the bias, so a bias on a magnified pixel starts below 0. @ryotdev found that the first head (
fd45f20) got this wrong. The plain form, lz, gather and given-LOD forms take the same path as before.crates/xcl/src/gpu/recomp/tests.rs: nine new GPU tests on a 2-mip texture (8², 4²) with point min, mag and mip filters, so each pixel reads exactly one mip. Four of them are for the review:gpu_ps_image_sample_offset_without_a_mip_filter,…_resource_min_lod,…_sampler_bias, andgpu_image_sample_c_b_d_offset_moves_by_the_mip_read(PS and VS). The last one samples a checkerboard (one in each mip's own texels) at offsets 0 and +1. Moving by one texel of the mip that was read flips every pixel, so the test doesn't depend on which mip that is.Overlap with Recompiler: pixel comparison samples apply their LOD bias #349 and Recompiler: comparison samples use their supplied pixel gradients #350: they make the PS
SampleCmptake the bias and the gradients. In a tree with either of them and this PR, the matching line here (lod_biasfor Recompiler: pixel comparison samples apply their LOD bias #349,lod_gradsfor Recompiler: comparison samples use their supplied pixel gradients #350) has to take them too. The two lines are separate, so neither follow-up conflicts with the other.Tested
cargo test --workspace -- --test-threads=4on227a60a: 785 passed, 0 failed, 41 ignored (thexcllibrary: 736 passed, 21 ignored). SKIPPED:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64), andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows; main's own test).image_sample_offset, and the new comparison test) onc14bd12(the same patch ondd2ae9a): 11 passed. Withemit.rsfrom287ca93(the same tests), the four review tests fail and the other seven pass. Each of their 12 cases run on its own (a scratch test, not in the PR): 11 fail on287ca93, all 12 pass onc14bd12. The 12th,b_owith the sampler's LOD_BIAS, is a control and passes on both.cargo test --workspace -- --test-threads=4on287ca93: 695 passed, 0 failed, 41 ignored (thexcllibrary: 655 passed, 21 ignored). SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware, both "no wave64". The sixgpu_ps_image_sample_offsettests (this PR's five and Recompiler: image_sample_o under an implicit LOD moves each blended mip by its own texels #229's): 6 passed.a60db9f, onmain9ab7d76: 656 passed, 0 failed, 40 ignored, with the same two SKIPPED tests.mainwith and without theemit.rschange (the same test code in both):gpu_ps_image_sample_offset_point_mip(control, plainsample_o)gpu_ps_image_sample_offset_bias_lod(b_o, LOD 0 + bias 1)gpu_ps_image_sample_offset_bias_lod_magnified(b_o, LOD -1 + bias 1, @ryotdev's case)fd45f20: FAIL, (0,0) = 2, expected 1)gpu_ps_image_sample_offset_gradient_lod(d_oandcd_o, gradient LOD 1)cd_ofails the same way, 48 of 256 pixels)gpu_ps_image_sample_offset_compare_lod(c_o, implicit LOD 1, LESS_EQUAL)gpu_ps_image_sample_offset_implicit_lod_between_mips(#229's)gpu::recomp::on287ca93: 188 passed, 0 failed, 18 ignored (ona60db9f: 187 passed, 0 failed, 18 ignored).fd45f20, before the magnification fix, onmain9ab7d76with an RX 6600 XT (RDNA2).cargo test --workspace: main 651 passed, 0 failed; PR 655 passed, 0 failed. No GPU test was skipped, and the four new tests of that head passed.a60db9f:cargo test --workspace, 656 passed, 0 failed, 40 ignored, and the 5 new tests pass (Recompiler: image_sample_b/d/cd/c_o offsets move by the mip they read #247 (comment)).a60db9f:cargo test --workspace, 656 passed, 0 failed, 40 ignored (Recompiler: image_sample_b/d/cd/c_o offsets move by the mip they read #247 (comment)).a60db9fmerged ontomain2b4bb43, on an RTX 5060 Ti, debug, with the debug-layer tests enabled:cargo test --workspace, 675 passed, 0 failed, 41 ignored; the only SKIPPED tests are the two "no wave64" ones (Recompiler: image_sample_b/d/cd/c_o offsets move by the mip they read #247 (comment)).a60db9fmerged ontomain4017f8f(a clean merge) (Recompiler: image_sample_b/d/cd/c_o offsets move by the mip they read #247 (comment)):scripts/test.ps1: 657 passed, 0 failed, 40 ignored, with no SKIPPED GPU tests.tests.rs(noemit.rschange),…_bias_lod,…_gradient_lodand…_compare_lodfail;…_point_mipand…_bias_lod_magnifiedpass with and without the fix.main9ab7d76and this head:main901 / 1180 / 1184 frames, this PR 1168 / 1167 / 1357, no crash or device removal (Recompiler: image_sample_b/d/cd/c_o offsets move by the mip they read #247 (comment)). No_osample form appears in the title's first menus, so these runs and ours below are a regression check, not a test of the change.Regression run
scripts/smoke.ps1, the same retail title for 60 s each, one after the other on the machine under Tested (RTX 5070 Ti, NVIDIA 610.74), release builds, no uncommitted changes.main9e3831e:this PR's head
227a60a:PR vs
main: 1313 / 1274 frames (103 %), peak commit 27471 / 27459 MB (100 %); no device removal and no crash on either run.Not tested
image_sample_l_othe offset uses the given LOD before the sampler's bias and MIN/MAX_LOD, as on main. Sampler bias onimage_sample_b_ofollows it on NVIDIA 610.74 (measured); AMD not measured.gpu_ps_image_sample_offset_bias_lod_magnifiedand for the heada60db9f: the RX 6600 XT run above is offd45f20. RDNA4 rana60db9f(@nullmarsh, above).b_oandd_ooutside a pixel shader, 1D / 3D / array textures, A16 addresses, and a min-LOD clamp (_cl_) together with an offset.ResourceMinLODClampin the view's levels or the resource's.image_sample_c_l_oin a PS: the offset moves by the given LOD, whileSampleCmpreads the pixel's own, as on main.227a60a: the AMD runs above are of earlier heads.log2of the longer gradient, which can differ from the hardware's at a mip boundary. The plain form'sCalculateLevelOfDetailhas the same limit.AI use
dd2ae9aand its runs; Claude Code (Claude Opus 5.5), the fixes for @JGonzalezRodriguez's review, their tests and the runs onc14bd12and227a60a