summaryrefslogtreecommitdiffstats
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
commit6e9f00e3fc6f3b1331031f0995254c768d38ea81 (patch)
tree41db2a496029ecc3b4a57d798d8d63c7c8b26614
parent245f9a3977dcc097ded07c535b589b82191d5e94 (diff)
vbo: Move vbo_split into the tnl module.
Move the files, adapt to the naming scheme in tnl, update callers and build system. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
-rw-r--r--src/mesa/Makefile.sources10
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c4
-rw-r--r--src/mesa/meson.build8
-rw-r--r--src/mesa/tnl/t_draw.c8
-rw-r--r--src/mesa/tnl/t_rebase.c3
-rw-r--r--src/mesa/tnl/t_rebase.h4
-rw-r--r--src/mesa/tnl/t_split.c (renamed from src/mesa/vbo/vbo_split.c)34
-rw-r--r--src/mesa/tnl/t_split.h (renamed from src/mesa/vbo/vbo_split.h)46
-rw-r--r--src/mesa/tnl/t_split_copy.c (renamed from src/mesa/vbo/vbo_split_copy.c)23
-rw-r--r--src/mesa/tnl/t_split_inplace.c (renamed from src/mesa/vbo/vbo_split_inplace.c)51
-rw-r--r--src/mesa/tnl/tnl.h80
-rw-r--r--src/mesa/vbo/vbo.h81
12 files changed, 178 insertions, 174 deletions
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 0446078136d..92565ef8f5e 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -372,6 +372,10 @@ TNL_FILES = \
tnl/t_pipeline.h \
tnl/t_rebase.c \
tnl/t_rebase.h \
+ tnl/t_split.c \
+ tnl/t_split_copy.c \
+ tnl/t_split.h \
+ tnl/t_split_inplace.c \
tnl/t_vb_cliptmp.h \
tnl/t_vb_fog.c \
tnl/t_vb_light.c \
@@ -411,11 +415,7 @@ VBO_FILES = \
vbo/vbo_save.c \
vbo/vbo_save_draw.c \
vbo/vbo_save.h \
- vbo/vbo_save_loopback.c \
- vbo/vbo_split.c \
- vbo/vbo_split_copy.c \
- vbo/vbo_split.h \
- vbo/vbo_split_inplace.c
+ vbo/vbo_save_loopback.c
STATETRACKER_FILES = \
state_tracker/st_atifs_to_tgsi.c \
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 4533069692c..79b444cf55f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -277,8 +277,8 @@ vbo_maybe_split(struct gl_context *ctx, const struct gl_vertex_array *arrays,
.max_vb_size = ~0,
};
- vbo_split_prims(ctx, arrays, prims, nr_prims, ib, min_index,
- max_index, TAG(vbo_render_prims), &limits);
+ _tnl_split_prims(ctx, arrays, prims, nr_prims, ib, min_index,
+ max_index, TAG(vbo_render_prims), &limits);
return GL_TRUE;
}
diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index b74d1693771..d2d058bfa3c 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -343,10 +343,6 @@ files_libmesa_common = files(
'vbo/vbo_save_draw.c',
'vbo/vbo_save.h',
'vbo/vbo_save_loopback.c',
- 'vbo/vbo_split.c',
- 'vbo/vbo_split_copy.c',
- 'vbo/vbo_split.h',
- 'vbo/vbo_split_inplace.c',
'x86/common_x86.c',
)
@@ -366,6 +362,10 @@ files_libmesa_classic = files(
'tnl/t_pipeline.c',
'tnl/t_pipeline.h',
'tnl/t_rebase.c',
+ 'tnl/t_split.c',
+ 'tnl/t_split_copy.c',
+ 'tnl/t_split.h',
+ 'tnl/t_split_inplace.c',
'tnl/t_vb_cliptmp.h',
'tnl/t_vb_fog.c',
'tnl/t_vb_light.c',
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index a0fd58432a1..a83b98eede1 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -486,10 +486,10 @@ void _tnl_draw_prims(struct gl_context *ctx,
/* This will split the buffers one way or another and
* recursively call back into this function.
*/
- vbo_split_prims( ctx, arrays, prim, nr_prims, ib,
- 0, max_index + prim->basevertex,
- _tnl_draw_prims,
- &limits );
+ _tnl_split_prims( ctx, arrays, prim, nr_prims, ib,
+ 0, max_index + prim->basevertex,
+ _tnl_draw_prims,
+ &limits );
}
else {
/* May need to map a vertex buffer object for every attribute plus
diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c
index 19e759f44be..d28512423c3 100644
--- a/src/mesa/tnl/t_rebase.c
+++ b/src/mesa/tnl/t_rebase.c
@@ -51,6 +51,7 @@
#include "main/glheader.h"
#include "main/imports.h"
#include "main/mtypes.h"
+#include "vbo/vbo.h"
#include "t_rebase.h"
@@ -108,7 +109,7 @@ void t_rebase_prims( struct gl_context *ctx,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
- vbo_draw_func draw )
+ tnl_draw_func draw )
{
struct gl_array_attributes tmp_attribs[VERT_ATTRIB_MAX];
struct gl_vertex_array tmp_arrays[VERT_ATTRIB_MAX];
diff --git a/src/mesa/tnl/t_rebase.h b/src/mesa/tnl/t_rebase.h
index 16a3a2b5a33..ce2e8b0590e 100644
--- a/src/mesa/tnl/t_rebase.h
+++ b/src/mesa/tnl/t_rebase.h
@@ -25,7 +25,7 @@
#ifndef _T_REBASE_H_
#define _T_REBASE_H_
-#include "vbo/vbo.h"
+#include "tnl.h"
void t_rebase_prims( struct gl_context *ctx,
const struct gl_vertex_array *arrays,
@@ -34,6 +34,6 @@ void t_rebase_prims( struct gl_context *ctx,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
- vbo_draw_func draw );
+ tnl_draw_func draw );
#endif
diff --git a/src/mesa/vbo/vbo_split.c b/src/mesa/tnl/t_split.c
index ffe1d67489a..b98bd404d52 100644
--- a/src/mesa/vbo/vbo_split.c
+++ b/src/mesa/tnl/t_split.c
@@ -49,16 +49,16 @@
#include "main/glheader.h"
#include "main/mtypes.h"
+#include "vbo/vbo.h"
-#include "vbo_split.h"
-#include "vbo.h"
+#include "t_split.h"
/* True if a primitive can be split without copying of vertices, false
* otherwise.
*/
GLboolean
-split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
+_tnl_split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
{
switch (mode) {
case GL_POINTS:
@@ -99,15 +99,15 @@ split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
void
-vbo_split_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,
- GLuint min_index,
- GLuint max_index,
- vbo_draw_func draw,
- const struct split_limits *limits)
+_tnl_split_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,
+ GLuint min_index,
+ GLuint max_index,
+ tnl_draw_func draw,
+ const struct split_limits *limits)
{
if (ib) {
if (limits->max_indices == 0) {
@@ -127,15 +127,15 @@ vbo_split_prims(struct gl_context *ctx,
* in turn. Use a vertex cache to preserve some of the
* sharing from the original index list.
*/
- vbo_split_copy(ctx, arrays, prim, nr_prims, ib, draw, limits);
+ _tnl_split_copy(ctx, arrays, prim, nr_prims, ib, draw, limits);
}
else if (ib->count > limits->max_indices) {
/* The index buffer is too large for hardware. Try to split
* on whole-primitive boundaries, otherwise try to split the
* individual primitives.
*/
- vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
- min_index, max_index, draw, limits);
+ _tnl_split_inplace(ctx, arrays, prim, nr_prims, ib,
+ min_index, max_index, draw, limits);
}
else {
/* Why were we called? */
@@ -148,8 +148,8 @@ vbo_split_prims(struct gl_context *ctx,
* module). Try to split on whole-primitive boundaries,
* otherwise try to split the individual primitives.
*/
- vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
- min_index, max_index, draw, limits);
+ _tnl_split_inplace(ctx, arrays, prim, nr_prims, ib,
+ min_index, max_index, draw, limits);
}
else {
/* Why were we called? */
diff --git a/src/mesa/vbo/vbo_split.h b/src/mesa/tnl/t_split.h
index fea2b48aecc..ced7d30bdf1 100644
--- a/src/mesa/vbo/vbo_split.h
+++ b/src/mesa/tnl/t_split.h
@@ -29,46 +29,46 @@
/**
- * \mainpage The VBO splitter
+ * \mainpage The TNL splitter
*
- * This is the private data used internally to the vbo_split_prims()
- * helper function. Nobody outside the vbo_split* files needs to
+ * This is the private data used internally to the _tnl_split_prims()
+ * helper function. Nobody outside the _tnl_split* files needs to
* include or know about this structure.
*/
-#ifndef _VBO_SPLIT_H
-#define _VBO_SPLIT_H
+#ifndef _TNL_SPLIT_H
+#define _TNL_SPLIT_H
-#include "vbo.h"
+#include "tnl.h"
/* True if a primitive can be split without copying of vertices, false
* otherwise.
*/
GLboolean
-split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr);
+_tnl_split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr);
void
-vbo_split_inplace(struct gl_context *ctx,
- const struct gl_vertex_array arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index,
- vbo_draw_func draw,
- const struct split_limits *limits);
+_tnl_split_inplace(struct gl_context *ctx,
+ const struct gl_vertex_array arrays[],
+ const struct _mesa_prim *prim,
+ GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ GLuint min_index,
+ GLuint max_index,
+ tnl_draw_func draw,
+ const struct split_limits *limits);
/* Requires ib != NULL:
*/
void
-vbo_split_copy(struct gl_context *ctx,
- const struct gl_vertex_array arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- vbo_draw_func draw,
- const struct split_limits *limits);
+_tnl_split_copy(struct gl_context *ctx,
+ const struct gl_vertex_array arrays[],
+ const struct _mesa_prim *prim,
+ GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ tnl_draw_func draw,
+ const struct split_limits *limits);
#endif
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/tnl/t_split_copy.c
index 2aab670de1e..f76a470b5ff 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/tnl/t_split_copy.c
@@ -38,9 +38,10 @@
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/varray.h"
+#include "vbo/vbo.h"
-#include "vbo_split.h"
-#include "vbo.h"
+#include "t_split.h"
+#include "tnl.h"
#define ELT_TABLE_SIZE 16
@@ -56,7 +57,7 @@ struct copy_context {
const struct _mesa_prim *prim;
GLuint nr_prims;
const struct _mesa_index_buffer *ib;
- vbo_draw_func draw;
+ tnl_draw_func draw;
const struct split_limits *limits;
@@ -383,7 +384,7 @@ replay_elts(struct copy_context *copy)
break;
default:
- (void)split_prim_inplace(prim->mode, &first, &incr);
+ (void)_tnl_split_prim_inplace(prim->mode, &first, &incr);
j = 0;
while (j != prim->count) {
@@ -589,13 +590,13 @@ replay_finish(struct copy_context *copy)
* Split VBO into smaller pieces, draw the pieces.
*/
void
-vbo_split_copy(struct gl_context *ctx,
- const struct gl_vertex_array *arrays,
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- vbo_draw_func draw,
- const struct split_limits *limits)
+_tnl_split_copy(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
+ const struct _mesa_prim *prim,
+ GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ tnl_draw_func draw,
+ const struct split_limits *limits)
{
struct copy_context copy;
GLuint i, this_nr_prims;
diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/tnl/t_split_inplace.c
index b63c05c75f0..15a09861c73 100644
--- a/src/mesa/vbo/vbo_split_inplace.c
+++ b/src/mesa/tnl/t_split_inplace.c
@@ -30,7 +30,9 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "vbo_split.h"
+#include "vbo/vbo.h"
+
+#include "t_split.h"
#define MAX_PRIM 32
@@ -47,7 +49,7 @@ struct split_context {
const struct _mesa_index_buffer *ib;
GLuint min_index;
GLuint max_index;
- vbo_draw_func draw;
+ tnl_draw_func draw;
const struct split_limits *limits;
GLuint limit;
@@ -153,7 +155,8 @@ split_prims(struct split_context *split)
for (i = 0; i < split->nr_prims; i++) {
const struct _mesa_prim *prim = &split->prim[i];
GLuint first, incr;
- GLboolean split_inplace = split_prim_inplace(prim->mode, &first, &incr);
+ GLboolean split_inplace =
+ _tnl_split_prim_inplace(prim->mode, &first, &incr);
GLuint available = get_max_vertices(split, prim);
GLuint count = prim->count - (prim->count - first) % incr;
@@ -235,24 +238,24 @@ split_prims(struct split_context *split)
flush_vertex(split);
- vbo_split_copy(split->ctx,
- split->array,
- &tmpprim, 1,
- &ib,
- split->draw,
- split->limits);
+ _tnl_split_copy(split->ctx,
+ split->array,
+ &tmpprim, 1,
+ &ib,
+ split->draw,
+ split->limits);
free(elts);
}
else {
flush_vertex(split);
- vbo_split_copy(split->ctx,
- split->array,
- prim, 1,
- split->ib,
- split->draw,
- split->limits);
+ _tnl_split_copy(split->ctx,
+ split->array,
+ prim, 1,
+ split->ib,
+ split->draw,
+ split->limits);
}
}
@@ -261,15 +264,15 @@ split_prims(struct split_context *split)
void
-vbo_split_inplace(struct gl_context *ctx,
- const struct gl_vertex_array *arrays,
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index,
- vbo_draw_func draw,
- const struct split_limits *limits)
+_tnl_split_inplace(struct gl_context *ctx,
+ const struct gl_vertex_array *arrays,
+ const struct _mesa_prim *prim,
+ GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ GLuint min_index,
+ GLuint max_index,
+ tnl_draw_func draw,
+ const struct split_limits *limits)
{
struct split_context split;
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index e79c4f62048..45052a3a89c 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -108,4 +108,84 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
extern void
_tnl_validate_shine_tables( struct gl_context *ctx );
+
+
+/**
+ * For indirect array drawing:
+ *
+ * typedef struct {
+ * GLuint count;
+ * GLuint primCount;
+ * GLuint first;
+ * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
+ * } DrawArraysIndirectCommand;
+ *
+ * For indirect indexed drawing:
+ *
+ * typedef struct {
+ * GLuint count;
+ * GLuint primCount;
+ * GLuint firstIndex;
+ * GLint baseVertex;
+ * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
+ * } DrawElementsIndirectCommand;
+ */
+
+
+/**
+ * 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
+ * \param max_index highest vertex index used
+ * \param tfb_vertcount if non-null, indicates which transform feedback
+ * object has the vertex count.
+ * \param tfb_stream If called via DrawTransformFeedbackStream, specifies the
+ * vertex stream buffer from which to get the vertex count.
+ * \param indirect If any prims are indirect, this specifies the buffer
+ * to find the "DrawArrays/ElementsIndirectCommand" data.
+ * This may be deprecated in the future
+ */
+typedef void (*tnl_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,
+ GLboolean index_bounds_valid,
+ GLuint min_index,
+ GLuint max_index,
+ struct gl_transform_feedback_object *tfb_vertcount,
+ unsigned tfb_stream,
+ struct gl_buffer_object *indirect);
+
+
+/* Utility function to cope with various constraints on tnl modules or
+ * hardware. This can be used to split an incoming set of arrays and
+ * primitives against the following constraints:
+ * - Maximum number of indices in index buffer.
+ * - Maximum number of vertices referenced by index buffer.
+ * - Maximum hardware vertex buffer size.
+ */
+struct split_limits
+{
+ GLuint max_verts;
+ GLuint max_indices;
+ GLuint max_vb_size; /* bytes */
+};
+
+void
+_tnl_split_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,
+ GLuint min_index,
+ GLuint max_index,
+ tnl_draw_func draw,
+ const struct split_limits *limits);
+
+
#endif
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 37aa59d3061..9b150662915 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -119,75 +119,6 @@ void
vbo_save_EndCallList(struct gl_context *ctx);
-/**
- * For indirect array drawing:
- *
- * typedef struct {
- * GLuint count;
- * GLuint primCount;
- * GLuint first;
- * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
- * } DrawArraysIndirectCommand;
- *
- * For indirect indexed drawing:
- *
- * typedef struct {
- * GLuint count;
- * GLuint primCount;
- * GLuint firstIndex;
- * GLint baseVertex;
- * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
- * } DrawElementsIndirectCommand;
- */
-
-
-/**
- * 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
- * \param max_index highest vertex index used
- * \param tfb_vertcount if non-null, indicates which transform feedback
- * object has the vertex count.
- * \param tfb_stream If called via DrawTransformFeedbackStream, specifies the
- * vertex stream buffer from which to get the vertex count.
- * \param indirect If any prims are indirect, this specifies the buffer
- * to find the "DrawArrays/ElementsIndirectCommand" data.
- * 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,
- GLboolean index_bounds_valid,
- GLuint min_index,
- GLuint max_index,
- struct gl_transform_feedback_object *tfb_vertcount,
- unsigned tfb_stream,
- struct gl_buffer_object *indirect);
-
-
-
-
-/* Utility function to cope with various constraints on tnl modules or
- * hardware. This can be used to split an incoming set of arrays and
- * primitives against the following constraints:
- * - Maximum number of indices in index buffer.
- * - Maximum number of vertices referenced by index buffer.
- * - Maximum hardware vertex buffer size.
- */
-struct split_limits
-{
- GLuint max_verts;
- GLuint max_indices;
- GLuint max_vb_size; /* bytes */
-};
-
-
void
_vbo_draw_indirect(struct gl_context *ctx, GLuint mode,
struct gl_buffer_object *indirect_data,
@@ -199,18 +130,6 @@ _vbo_draw_indirect(struct gl_context *ctx, GLuint mode,
void
-vbo_split_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,
- GLuint min_index,
- GLuint max_index,
- vbo_draw_func draw,
- const struct split_limits *limits);
-
-
-void
vbo_delete_minmax_cache(struct gl_buffer_object *bufferObj);
void