gallium/ddebug: implement pipe_vertex_state callbacks

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15964>
This commit is contained in:
Marek Olšák 2022-04-10 22:38:02 -04:00 committed by Marge Bot
parent f29706a25f
commit 69e3f35435
2 changed files with 66 additions and 0 deletions

View file

@ -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);
}

View file

@ -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