Mesa (main): radv: flush the NGG query state when the argument is declared
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 9 08:50:09 UTC 2022
Module: Mesa
Branch: main
Commit: f3daf7ce4023a54f666ae3d1fef40487c6e29da3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3daf7ce4023a54f666ae3d1fef40487c6e29da3
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Fri May 27 13:51:39 2022 +0200
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 at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15639>
---
src/amd/vulkan/radv_cmd_buffer.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 68e6cf79f61..51c6bfdc1ec 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -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);
More information about the mesa-commit
mailing list