cso: unify cso_draw_vbo and cso_multi_draw
This is going to be inlined. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20025>
This commit is contained in:
@@ -1741,10 +1741,11 @@ cso_restore_compute_state(struct cso_context *cso)
|
||||
|
||||
void
|
||||
cso_draw_vbo(struct cso_context *cso,
|
||||
const struct pipe_draw_info *info,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias draw)
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws)
|
||||
{
|
||||
/* We can't have both indirect drawing and SO-vertex-count drawing */
|
||||
assert(!indirect ||
|
||||
@@ -1756,29 +1757,15 @@ cso_draw_vbo(struct cso_context *cso,
|
||||
!indirect ||
|
||||
indirect->count_from_stream_output == NULL);
|
||||
|
||||
/* Indirect only uses indirect->draw_count, not num_draws. */
|
||||
assert(!indirect || num_draws == 1);
|
||||
|
||||
struct pipe_context *pipe = cso->pipe;
|
||||
|
||||
if (cso->vbuf_current) {
|
||||
u_vbuf_draw_vbo(pipe, info, drawid_offset, indirect, &draw, 1);
|
||||
u_vbuf_draw_vbo(pipe, info, drawid_offset, indirect, draws, num_draws);
|
||||
} else {
|
||||
pipe->draw_vbo(pipe, info, drawid_offset, indirect, &draw, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* info->draw_id can be changed by the callee if increment_draw_id is true. */
|
||||
void
|
||||
cso_multi_draw(struct cso_context *cso,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws)
|
||||
{
|
||||
struct pipe_context *pipe = cso->pipe;
|
||||
|
||||
if (cso->vbuf_current) {
|
||||
u_vbuf_draw_vbo(pipe, info, drawid_offset, NULL, draws, num_draws);
|
||||
} else {
|
||||
pipe->draw_vbo(pipe, info, drawid_offset, NULL, draws, num_draws);
|
||||
pipe->draw_vbo(pipe, info, drawid_offset, indirect, draws, num_draws);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1800,7 +1787,7 @@ cso_draw_arrays(struct cso_context *cso, uint mode, uint start, uint count)
|
||||
draw.count = count;
|
||||
draw.index_bias = 0;
|
||||
|
||||
cso_draw_vbo(cso, &info, 0, NULL, draw);
|
||||
cso_draw_vbo(cso, &info, 0, NULL, &draw, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1825,5 +1812,5 @@ cso_draw_arrays_instanced(struct cso_context *cso, uint mode,
|
||||
draw.count = count;
|
||||
draw.index_bias = 0;
|
||||
|
||||
cso_draw_vbo(cso, &info, 0, NULL, draw);
|
||||
cso_draw_vbo(cso, &info, 0, NULL, &draw, 1);
|
||||
}
|
||||
|
||||
@@ -211,18 +211,11 @@ cso_set_vertex_buffers_and_elements(struct cso_context *ctx,
|
||||
|
||||
void
|
||||
cso_draw_vbo(struct cso_context *cso,
|
||||
const struct pipe_draw_info *info,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
const struct pipe_draw_start_count_bias draw);
|
||||
|
||||
/* info->draw_id can be changed by the callee if increment_draw_id is true. */
|
||||
void
|
||||
cso_multi_draw(struct cso_context *cso,
|
||||
struct pipe_draw_info *info,
|
||||
unsigned drawid_offset,
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws);
|
||||
const struct pipe_draw_start_count_bias *draws,
|
||||
unsigned num_draws);
|
||||
|
||||
void
|
||||
cso_draw_arrays_instanced(struct cso_context *cso, uint mode,
|
||||
|
||||
@@ -170,7 +170,7 @@ st_draw_gallium(struct gl_context *ctx,
|
||||
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
|
||||
return;
|
||||
|
||||
cso_multi_draw(st->cso_context, info, drawid_offset, draws, num_draws);
|
||||
cso_draw_vbo(st->cso_context, info, drawid_offset, NULL, draws, num_draws);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -194,7 +194,7 @@ st_draw_gallium_multimode(struct gl_context *ctx,
|
||||
for (i = 0, first = 0; i <= num_draws; i++) {
|
||||
if (i == num_draws || mode[i] != mode[first]) {
|
||||
info->mode = mode[first];
|
||||
cso_multi_draw(cso, info, 0, &draws[first], i - first);
|
||||
cso_draw_vbo(cso, info, 0, NULL, &draws[first], i - first);
|
||||
first = i;
|
||||
|
||||
/* We can pass the reference only once. st_buffer_object keeps
|
||||
@@ -216,7 +216,7 @@ rewrite_partial_stride_indirect(struct st_context *st,
|
||||
if (!new_draws)
|
||||
return;
|
||||
for (unsigned i = 0; i < draw_count; i++)
|
||||
cso_draw_vbo(st->cso_context, &new_draws[i].info, i, NULL, new_draws[i].draw);
|
||||
cso_draw_vbo(st->cso_context, &new_draws[i].info, i, NULL, &new_draws[i].draw, 1);
|
||||
free(new_draws);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
assert(!indirect_draw_count);
|
||||
indirect.draw_count = 1;
|
||||
for (i = 0; i < draw_count; i++) {
|
||||
cso_draw_vbo(st->cso_context, &info, i, &indirect, draw);
|
||||
cso_draw_vbo(st->cso_context, &info, i, &indirect, &draw, 1);
|
||||
indirect.offset += stride;
|
||||
}
|
||||
} else {
|
||||
@@ -305,7 +305,7 @@ st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
indirect_draw_count->buffer;
|
||||
indirect.indirect_draw_count_offset = indirect_draw_count_offset;
|
||||
}
|
||||
cso_draw_vbo(st->cso_context, &info, 0, &indirect, draw);
|
||||
cso_draw_vbo(st->cso_context, &info, 0, &indirect, &draw, 1);
|
||||
}
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
|
||||
@@ -336,7 +336,7 @@ st_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
|
||||
if (indirect.count_from_stream_output == NULL)
|
||||
return;
|
||||
|
||||
cso_draw_vbo(st->cso_context, &info, 0, &indirect, draw);
|
||||
cso_draw_vbo(st->cso_context, &info, 0, &indirect, &draw, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -541,7 +541,7 @@ st_hw_select_draw_gallium(struct gl_context *ctx,
|
||||
!st_draw_hw_select_prepare_mode(ctx, info))
|
||||
return;
|
||||
|
||||
cso_multi_draw(st->cso_context, info, drawid_offset, draws, num_draws);
|
||||
cso_draw_vbo(st->cso_context, info, drawid_offset, NULL, draws, num_draws);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -570,7 +570,7 @@ st_hw_select_draw_gallium_multimode(struct gl_context *ctx,
|
||||
info->mode = mode[first];
|
||||
|
||||
if (st_draw_hw_select_prepare_mode(ctx, info))
|
||||
cso_multi_draw(cso, info, 0, &draws[first], i - first);
|
||||
cso_draw_vbo(cso, info, 0, NULL, &draws[first], i - first);
|
||||
|
||||
first = i;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user