From db4673ee72339d46b1843b3239b8f7b9c3c66b68 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 19 Jan 2024 16:47:48 +0100 Subject: [PATCH] radv: add a per-stage key field for mesh shaders with a task shader This is to match VK_SHADER_CREATE_NO_TASK_SHADER_BIT_EXT. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_graphics.c | 3 +++ src/amd/vulkan/radv_shader.h | 3 +++ src/amd/vulkan/radv_shader_info.c | 11 ++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index dd2558d5089..53f17e64d79 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -1977,6 +1977,9 @@ radv_generate_graphics_pipeline_key(const struct radv_device *device, const stru gl_shader_stage s = vk_to_mesa_shader_stage(stage->stage); key.stage_info[s] = radv_pipeline_get_shader_key(device, stage, pipeline->base.create_flags, pCreateInfo->pNext); + + if (s == MESA_SHADER_MESH && (pipeline->active_stages & VK_SHADER_STAGE_TASK_BIT_EXT)) + key.stage_info[s].has_task_shader = true; } return key; diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index aa6f30395cd..e9a37e249a3 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -98,6 +98,9 @@ struct radv_shader_stage_key { /* Shader version (up to 8) to force re-compilation when RADV_BUILD_ID_OVERRIDE is enabled. */ uint8_t version : 3; + + /* Whether the mesh shader is used with a task shader. */ + uint8_t has_task_shader : 1; }; struct radv_ps_epilog_key { diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index f9a1908171c..e4edf92db2f 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -681,7 +681,8 @@ gather_shader_info_gs(struct radv_device *device, const nir_shader *nir, struct } static void -gather_shader_info_mesh(struct radv_device *device, const nir_shader *nir, struct radv_shader_info *info) +gather_shader_info_mesh(struct radv_device *device, const nir_shader *nir, + const struct radv_shader_stage_key *stage_key, struct radv_shader_info *info) { struct gfx10_ngg_info *ngg_info = &info->ngg_info; @@ -722,6 +723,7 @@ gather_shader_info_mesh(struct radv_device *device, const nir_shader *nir, struc ngg_info->vgt_esgs_ring_itemsize = 1; info->ms.has_query = device->cache_key.mesh_shader_queries; + info->ms.has_task = stage_key->has_task_shader; } static void @@ -1213,7 +1215,7 @@ radv_nir_shader_info_pass(struct radv_device *device, const struct nir_shader *n gather_shader_info_vs(device, nir, gfx_state, stage_key, info); break; case MESA_SHADER_MESH: - gather_shader_info_mesh(device, nir, info); + gather_shader_info_mesh(device, nir, stage_key, info); break; default: if (gl_shader_stage_is_rt(nir->info.stage)) @@ -1671,11 +1673,6 @@ radv_link_shaders_info(struct radv_device *device, struct radv_shader_stage *pro if (!gfx_state->dynamic_patch_control_points) tes_stage->info.num_tess_patches = tcs_stage->info.num_tess_patches; } - - /* Task/mesh I/O uses the task ring buffers. */ - if (producer->stage == MESA_SHADER_TASK) { - consumer->info.ms.has_task = true; - } } static void