Skip to content

Honor texel coordinates in explicit-LOD gathers - #8154

Open
gautch29 wants to merge 1 commit into
ItsNotRexed:mainfrom
gautch29:codex/gather-unorm
Open

gautch29 wants to merge 1 commit into
ItsNotRexed:mainfrom
gautch29:codex/gather-unorm

Conversation

@gautch29

Copy link
Copy Markdown

Coordination claim

Depends on: #7097, #4321 (overlap in the same lowering only). This branch is based on current main and applies independently.

What changed

The 2D explicit-LOD lowering for image_gather4_l and image_gather4_l_o always multiplied XY by the mip dimensions. RDNA2’s UNRM instruction bit already supplies texel coordinates. This patch uses those coordinates directly and preserves the existing half-texel bias, signed offsets, and sampler address modes.

The hand-written regression samples an 8 × 8 gradient and checks both UNRM forms, positive and negative offset components, and a normalized control.

Verification

  • Apple M3 Pro, macOS 27.0, MoltenVK 1.4.2, LLVM 23.1.6, SPIRV-Tools 1.4.363.0. The new fixture failed on main and matched all 4,096 pixels with this change. All five GPU gather cases passed.
  • Six assembled shader modules passed spirv-val. All 13 gather semantic tests passed.

Synthetic fixtures only. AI-assisted (Codex).

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.

1 participant