tu: Don't read .patch_input_gmem of unused attachment

There was duplicated code to set unscaled_input_fragcoord and a read
from VK_ATTACHMENT_UNUSED attachment, which incorrectly updated
builder->unscaled_input_fragcoord.

ubsan:
 tu_pipeline.cc:4734:44: runtime error: load of value 127, which is not a valid value for type 'bool'

Seen in:
 dEQP-VK.renderpasses.renderpass1.custom_resolve.monolithic.stencil_only_s8

Fixes: 97da0a7734 ("tu: Rewrite to use common Vulkan dynamic state")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
(cherry picked from commit 81a76be861)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
Danylo Piliaiev 2026-03-06 14:57:56 +01:00 committed by Eric Engestrom
parent ace5f6c88d
commit 4a4a86390b
2 changed files with 3 additions and 10 deletions

View file

@ -1774,7 +1774,7 @@
"description": "tu: Don't read .patch_input_gmem of unused attachment",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "97da0a7734188f4b666bc38833bfadc8b4c53f84",
"notes": null

View file

@ -4678,14 +4678,6 @@ tu_pipeline_builder_init_graphics(
tu_fill_render_pass_state(&rp_state, pass, subpass);
for (unsigned i = 0; i < subpass->input_count; i++) {
/* Input attachments stored in GMEM must be loaded with unscaled
* FragCoord.
*/
if (subpass->input_attachments[i].patch_input_gmem)
builder->unscaled_input_fragcoord |= 1u << i;
}
if (subpass->feedback_loop_color) {
rp_flags |=
VK_PIPELINE_CREATE_2_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT;
@ -4716,7 +4708,8 @@ tu_pipeline_builder_init_graphics(
/* Input attachments stored in GMEM must be loaded with unscaled
* FragCoord.
*/
if (subpass->input_attachments[i].patch_input_gmem)
if (subpass->input_attachments[i].attachment != VK_ATTACHMENT_UNUSED &&
subpass->input_attachments[i].patch_input_gmem)
builder->unscaled_input_fragcoord |= 1u << i;
}