tu: Use safe-const GS variant for VPC binning state

When binning with a GS, both VS and GS are active. This means that we
could have to use the safe-const variant for the GS. However we only
emitted VPC state for the binning case with the "normal" GS variant.
Emit the VPC state with the safe-const variant too, and select between
the state variants at link time.

This fixes a few tests like
dEQP-VK.spirv_assembly.instruction.graphics.8bit_storage.32struct_to_8struct.uniform_uint_geom
with TU_DEBUG=gmem,forcebin.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35294>
This commit is contained in:
Connor Abbott
2025-06-02 14:02:30 -04:00
committed by Marge Bot
parent 946bbd8b2f
commit 723a1fabac
3 changed files with 10 additions and 0 deletions

View File

@@ -2289,6 +2289,8 @@ tu_emit_program_state(struct tu_cs *sub_cs,
prog->ds_state = draw_states[MESA_SHADER_TESS_EVAL];
prog->gs_state = draw_states[MESA_SHADER_GEOMETRY];
prog->gs_binning_state =
(safe_variants & (1u << MESA_SHADER_GEOMETRY)) ?
shaders[MESA_SHADER_GEOMETRY]->safe_const_binning_state :
shaders[MESA_SHADER_GEOMETRY]->binning_state;
prog->fs_state = draw_states[MESA_SHADER_FRAGMENT];

View File

@@ -2373,6 +2373,13 @@ tu_upload_shader(struct tu_device *dev,
tu_cs_begin_sub_stream(&shader->cs, vpc_size, &sub_cs);
TU_CALLX(dev, tu6_emit_vpc)(&sub_cs, NULL, NULL, NULL, v, NULL);
shader->binning_state = tu_cs_end_draw_state(&shader->cs, &sub_cs);
if (safe_const) {
tu_cs_begin_sub_stream(&shader->cs, vpc_size, &sub_cs);
TU_CALLX(dev, tu6_emit_vpc)(&sub_cs, NULL, NULL, NULL, safe_const, NULL);
shader->safe_const_binning_state =
tu_cs_end_draw_state(&shader->cs, &sub_cs);
}
}
return VK_SUCCESS;

View File

@@ -69,6 +69,7 @@ struct tu_shader
struct tu_draw_state state;
struct tu_draw_state safe_const_state;
struct tu_draw_state binning_state;
struct tu_draw_state safe_const_binning_state;
struct tu_const_state const_state;
uint32_t view_mask;