diff options
author | Marek Olšák <marek.olsak@amd.com> | 2020-02-10 21:42:56 -0500 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-02-28 00:53:45 +0000 |
commit | b78ab9c741ac758e9d1eb237f7e8ddc3b70235f5 (patch) | |
tree | 982ae2d8ce6aed0089f1c45233b90ac3c4f51675 /src/mesa/tnl | |
parent | aaa758d3dd4112e6ce52b033cb6dcabfcebadb1f (diff) |
mesa: move num_instances and base_instance out of _mesa_prim
They are never used by multi draws and internal draws.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3990>
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r-- | src/mesa/tnl/t_draw.c | 14 | ||||
-rw-r--r-- | src/mesa/tnl/t_rebase.c | 3 | ||||
-rw-r--r-- | src/mesa/tnl/t_rebase.h | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_split.c | 8 | ||||
-rw-r--r-- | src/mesa/tnl/t_split.h | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_split_copy.c | 3 | ||||
-rw-r--r-- | src/mesa/tnl/t_split_inplace.c | 12 | ||||
-rw-r--r-- | src/mesa/tnl/tnl.h | 7 |
8 files changed, 39 insertions, 12 deletions
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index a2388b9b14f..b39c8443814 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -434,6 +434,8 @@ void _tnl_draw_prims(struct gl_context *ctx, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, struct gl_transform_feedback_object *tfb_vertcount, unsigned stream) { @@ -469,7 +471,7 @@ void _tnl_draw_prims(struct gl_context *ctx, /* We always translate away calls with min_index != 0. */ t_rebase_prims( ctx, arrays, prim, nr_prims, ib, - min_index, max_index, + min_index, max_index, num_instances, base_instance, _tnl_draw_prims ); return; } @@ -488,6 +490,7 @@ void _tnl_draw_prims(struct gl_context *ctx, */ _tnl_split_prims( ctx, arrays, prim, nr_prims, ib, 0, max_index + prim->basevertex, + num_instances, base_instance, _tnl_draw_prims, &limits ); } @@ -499,6 +502,8 @@ void _tnl_draw_prims(struct gl_context *ctx, GLuint nr_bo = 0; GLuint inst; + assert(num_instances > 0); + for (i = 0; i < nr_prims;) { GLuint this_nr_prims; @@ -512,12 +517,10 @@ void _tnl_draw_prims(struct gl_context *ctx, break; } - assert(prim[i].num_instances > 0); - /* Binding inputs may imply mapping some vertex buffer objects. * They will need to be unmapped below. */ - for (inst = 0; inst < prim[i].num_instances; inst++) { + for (inst = 0; inst < num_instances; inst++) { bind_prims(ctx, &prim[i], this_nr_prims); bind_inputs(ctx, arrays, max_index + prim[i].basevertex + 1, @@ -637,6 +640,7 @@ _tnl_draw(struct gl_context *ctx, const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + GLuint num_instances, GLuint base_instance, struct gl_transform_feedback_object *tfb_vertcount, unsigned stream) { @@ -646,7 +650,7 @@ _tnl_draw(struct gl_context *ctx, _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, index_bounds_valid, min_index, max_index, - tfb_vertcount, stream); + num_instances, base_instance, tfb_vertcount, stream); } diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c index 24abcef98a2..06d67620f63 100644 --- a/src/mesa/tnl/t_rebase.c +++ b/src/mesa/tnl/t_rebase.c @@ -110,6 +110,8 @@ void t_rebase_prims( struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, tnl_draw_func draw ) { struct gl_array_attributes tmp_attribs[VERT_ATTRIB_MAX]; @@ -242,6 +244,7 @@ void t_rebase_prims( struct gl_context *ctx, GL_TRUE, 0, max_index - min_index, + num_instances, base_instance, NULL, 0); free(tmp_indices); diff --git a/src/mesa/tnl/t_rebase.h b/src/mesa/tnl/t_rebase.h index d0aa9e18905..b596d93995b 100644 --- a/src/mesa/tnl/t_rebase.h +++ b/src/mesa/tnl/t_rebase.h @@ -34,6 +34,8 @@ void t_rebase_prims( struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, tnl_draw_func draw ); #endif diff --git a/src/mesa/tnl/t_split.c b/src/mesa/tnl/t_split.c index d7aac10e4c8..9c59380c831 100644 --- a/src/mesa/tnl/t_split.c +++ b/src/mesa/tnl/t_split.c @@ -106,6 +106,8 @@ _tnl_split_prims(struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, tnl_draw_func draw, const struct split_limits *limits) { @@ -135,7 +137,8 @@ _tnl_split_prims(struct gl_context *ctx, * individual primitives. */ _tnl_split_inplace(ctx, arrays, prim, nr_prims, ib, - min_index, max_index, draw, limits); + min_index, max_index, num_instances, + base_instance, draw, limits); } else { /* Why were we called? */ @@ -149,7 +152,8 @@ _tnl_split_prims(struct gl_context *ctx, * otherwise try to split the individual primitives. */ _tnl_split_inplace(ctx, arrays, prim, nr_prims, ib, - min_index, max_index, draw, limits); + min_index, max_index, num_instances, + base_instance, draw, limits); } else { /* Why were we called? */ diff --git a/src/mesa/tnl/t_split.h b/src/mesa/tnl/t_split.h index 49017e5dfb8..7634e553a87 100644 --- a/src/mesa/tnl/t_split.h +++ b/src/mesa/tnl/t_split.h @@ -57,6 +57,8 @@ _tnl_split_inplace(struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, tnl_draw_func draw, const struct split_limits *limits); diff --git a/src/mesa/tnl/t_split_copy.c b/src/mesa/tnl/t_split_copy.c index 511e46c1e2f..45b20fbd49c 100644 --- a/src/mesa/tnl/t_split_copy.c +++ b/src/mesa/tnl/t_split_copy.c @@ -211,6 +211,8 @@ flush(struct copy_context *copy) GL_TRUE, 0, copy->dstbuf_nr - 1, + 1, + 0, NULL, 0); /* Reset all pointers: @@ -237,7 +239,6 @@ begin(struct copy_context *copy, GLenum mode, GLboolean begin_flag) prim->mode = mode; prim->begin = begin_flag; - prim->num_instances = 1; } diff --git a/src/mesa/tnl/t_split_inplace.c b/src/mesa/tnl/t_split_inplace.c index 048f87309ee..d9ea52dfaf1 100644 --- a/src/mesa/tnl/t_split_inplace.c +++ b/src/mesa/tnl/t_split_inplace.c @@ -49,6 +49,8 @@ struct split_context { const struct _mesa_index_buffer *ib; GLuint min_index; GLuint max_index; + GLuint num_instances; + GLuint base_instance; tnl_draw_func draw; const struct split_limits *limits; @@ -93,6 +95,8 @@ flush_vertex( struct split_context *split) !split->ib, split->min_index, split->max_index, + split->num_instances, + split->base_instance, NULL, 0); split->dstprim_nr = 0; @@ -190,8 +194,6 @@ split_prims(struct split_context *split) outprim->end = (nr == remaining && prim->end); outprim->start = prim->start + j; outprim->count = nr; - outprim->num_instances = prim->num_instances; - outprim->base_instance = prim->base_instance; update_index_bounds(split, outprim); @@ -232,8 +234,6 @@ split_prims(struct split_context *split) tmpprim = *prim; tmpprim.start = 0; tmpprim.count = count; - tmpprim.num_instances = 1; - tmpprim.base_instance = 0; flush_vertex(split); @@ -270,6 +270,8 @@ _tnl_split_inplace(struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, tnl_draw_func draw, const struct split_limits *limits) { @@ -286,6 +288,8 @@ _tnl_split_inplace(struct gl_context *ctx, /* Empty interval, makes calculations simpler. */ split.min_index = ~0; split.max_index = 0; + split.num_instances = num_instances; + split.base_instance = base_instance; split.draw = draw; split.limits = limits; diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index c3927536b8b..4bf8ee20f68 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -107,6 +107,8 @@ _tnl_draw_prims(struct gl_context *ctx, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, struct gl_transform_feedback_object *tfb_vertcount, unsigned stream); @@ -115,6 +117,7 @@ _tnl_draw(struct gl_context *ctx, const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + GLuint num_instances, GLuint base_instance, struct gl_transform_feedback_object *tfb_vertcount, unsigned stream); extern void @@ -172,6 +175,8 @@ typedef void (*tnl_draw_func)(struct gl_context *ctx, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, struct gl_transform_feedback_object *tfb_vertcount, unsigned tfb_stream); @@ -198,6 +203,8 @@ _tnl_split_prims(struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index, + GLuint num_instances, + GLuint base_instance, tnl_draw_func draw, const struct split_limits *limits); |