summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-03-25 19:16:54 +0200
committerMathias Fröhlich <[email protected]>2018-03-31 06:32:14 +0200
commit245f9a3977dcc097ded07c535b589b82191d5e94 (patch)
tree900515e70bb0902dca9dde2a3fc566ba0d467dbd /src/mesa
parent461698af267f8001aa339c8ca1aec937083ad8fb (diff)
vbo: Readd the arrays argument to the legacy draw methods.
The legacy draw paths from back before 2012 contained a gl_vertex_array array for the inputs to be used for draw. So all draw methods from legacy drivers and everything that goes through tnl are originally written for this calling convention. The same goes for tools like t_rebase or vbo_split*, that even partly still have the original calling convention with a currently unused such pointer. Back in 2012 patch 50f7e75 mesa: move gl_client_array*[] from vbo_draw_func into gl_context introduced Array._DrawArrays, which was something that was IMO aiming for a similar direction than Array._DrawVAO introduced recently. Now several tools like t_rebase and vbo_split*, which are mostly used by tnl based drivers, would need to be converted to use the internal Array._DrawVAO instead of Array._DrawArrays. The same goes for the driver backends that use any of these tools. Alternatively we can reintroduce the gl_vertex_array array in its call argument list and put these tools finally into the tnl directory. So this change reintroduces this gl_vertex_array array for the legacy draw paths that are still required for the tools t_rebase and vbo_split*. A followup will move vbo_split also into tnl. Note that none of the affected drivers use the DriverFlags.NewArray driver bit. So it should be safe to remove this also for the legacy draw path. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c11
-rw-r--r--src/mesa/tnl/t_draw.c7
-rw-r--r--src/mesa/tnl/t_rebase.c10
-rw-r--r--src/mesa/tnl/tnl.h1
-rw-r--r--src/mesa/vbo/vbo.h2
-rw-r--r--src/mesa/vbo/vbo_split_copy.c8
-rw-r--r--src/mesa/vbo/vbo_split_inplace.c8
7 files changed, 18 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 10b5c15e41d..4533069692c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -239,6 +239,7 @@ get_max_client_stride(struct gl_context *ctx, const struct gl_vertex_array *arra
static void
TAG(vbo_render_prims)(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
@@ -476,6 +477,7 @@ vbo_draw_imm(struct gl_context *ctx, const struct gl_vertex_array *arrays,
static void
TAG(vbo_render_prims)(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
@@ -485,7 +487,6 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
struct gl_buffer_object *indirect)
{
struct nouveau_render_state *render = to_render_state(ctx);
- const struct gl_vertex_array *arrays = ctx->Array._DrawArrays;
if (!index_bounds_valid)
vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
@@ -514,6 +515,7 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
static void
TAG(vbo_check_render_prims)(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
@@ -527,12 +529,12 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx,
nouveau_validate_framebuffer(ctx);
if (nctx->fallback == HWTNL)
- TAG(vbo_render_prims)(ctx, prims, nr_prims, ib,
+ TAG(vbo_render_prims)(ctx, arrays, prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount, stream, indirect);
if (nctx->fallback == SWTNL)
- _tnl_draw_prims(ctx, prims, nr_prims, ib,
+ _tnl_draw_prims(ctx, arrays, prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount, stream, indirect);
}
@@ -550,7 +552,8 @@ TAG(vbo_draw)(struct gl_context *ctx,
/* Borrow and update the inputs list from the tnl context */
_tnl_bind_inputs(ctx);
- TAG(vbo_check_render_prims)(ctx, prims, nr_prims, ib,
+ TAG(vbo_check_render_prims)(ctx, ctx->Array._DrawArrays,
+ prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount, stream, indirect);
}
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 96d6b988d3e..a0fd58432a1 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -426,6 +426,7 @@ static void unmap_vbos( struct gl_context *ctx,
/* This is the main workhorse doing all the rendering work.
*/
void _tnl_draw_prims(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
@@ -437,7 +438,6 @@ void _tnl_draw_prims(struct gl_context *ctx,
struct gl_buffer_object *indirect)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- const struct gl_vertex_array *arrays = ctx->Array._DrawArrays;
const GLuint TEST_SPLIT = 0;
const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES;
GLint max_basevertex = prim->basevertex;
@@ -563,8 +563,9 @@ _tnl_draw(struct gl_context *ctx,
*/
_tnl_bind_inputs(ctx);
- _tnl_draw_prims(ctx, prim, nr_prims, ib, index_bounds_valid,
- min_index, max_index, tfb_vertcount, stream, indirect);
+ _tnl_draw_prims(ctx, ctx->Array._DrawArrays, prim, nr_prims, ib,
+ index_bounds_valid, min_index, max_index,
+ tfb_vertcount, stream, indirect);
}
diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c
index 0fcee03b24b..19e759f44be 100644
--- a/src/mesa/tnl/t_rebase.c
+++ b/src/mesa/tnl/t_rebase.c
@@ -115,7 +115,6 @@ void t_rebase_prims( struct gl_context *ctx,
struct _mesa_index_buffer tmp_ib;
struct _mesa_prim *tmp_prims = NULL;
- const struct gl_vertex_array *saved_arrays = ctx->Array._DrawArrays;
void *tmp_indices = NULL;
GLuint i;
@@ -233,10 +232,8 @@ void t_rebase_prims( struct gl_context *ctx,
/* Re-issue the draw call.
*/
- ctx->Array._DrawArrays = tmp_arrays;
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-
- draw( ctx,
+ draw( ctx,
+ tmp_arrays,
prim,
nr_prims,
ib,
@@ -245,9 +242,6 @@ void t_rebase_prims( struct gl_context *ctx,
max_index - min_index,
NULL, 0, NULL );
- ctx->Array._DrawArrays = saved_arrays;
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-
free(tmp_indices);
free(tmp_prims);
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 14e590501ef..e79c4f62048 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -83,6 +83,7 @@ struct _mesa_index_buffer;
void
_tnl_draw_prims(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 13f77d9db37..37aa59d3061 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -145,6 +145,7 @@ vbo_save_EndCallList(struct gl_context *ctx);
* Draw a number of primitives.
* \param prims array [nr_prims] describing what to draw (prim type,
* vertex count, first index, instance count, etc).
+ * \param arrays array of vertex arrays for draw
* \param ib index buffer for indexed drawing, NULL for array drawing
* \param index_bounds_valid are min_index and max_index valid?
* \param min_index lowest vertex index used
@@ -158,6 +159,7 @@ vbo_save_EndCallList(struct gl_context *ctx);
* This may be deprecated in the future
*/
typedef void (*vbo_draw_func)(struct gl_context *ctx,
+ const struct gl_vertex_array* arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c
index 96828a073fe..2aab670de1e 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/vbo/vbo_split_copy.c
@@ -179,7 +179,6 @@ static void
flush(struct copy_context *copy)
{
struct gl_context *ctx = copy->ctx;
- const struct gl_vertex_array *saved_arrays = ctx->Array._DrawArrays;
GLuint i;
/* Set some counters:
@@ -198,10 +197,8 @@ flush(struct copy_context *copy)
(void) dump_draw_info;
#endif
- ctx->Array._DrawArrays = copy->dstarray;
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-
copy->draw(ctx,
+ copy->dstarray,
copy->dstprim,
copy->dstprim_nr,
&copy->dstib,
@@ -210,9 +207,6 @@ flush(struct copy_context *copy)
copy->dstbuf_nr - 1,
NULL, 0, NULL);
- ctx->Array._DrawArrays = saved_arrays;
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-
/* Reset all pointers:
*/
copy->dstprim_nr = 0;
diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c
index 971c52a078c..b63c05c75f0 100644
--- a/src/mesa/vbo/vbo_split_inplace.c
+++ b/src/mesa/vbo/vbo_split_inplace.c
@@ -63,7 +63,6 @@ static void
flush_vertex( struct split_context *split)
{
struct gl_context *ctx = split->ctx;
- const struct gl_vertex_array *saved_arrays = ctx->Array._DrawArrays;
struct _mesa_index_buffer ib;
GLuint i;
@@ -84,10 +83,8 @@ flush_vertex( struct split_context *split)
assert(split->max_index >= split->min_index);
- ctx->Array._DrawArrays = split->array;
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-
split->draw(ctx,
+ split->array,
split->dstprim,
split->dstprim_nr,
split->ib ? &ib : NULL,
@@ -96,9 +93,6 @@ flush_vertex( struct split_context *split)
split->max_index,
NULL, 0, NULL);
- ctx->Array._DrawArrays = saved_arrays;
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-
split->dstprim_nr = 0;
split->min_index = ~0;
split->max_index = 0;