tu: Use HW offset 0 in 3d loads/clears with FDM

The HW uses ViewportIndex to select which GRAS_BIN_FOVEAT offset to use.
For normal 3d draws, either the ViewportIndex equals the view/layer or
we make the offset the same for all viewports/layers, but we aren't
aware of this in the 3d path and we always use viewport 0.

Use the HW offset 0 when subtracting the HW offset. This is a bit of a
hack, but it should work. This fixes LOAD_OP_LOAD with FDM.

Fixes: b34b089ca1 ("tu: Use GRAS bin offset registers")
(cherry picked from commit 68c0031f56)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
Connor Abbott 2026-02-18 18:50:12 -05:00 committed by Eric Engestrom
parent 98ec831d58
commit 5840bf0b1b
2 changed files with 9 additions and 5 deletions

View file

@ -5264,7 +5264,7 @@
"description": "tu: Use HW offset 0 in 3d loads/clears with FDM",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "b34b089ca1327a5d48bc3cfceb9647c44763b52d",
"notes": null

View file

@ -4084,8 +4084,10 @@ fdm_apply_sysmem_clear_coords(struct tu_cmd_buffer *cmd,
VkExtent2D frag_area = frag_areas[MIN2(state->view, views - 1)];
VkRect2D bin = bins[MIN2(state->view, views - 1)];
VkOffset2D hw_viewport_offset =
hw_viewport_offsets[MIN2(state->view, views - 1)];
/* On a7xx, GRAS_BIN_FOVEAT_OFFSET_* is applied per-viewport. We only use
* viewport 0 in the 3d blit so use offset 0.
*/
VkOffset2D hw_viewport_offset = hw_viewport_offsets[0];
VkOffset2D offset = tu_fdm_per_bin_offset(frag_area, bin, common_bin_offset);
@ -5026,8 +5028,10 @@ fdm_apply_load_coords(struct tu_cmd_buffer *cmd,
(const struct apply_load_coords_state *)data;
VkExtent2D frag_area = frag_areas[MIN2(state->view, views - 1)];
VkRect2D bin = bins[MIN2(state->view, views - 1)];
VkOffset2D hw_viewport_offset =
hw_viewport_offsets[MIN2(state->view, views - 1)];
/* On a7xx, GRAS_BIN_FOVEAT_OFFSET_* is applied per-viewport. We only use
* viewport 0 in the 3d blit so use offset 0.
*/
VkOffset2D hw_viewport_offset = hw_viewport_offsets[0];
assert(bin.extent.width % frag_area.width == 0);
assert(bin.extent.height % frag_area.height == 0);