mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
mesa: add a pipe_draw_indirect_info* parameter into the DrawGallium callback
We need this to enable GL_SELECT and GL_FEEDBACK modes for indirect draws. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26786>
This commit is contained in:
parent
3ad1c3eb7c
commit
1b09fbd9aa
7 changed files with 21 additions and 17 deletions
|
|
@ -62,6 +62,7 @@ struct gl_vertex_array_object;
|
|||
struct ati_fragment_shader;
|
||||
struct util_queue_monitoring;
|
||||
struct pipe_draw_info;
|
||||
struct pipe_draw_indirect_info;
|
||||
struct pipe_draw_start_count_bias;
|
||||
struct pipe_vertex_state;
|
||||
struct pipe_draw_vertex_state_info;
|
||||
|
|
@ -145,8 +146,7 @@ struct dd_function_table {
|
|||
* Optimal Gallium version of Draw() that doesn't require translation
|
||||
* of draw info in the state tracker.
|
||||
*
|
||||
* The interface is identical to pipe_context::draw_vbo
|
||||
* with indirect == NULL.
|
||||
* The interface is identical to pipe_context::draw_vbo.
|
||||
*
|
||||
* "info" is not const and the following fields can be changed by
|
||||
* the callee, so callers should be aware:
|
||||
|
|
@ -158,6 +158,7 @@ struct dd_function_table {
|
|||
void (*DrawGallium)(struct gl_context *ctx,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws);
|
||||
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ _mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
|
|||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, ctx->DrawID, &draw, 1);
|
||||
ctx->Driver.DrawGallium(ctx, &info, ctx->DrawID, NULL, &draw, 1);
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
|
||||
_mesa_flush(ctx);
|
||||
|
|
@ -1507,7 +1507,7 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
|
|||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, 0, draw, primcount);
|
||||
ctx->Driver.DrawGallium(ctx, &info, 0, NULL, draw, primcount);
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
|
||||
_mesa_flush(ctx);
|
||||
|
|
@ -1679,7 +1679,7 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx,
|
|||
if (!validate_index_bounds(ctx, &info, &draw, 1))
|
||||
return;
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, ctx->DrawID, &draw, 1);
|
||||
ctx->Driver.DrawGallium(ctx, &info, ctx->DrawID, NULL, &draw, 1);
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
|
||||
_mesa_flush(ctx);
|
||||
|
|
@ -2063,7 +2063,7 @@ _mesa_validated_multidrawelements(struct gl_context *ctx,
|
|||
if (!validate_index_bounds(ctx, &info, draw, primcount))
|
||||
return;
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, 0, draw, primcount);
|
||||
ctx->Driver.DrawGallium(ctx, &info, 0, NULL, draw, primcount);
|
||||
} else {
|
||||
/* draw[i].start would overflow. Draw one at a time. */
|
||||
assert(info.has_user_indices);
|
||||
|
|
@ -2087,7 +2087,7 @@ _mesa_validated_multidrawelements(struct gl_context *ctx,
|
|||
if (!draw.count || !validate_index_bounds(ctx, &info, &draw, 1))
|
||||
continue;
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, i, &draw, 1);
|
||||
ctx->Driver.DrawGallium(ctx, &info, i, NULL, &draw, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2416,7 +2416,7 @@ _mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
|
|||
if (!draw.count)
|
||||
continue;
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, i, &draw, 1);
|
||||
ctx->Driver.DrawGallium(ctx, &info, i, NULL, &draw, 1);
|
||||
ptr += stride;
|
||||
}
|
||||
|
||||
|
|
@ -2532,7 +2532,7 @@ _mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
|
|||
if (!draw.count || !validate_index_bounds(ctx, &info, &draw, 1))
|
||||
continue;
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, i, &draw, 1);
|
||||
ctx->Driver.DrawGallium(ctx, &info, i, NULL, &draw, 1);
|
||||
ptr += stride;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
|||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
st_feedback_draw_vbo(ctx, &rs->info, 0, &rs->draw, 1);
|
||||
st_feedback_draw_vbo(ctx, &rs->info, 0, NULL, &rs->draw, 1);
|
||||
|
||||
_mesa_restore_draw_vao(ctx, old_vao, old_vp_input_filter);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,12 +115,13 @@ static void
|
|||
st_draw_gallium(struct gl_context *ctx,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
||||
cso_draw_vbo(st->cso_context, info, drawid_offset, NULL, draws, num_draws);
|
||||
cso_draw_vbo(st->cso_context, info, drawid_offset, indirect, draws, num_draws);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -439,6 +440,7 @@ static void
|
|||
st_hw_select_draw_gallium(struct gl_context *ctx,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws)
|
||||
{
|
||||
|
|
@ -447,7 +449,7 @@ st_hw_select_draw_gallium(struct gl_context *ctx,
|
|||
|
||||
if (st_draw_hw_select_prepare_common(ctx) &&
|
||||
st_draw_hw_select_prepare_mode(ctx, info)) {
|
||||
cso_draw_vbo(st->cso_context, info, drawid_offset, NULL, draws,
|
||||
cso_draw_vbo(st->cso_context, info, drawid_offset, indirect, draws,
|
||||
num_draws);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ void
|
|||
st_feedback_draw_vbo(struct gl_context *ctx,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws);
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ void
|
|||
st_feedback_draw_vbo(struct gl_context *ctx,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws)
|
||||
{
|
||||
|
|
@ -386,8 +387,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
|
|||
|
||||
/* draw here */
|
||||
for (i = 0; i < num_draws; i++) {
|
||||
/* TODO: indirect draws */
|
||||
draw_vbo(draw, info, info->increment_draw_id ? i : 0, NULL,
|
||||
draw_vbo(draw, info, info->increment_draw_id ? i : 0, indirect,
|
||||
&draws[i], 1, ctx->TessCtrlProgram.patch_vertices);
|
||||
}
|
||||
|
||||
|
|
@ -469,6 +469,6 @@ st_feedback_draw_vbo_multi_mode(struct gl_context *ctx,
|
|||
{
|
||||
for (unsigned i = 0; i < num_draws; i++) {
|
||||
info->mode = mode[i];
|
||||
st_feedback_draw_vbo(ctx, info, 0, &draws[i], 1);
|
||||
st_feedback_draw_vbo(ctx, info, 0, NULL, &draws[i], 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -359,9 +359,9 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data, bool copy_to_c
|
|||
node->modes,
|
||||
node->num_draws);
|
||||
} else if (node->num_draws == 1) {
|
||||
ctx->Driver.DrawGallium(ctx, info, 0, &node->start_count, 1);
|
||||
ctx->Driver.DrawGallium(ctx, info, 0, NULL, &node->start_count, 1);
|
||||
} else if (node->num_draws) {
|
||||
ctx->Driver.DrawGallium(ctx, info, 0, node->start_counts,
|
||||
ctx->Driver.DrawGallium(ctx, info, 0, NULL, node->start_counts,
|
||||
node->num_draws);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue