From 0f8d07d355f710c61f4da436b0dd1d8cb28553ef Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 20 Dec 2024 15:09:06 +0100 Subject: [PATCH] radv: add support for VK_PRIMITIVE_TOPOLOGY_META_RECT_LIST_MESA Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 2 +- src/amd/vulkan/radv_pipeline_graphics.c | 7 ++++--- src/amd/vulkan/radv_pipeline_graphics.h | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 2bf371ef189..de2938d006d 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -11007,7 +11007,7 @@ radv_bind_graphics_shaders(struct radv_cmd_buffer *cmd_buffer) if (cmd_buffer->state.active_stages & (VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_GEOMETRY_BIT | VK_SHADER_STAGE_MESH_BIT_EXT)) { - cmd_buffer->state.rast_prim = radv_get_vgt_gs_out(cmd_buffer->state.shaders, 0); + cmd_buffer->state.rast_prim = radv_get_vgt_gs_out(cmd_buffer->state.shaders, 0, false); } const struct radv_shader *vs = radv_get_shader(cmd_buffer->state.shaders, MESA_SHADER_VERTEX); diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 52feafb510b..ba29d88ffd0 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -3241,7 +3241,7 @@ radv_pipeline_init_shader_stages_state(const struct radv_device *device, struct } uint32_t -radv_get_vgt_gs_out(struct radv_shader **shaders, uint32_t primitive_topology) +radv_get_vgt_gs_out(struct radv_shader **shaders, uint32_t primitive_topology, bool is_ngg) { uint32_t gs_out; @@ -3256,7 +3256,7 @@ radv_get_vgt_gs_out(struct radv_shader **shaders, uint32_t primitive_topology) } else if (shaders[MESA_SHADER_MESH]) { gs_out = radv_conv_gl_prim_to_gs_out(shaders[MESA_SHADER_MESH]->info.ms.output_prim); } else { - gs_out = radv_conv_prim_to_gs_out(primitive_topology, false); + gs_out = radv_conv_prim_to_gs_out(primitive_topology, is_ngg); } return gs_out; @@ -3265,12 +3265,13 @@ radv_get_vgt_gs_out(struct radv_shader **shaders, uint32_t primitive_topology) static uint32_t radv_pipeline_init_vgt_gs_out(struct radv_graphics_pipeline *pipeline, const struct vk_graphics_pipeline_state *state) { + const bool is_ngg = pipeline->base.shaders[pipeline->last_vgt_api_stage]->info.is_ngg; uint32_t primitive_topology = 0; if (pipeline->last_vgt_api_stage == MESA_SHADER_VERTEX) primitive_topology = radv_translate_prim(state->ia->primitive_topology); - return radv_get_vgt_gs_out(pipeline->base.shaders, primitive_topology); + return radv_get_vgt_gs_out(pipeline->base.shaders, primitive_topology, is_ngg); } static void diff --git a/src/amd/vulkan/radv_pipeline_graphics.h b/src/amd/vulkan/radv_pipeline_graphics.h index 1b6b80093e5..c7219aed796 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.h +++ b/src/amd/vulkan/radv_pipeline_graphics.h @@ -18,6 +18,7 @@ #include "radv_shader.h" #include "vk_graphics_state.h" +#include "vk_meta.h" struct radv_sample_locations_state { VkSampleCountFlagBits per_pixel; @@ -237,6 +238,8 @@ radv_translate_prim(unsigned topology) return V_008958_DI_PT_TRISTRIP_ADJ; case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST: return V_008958_DI_PT_PATCH; + case VK_PRIMITIVE_TOPOLOGY_META_RECT_LIST_MESA: + return V_008958_DI_PT_RECTLIST; default: unreachable("unhandled primitive type"); } @@ -613,7 +616,7 @@ struct radv_vgt_shader_key { struct radv_vgt_shader_key radv_get_vgt_shader_key(const struct radv_device *device, struct radv_shader **shaders, const struct radv_shader *gs_copy_shader); -uint32_t radv_get_vgt_gs_out(struct radv_shader **shaders, uint32_t primitive_topology); +uint32_t radv_get_vgt_gs_out(struct radv_shader **shaders, uint32_t primitive_topology, bool is_ngg); bool radv_needs_null_export_workaround(const struct radv_device *device, const struct radv_shader *ps, unsigned custom_blend_mode);