Module: Mesa
Branch: main
Commit: e88973fd027fd76b9baf968a267081281bfbcb15
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e88973fd027fd76b9baf968a267081281bfbcb15

Author: Samuel Pitoiset <[email protected]>
Date:   Thu Nov 30 17:49:19 2023 +0100

radv: change the reset stipple pattern mode for adjacent lines

Ported from RadeonSI. This isn't covered by VK CTS.

Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26429>

---

 src/amd/vulkan/radv_cmd_buffer.c | 6 +++---
 src/amd/vulkan/radv_private.h    | 6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 35651fb0e54..8f6dd0a4db9 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2215,7 +2215,7 @@ radv_emit_line_stipple(struct radv_cmd_buffer *cmd_buffer)
    const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic;
    uint32_t auto_reset_cntl = 2;
 
-   if (d->vk.ia.primitive_topology == V_008958_DI_PT_LINELIST)
+   if (radv_primitive_topology_is_line_list(d->vk.ia.primitive_topology))
       auto_reset_cntl = 1;
 
    radeon_set_context_reg(cmd_buffer->cs, R_028A0C_PA_SC_LINE_STIPPLE,
@@ -6810,8 +6810,8 @@ radv_CmdSetPrimitiveTopology(VkCommandBuffer 
commandBuffer, VkPrimitiveTopology
    struct radv_cmd_state *state = &cmd_buffer->state;
    unsigned primitive_topology = si_translate_prim(primitiveTopology);
 
-   if ((state->dynamic.vk.ia.primitive_topology == V_008958_DI_PT_LINELIST) !=
-       (primitive_topology == V_008958_DI_PT_LINELIST))
+   if 
(radv_primitive_topology_is_line_list(state->dynamic.vk.ia.primitive_topology) 
!=
+       radv_primitive_topology_is_line_list(primitive_topology))
       state->dirty |= RADV_CMD_DIRTY_DYNAMIC_LINE_STIPPLE;
 
    if (radv_prim_is_points_or_lines(state->dynamic.vk.ia.primitive_topology) !=
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 72477307b5e..0e35eaa5f0e 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -3389,6 +3389,12 @@ radv_polygon_mode_is_points_or_lines(unsigned 
polygon_mode)
    return radv_polygon_mode_is_point(polygon_mode) || 
radv_polygon_mode_is_line(polygon_mode);
 }
 
+static inline bool
+radv_primitive_topology_is_line_list(unsigned primitive_topology)
+{
+   return primitive_topology == V_008958_DI_PT_LINELIST || primitive_topology 
== V_008958_DI_PT_LINELIST_ADJ;
+}
+
 static inline unsigned
 radv_get_num_vertices_per_prim(const struct radv_pipeline_key *pipeline_key)
 {

Reply via email to