Mesa (main): gallium/ddebug: implement pipe_vertex_state callbacks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 20 22:46:25 UTC 2022


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Apr 10 22:38:02 2022 -0400

gallium/ddebug: implement pipe_vertex_state callbacks

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15964>

---

 src/gallium/auxiliary/driver_ddebug/dd_draw.c   | 32 +++++++++++++++++++++++
 src/gallium/auxiliary/driver_ddebug/dd_screen.c | 34 +++++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
index 4ada10049a0..6dd4a12fa7e 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
@@ -1345,6 +1345,37 @@ dd_context_draw_vbo(struct pipe_context *_pipe,
    dd_after_draw(dctx, record);
 }
 
+static void
+dd_context_draw_vertex_state(struct pipe_context *_pipe,
+                             struct pipe_vertex_state *state,
+                             uint32_t partial_velem_mask,
+                             struct pipe_draw_vertex_state_info info,
+                             const struct pipe_draw_start_count_bias *draws,
+                             unsigned num_draws)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+   struct dd_draw_record *record = dd_create_record(dctx);
+
+   record->call.type = CALL_DRAW_VBO;
+   memset(&record->call.info.draw_vbo.info, 0,
+          sizeof(record->call.info.draw_vbo.info));
+   record->call.info.draw_vbo.info.mode = info.mode;
+   record->call.info.draw_vbo.info.index_size = 4;
+   record->call.info.draw_vbo.info.instance_count = 1;
+   record->call.info.draw_vbo.drawid_offset = 0;
+   record->call.info.draw_vbo.draw = draws[0];
+   record->call.info.draw_vbo.info.index.resource = NULL;
+   pipe_resource_reference(&record->call.info.draw_vbo.info.index.resource,
+                           state->input.indexbuf);
+   memset(&record->call.info.draw_vbo.indirect, 0,
+          sizeof(record->call.info.draw_vbo.indirect));
+
+   dd_before_draw(dctx, record);
+   pipe->draw_vertex_state(pipe, state, partial_velem_mask, info, draws, num_draws);
+   dd_after_draw(dctx, record);
+}
+
 static void
 dd_context_launch_grid(struct pipe_context *_pipe,
                        const struct pipe_grid_info *info)
@@ -1825,4 +1856,5 @@ dd_init_draw_functions(struct dd_context *dctx)
    CTX_INIT(texture_unmap);
    CTX_INIT(buffer_subdata);
    CTX_INIT(texture_subdata);
+   CTX_INIT(draw_vertex_state);
 }
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
index 70b29350636..a4e56da95ac 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
@@ -401,6 +401,38 @@ dd_screen_fence_get_fd(struct pipe_screen *_screen,
    return screen->fence_get_fd(screen, fence);
 }
 
+/********************************************************************
+ * vertex state
+ */
+
+static struct pipe_vertex_state *
+dd_screen_create_vertex_state(struct pipe_screen *_screen,
+                              struct pipe_vertex_buffer *buffer,
+                              const struct pipe_vertex_element *elements,
+                              unsigned num_elements,
+                              struct pipe_resource *indexbuf,
+                              uint32_t full_velem_mask)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+   struct pipe_vertex_state *state =
+      screen->create_vertex_state(screen, buffer, elements, num_elements,
+                                  indexbuf, full_velem_mask);
+
+   if (!state)
+      return NULL;
+   state->screen = _screen;
+   return state;
+}
+
+static void
+dd_screen_vertex_state_destroy(struct pipe_screen *_screen,
+                               struct pipe_vertex_state *state)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+   screen->vertex_state_destroy(screen, state);
+}
+
 /********************************************************************
  * memobj
  */
@@ -623,6 +655,8 @@ ddebug_screen_create(struct pipe_screen *screen)
    SCR_INIT(get_device_uuid);
    SCR_INIT(finalize_nir);
    SCR_INIT(get_sparse_texture_virtual_page_size);
+   SCR_INIT(create_vertex_state);
+   SCR_INIT(vertex_state_destroy);
 
 #undef SCR_INIT
 



More information about the mesa-commit mailing list