draw: asst. clean-up in draw_pt.c

Signed-off-by: Brian Paul <brianp@vmware.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17064>
This commit is contained in:
Brian Paul
2022-06-10 11:39:19 -06:00
committed by Marge Bot
parent a8cb20339c
commit 2eabffdd86

View File

@@ -47,6 +47,7 @@
DEBUG_GET_ONCE_BOOL_OPTION(draw_fse, "DRAW_FSE", FALSE)
DEBUG_GET_ONCE_BOOL_OPTION(draw_no_fse, "DRAW_NO_FSE", FALSE)
/* Overall we split things into:
* - frontend -- prepare fetch_elts, draw_elts - eg vsplit
* - middle -- fetch, shade, cliptest, viewport
@@ -134,7 +135,6 @@ draw_pt_arrays(struct draw_context *draw,
draw->pt.rebind_parameters = FALSE;
}
for (unsigned i = 0; i < num_draws; i++) {
unsigned count = draw_info[i].count;
/* Sanitize primitive length:
@@ -160,7 +160,9 @@ draw_pt_arrays(struct draw_context *draw,
return TRUE;
}
void draw_pt_flush( struct draw_context *draw, unsigned flags )
void
draw_pt_flush(struct draw_context *draw, unsigned flags)
{
assert(flags);
@@ -178,8 +180,8 @@ void draw_pt_flush( struct draw_context *draw, unsigned flags )
}
boolean draw_pt_init( struct draw_context *draw )
boolean
draw_pt_init(struct draw_context *draw)
{
draw->pt.test_fse = debug_get_option_draw_fse();
draw->pt.no_fse = debug_get_option_draw_no_fse();
@@ -205,7 +207,8 @@ boolean draw_pt_init( struct draw_context *draw )
}
void draw_pt_destroy( struct draw_context *draw )
void
draw_pt_destroy(struct draw_context *draw)
{
if (draw->pt.middle.llvm) {
draw->pt.middle.llvm->destroy(draw->pt.middle.llvm);
@@ -236,14 +239,11 @@ static void
draw_print_arrays(struct draw_context *draw, enum pipe_prim_type prim,
int start, uint count, int index_bias)
{
uint i;
debug_printf("Draw arrays(prim = %u, start = %u, count = %u)\n",
prim, start, count);
for (i = 0; i < count; i++) {
for (unsigned i = 0; i < count; i++) {
uint ii = 0;
uint j;
if (draw->pt.user.eltSize) {
/* indexed arrays */
@@ -281,7 +281,7 @@ draw_print_arrays(struct draw_context *draw, enum pipe_prim_type prim,
debug_printf("Vertex %u:\n", ii);
}
for (j = 0; j < draw->pt.nr_vertex_elements; j++) {
for (unsigned j = 0; j < draw->pt.nr_vertex_elements; j++) {
uint buf = draw->pt.vertex_element[j].vertex_buffer_index;
ubyte *ptr = (ubyte *) draw->pt.user.vbuffer[buf].map;
@@ -450,6 +450,7 @@ resolve_draw_info(const struct pipe_draw_info *raw_info,
info->max_index = draw->count - 1;
}
/*
* Loop over all instances and execute draws for them.
*/
@@ -460,11 +461,9 @@ draw_instances(struct draw_context *draw,
const struct pipe_draw_start_count_bias *draws,
unsigned num_draws)
{
unsigned instance;
draw->start_instance = info->start_instance;
for (instance = 0; instance < info->instance_count; instance++) {
for (unsigned instance = 0; instance < info->instance_count; instance++) {
unsigned instance_idx = instance + info->start_instance;
draw->instance_id = instance;
/* check for overflow */
@@ -481,11 +480,13 @@ draw_instances(struct draw_context *draw,
draw_pt_arrays_restart(draw, info, draws, num_draws);
}
else {
draw_pt_arrays(draw, info->mode, info->index_bias_varies, draws, num_draws);
draw_pt_arrays(draw, info->mode, info->index_bias_varies,
draws, num_draws);
}
}
}
/**
* Draw vertex arrays.
* This is the main entrypoint into the drawing module. If drawing an indexed
@@ -545,9 +546,8 @@ draw_vbo(struct draw_context *draw,
tgsi_dump(draw->vs.vertex_shader->state.tokens, 0);
if (0) {
unsigned int i;
debug_printf("Elements:\n");
for (i = 0; i < draw->pt.nr_vertex_elements; i++) {
for (unsigned i = 0; i < draw->pt.nr_vertex_elements; i++) {
debug_printf(" %u: src_offset=%u inst_div=%u vbuf=%u format=%s\n",
i,
draw->pt.vertex_element[i].src_offset,
@@ -556,7 +556,7 @@ draw_vbo(struct draw_context *draw,
util_format_name(draw->pt.vertex_element[i].src_format));
}
debug_printf("Buffers:\n");
for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
for (unsigned i = 0; i < draw->pt.nr_vertex_buffers; i++) {
debug_printf(" %u: stride=%u offset=%u size=%d ptr=%p\n",
i,
draw->pt.vertex_buffer[i].stride,
@@ -568,8 +568,11 @@ draw_vbo(struct draw_context *draw,
if (0) {
for (unsigned i = 0; i < num_draws; i++)
draw_print_arrays(draw, use_info->mode, use_draws[i].start, MIN2(use_draws[i].count, 20),
use_info->index_bias_varies ? use_draws[i].index_bias : use_draws[0].index_bias);
draw_print_arrays(draw, use_info->mode, use_draws[i].start,
MIN2(use_draws[i].count, 20),
use_info->index_bias_varies
? use_draws[i].index_bias
: use_draws[0].index_bias);
}
index_limit = util_draw_max_index(draw->pt.vertex_buffer,
@@ -606,8 +609,9 @@ draw_vbo(struct draw_context *draw,
draw->pt.user.viewid = i;
draw_instances(draw, drawid_offset, use_info, use_draws, num_draws);
}
} else
} else {
draw_instances(draw, drawid_offset, use_info, use_draws, num_draws);
}
/* If requested emit the pipeline statistics for this run */
if (draw->collect_statistics) {