Mesa (main): radv: only dirty line stipple when necessary.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 11 05:58:11 UTC 2022


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon May  9 16:16:08 2022 +1000

radv: only dirty line stipple when necessary.

Line stipple only cares if things changes to/from line strip.

Reduces overheads seen running pixmark volplosion with zink.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16393>

---

 src/amd/vulkan/radv_cmd_buffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 6ba076020cd..2f569437f09 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -3067,8 +3067,7 @@ radv_cmd_buffer_flush_dynamic_state(struct radv_cmd_buffer *cmd_buffer, bool pip
    if (states & RADV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)
       radv_emit_sample_locations(cmd_buffer);
 
-   if (states & (RADV_CMD_DIRTY_DYNAMIC_LINE_STIPPLE |
-                 RADV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY))
+   if (states & (RADV_CMD_DIRTY_DYNAMIC_LINE_STIPPLE))
       radv_emit_line_stipple(cmd_buffer);
 
    if (states & (RADV_CMD_DIRTY_DYNAMIC_CULL_MODE | RADV_CMD_DIRTY_DYNAMIC_FRONT_FACE |
@@ -5421,7 +5420,11 @@ radv_CmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology
    RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
    struct radv_cmd_state *state = &cmd_buffer->state;
    unsigned primitive_topology = si_translate_prim(primitiveTopology);
+   bool old_is_linestrip = (state->dynamic.primitive_topology == V_008958_DI_PT_LINESTRIP);
+   bool new_is_linestrip = (primitive_topology == V_008958_DI_PT_LINESTRIP);
 
+   if (old_is_linestrip != new_is_linestrip)
+      state->dirty |= RADV_CMD_DIRTY_DYNAMIC_LINE_STIPPLE;
    state->dynamic.primitive_topology = primitive_topology;
 
    state->dirty |= RADV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY;



More information about the mesa-commit mailing list