radv: flush the NGG query state when the argument is declared
When primitives generated query is used, the driver also needs to emulate counting for NGG VS/TES. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15639>
This commit is contained in:

committed by
Marge Bot

parent
fe57fe1fd8
commit
f3daf7ce40
@@ -3671,24 +3671,27 @@ static void
|
||||
radv_flush_ngg_query_state(struct radv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
struct radv_graphics_pipeline *pipeline = cmd_buffer->state.graphics_pipeline;
|
||||
const unsigned stage = pipeline->last_vgt_api_stage;
|
||||
struct radv_userdata_info *loc;
|
||||
uint32_t ngg_query_state = 0;
|
||||
uint32_t base_reg;
|
||||
|
||||
if (!radv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY) || !pipeline->is_ngg)
|
||||
loc = radv_lookup_user_sgpr(&pipeline->base, stage, AC_UD_NGG_QUERY_STATE);
|
||||
if (loc->sgpr_idx == -1)
|
||||
return;
|
||||
|
||||
/* By default NGG GS queries are disabled but they are enabled if the
|
||||
* command buffer has active GDS queries or if it's a secondary command
|
||||
* buffer that inherits the number of generated primitives.
|
||||
assert(pipeline->is_ngg);
|
||||
|
||||
/* By default NGG queries are disabled but they are enabled if the command buffer has active GDS
|
||||
* queries or if it's a secondary command buffer that inherits the number of generated
|
||||
* primitives.
|
||||
*/
|
||||
if (cmd_buffer->state.active_pipeline_gds_queries ||
|
||||
(cmd_buffer->state.inherited_pipeline_statistics &
|
||||
VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT))
|
||||
ngg_query_state = 1;
|
||||
|
||||
loc = radv_lookup_user_sgpr(&pipeline->base, MESA_SHADER_GEOMETRY, AC_UD_NGG_QUERY_STATE);
|
||||
base_reg = pipeline->base.user_data_0[MESA_SHADER_GEOMETRY];
|
||||
base_reg = pipeline->base.user_data_0[stage];
|
||||
assert(loc->sgpr_idx != -1);
|
||||
|
||||
radeon_set_sh_reg(cmd_buffer->cs, base_reg + loc->sgpr_idx * 4, ngg_query_state);
|
||||
|
Reference in New Issue
Block a user