Mesa (main): lavapipe: hook up some bits for handling dynamic line stipple state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 1 00:48:06 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun  7 19:26:30 2021 -0400

lavapipe: hook up some bits for handling dynamic line stipple state

this won't actually work, but it stubs out some (functional) placeholder
code for later code to build on

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11231>

---

 src/gallium/frontends/lavapipe/lvp_execute.c | 12 +++++++++---
 src/gallium/frontends/lavapipe/lvp_private.h |  4 ++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index 4a119c09f19..2b08c8d6d32 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -342,10 +342,12 @@ static int conv_dynamic_state_idx(VkDynamicState dyn_state)
 {
    if (dyn_state <= VK_DYNAMIC_STATE_STENCIL_REFERENCE)
       return dyn_state;
-
+   if (dyn_state == VK_DYNAMIC_STATE_LINE_STIPPLE_EXT)
+      /* this one has a weird id, map after the normal dynamic state ones */
+      return VK_DYNAMIC_STATE_STENCIL_REFERENCE + 1;
    if (dyn_state >= VK_DYNAMIC_STATE_CULL_MODE_EXT &&
        dyn_state <= VK_DYNAMIC_STATE_STENCIL_OP_EXT)
-      return dyn_state - VK_DYNAMIC_STATE_CULL_MODE_EXT + VK_DYNAMIC_STATE_STENCIL_REFERENCE + 1;
+      return dyn_state - VK_DYNAMIC_STATE_CULL_MODE_EXT + VK_DYNAMIC_STATE_STENCIL_REFERENCE + 2;
    assert(0);
    return -1;
 }
@@ -354,7 +356,7 @@ static void handle_graphics_pipeline(struct lvp_cmd_buffer_entry *cmd,
                                      struct rendering_state *state)
 {
    struct lvp_pipeline *pipeline = cmd->u.pipeline.pipeline;
-   bool dynamic_states[VK_DYNAMIC_STATE_STENCIL_REFERENCE+13];
+   bool dynamic_states[VK_DYNAMIC_STATE_STENCIL_REFERENCE+32];
    unsigned fb_samples = 0;
 
    memset(dynamic_states, 0, sizeof(dynamic_states));
@@ -438,6 +440,10 @@ static void handle_graphics_pipeline(struct lvp_cmd_buffer_entry *cmd,
 
       if (!dynamic_states[VK_DYNAMIC_STATE_LINE_WIDTH])
          state->rs_state.line_width = rsc->lineWidth;
+      if (!dynamic_states[conv_dynamic_state_idx(VK_DYNAMIC_STATE_LINE_STIPPLE_EXT)]) {
+         state->rs_state.line_stipple_factor = pipeline->line_stipple_factor;
+         state->rs_state.line_stipple_pattern = pipeline->line_stipple_pattern;
+      }
 
       if (!dynamic_states[VK_DYNAMIC_STATE_DEPTH_BIAS]) {
          state->rs_state.offset_units = rsc->depthBiasConstantFactor;
diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h
index e3aeab01cc0..c2b3cb9aa48 100644
--- a/src/gallium/frontends/lavapipe/lvp_private.h
+++ b/src/gallium/frontends/lavapipe/lvp_private.h
@@ -479,6 +479,10 @@ struct lvp_pipeline {
    void *shader_cso[PIPE_SHADER_TYPES];
    VkGraphicsPipelineCreateInfo graphics_create_info;
    VkComputePipelineCreateInfo compute_create_info;
+   uint32_t line_stipple_factor;
+   uint16_t line_stipple_pattern;
+   bool line_stipple_enable;
+   bool line_smooth;
    bool provoking_vertex_last;
 };
 



More information about the mesa-commit mailing list