Repository navigation
Conversation
|
Review (head dd7a190, diff read, not a merge-check: CI is red (the
Fine: the AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
bmjask
left a comment
There was a problem hiding this comment.
Review of dd7a190a: 1 finding(s). These are on lines outside the diff:
crates/xcl/src/gpu/recomp/emit.rs:2807: In the function this touches, the mip used to scale texel offsets for implicit-LOD _o samples is round(CalculateLevelOfDetail(coord0)), which ignores the instruction's bias (sample_b_o) and LOD clamp (sample_cl_o). A PS image_sample_b_o with bias +2 and a computed LOD of 0 samples about mip 2 through SampleBias, but texel_offset divides the offset by mip 0's width, so it moves 1/4 texel instead of 1 and differs from the console. The same applies when cl is above the computed LOD.
These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
What changed
Fixed HLSL
CalculateLevelOfDetail/CalculateLevelOfDetailUnclampedcoordinate arguments for array textures (DIM 4Texture1DArrayandDIM 5Texture2DArray) incrates/xcl/src/gpu/recomp/emit.rs:lod_coord(dim, c)returning spatial-only coordinates (floatfor1D/1DArray,float2for2D/2DArray,float3for3D, andcube_dir(...)forCubeArray), omitting the array slice index.lod_coordforcoord0(used byCalculateLevelOfDetailon implicit-LODimage_sample_*_o) and inimage_get_lod(for bothCalculateLevelOfDetailandCalculateLevelOfDetailUnclamped), matching the direct DXIL path (crates/xcl/src/gpu/dxil/lower_image.rs).gpu::recomp::tests::ps_array_texture_calculate_lod_uses_spatial_coordsincrates/xcl/src/gpu/recomp/tests.rsverifying HLSL codegen, DXCps_6_6compilation, and GPU pixel-shader draws forIMAGE_GET_LODand implicit-LODIMAGE_SAMPLE_Oon bothTexture1DArrayandTexture2DArray.Why
In HLSL,
Texture1DArray::CalculateLevelOfDetail(Unclamped)takes afloatlocation andTexture2DArray::CalculateLevelOfDetail(Unclamped)takes afloat2location (array slices do not participate in derivative/LOD calculation). Previouslyemit.rspassedfloat2(u, round(slice))forTexture1DArrayandfloat3(u, v, round(slice))forTexture2DArrayin bothimage_get_lodandcoord0, causing a DXC compilation error for any pixel shader usingimage_get_lodor implicit-LODimage_sample_*_oon 1D/2D array textures.Tested
cargo check --workspace --all-targets: 0 errors, 0 new warnings.cargo test -p xcl --lib -- ps_array_texture_calculate_lod_uses_spatial_coords gpu_ps_image_sample_offset_implicit_lod_between_mips ps_get_lod_with_a_static_sampler) on NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1074, Windows 11 Pro Build 26200, DXC 1.9.2609.5): 3 passed, 0 failed, 0 ignored (0.42 s).cargo test --workspace -- --test-threads=4,XCL_DXC_DIRset to DXC 1.9.2609.5) on NVIDIA GeForce RTX 5070 Ti: exit 0 (96.4 s).dd7a190a7fa373eb7c94f84410b7107fc8130f46, 0 minidumps, 0 display events):main150 s baseline smoke run (f0e8fdd5c3942ddd399d5ee11384c8595c5aacff):Not tested
XCL_DIRECT_DXIL=none); the smoke run usedXCL_DIRECT_DXIL=all.AI use
Implemented and verified with Antigravity (Gemini) assistance; all changes, generated HLSL, DXC compilation, and real-GPU test/smoke results were directly reviewed and run on local hardware.