ir3, tu: Use a UBO for VS primitive params on a750+

Before we were using direct CP_LOAD_STATE, which is broken with multiple
back-to-back draws. This caused regressions in some DX11 traces when
enabling early preamble. We still need to use indirect CP_LOAD_STATE for
VS params, which are sometimes written by the CP, however for everything
else we should use the new UBO path instead.

Fixes: 76e417ca59 ("turnip,ir3/a750: Implement consts loading via preamble")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30675>
This commit is contained in:
Connor Abbott 2024-08-15 07:42:11 -04:00 committed by Marge Bot
parent 4f2b5442a6
commit 850f2aab03
2 changed files with 9 additions and 4 deletions

View File

@ -14,9 +14,6 @@ lower_driver_param_to_ubo(nir_builder *b, nir_intrinsic_instr *intr, void *in)
{
struct ir3_const_state *const_state = in;
if (b->shader->info.stage == MESA_SHADER_VERTEX)
return false;
unsigned components = nir_intrinsic_dest_components(intr);
b->cursor = nir_before_instr(&intr->instr);
@ -52,6 +49,14 @@ lower_driver_param_to_ubo(nir_builder *b, nir_intrinsic_instr *intr, void *in)
result = ir3_load_driver_ubo(b, components,
&const_state->primitive_param_ubo, 6);
break;
/* These are still loaded using CP_LOAD_STATE for compatibility with indirect
* draws where the CP does a CP_LOAD_STATE for us internally:
*/
case nir_intrinsic_load_draw_id:
case nir_intrinsic_load_base_vertex:
case nir_intrinsic_load_first_vertex:
case nir_intrinsic_load_base_instance:
return false;
default: {
struct driver_param_info param_info;
if (!ir3_get_driver_param_info(b->shader, intr, &param_info))

View File

@ -615,7 +615,7 @@ tu6_emit_const(struct tu_cs *cs, uint32_t opcode, enum tu_geom_consts_type type,
assert(size % 4 == 0);
dwords = (uint32_t *)&((uint8_t *)dwords)[offset];
if (block == SB6_VS_SHADER || !cs->device->physical_device->info->a7xx.load_shader_consts_via_preamble) {
if (!cs->device->physical_device->info->a7xx.load_shader_consts_via_preamble) {
uint32_t base;
switch (type) {
case TU_CONSTS_PRIMITIVE_MAP: