summaryrefslogtreecommitdiff
path: root/lib/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa')
-rw-r--r--lib/mesa/src/mesa/tnl/t_rebase.c168
-rw-r--r--lib/mesa/src/mesa/tnl/t_rebase.h2
-rw-r--r--lib/mesa/src/mesa/tnl/t_split.c6
-rw-r--r--lib/mesa/src/mesa/tnl/t_split.h4
-rw-r--r--lib/mesa/src/mesa/tnl/t_split_copy.c101
-rw-r--r--lib/mesa/src/mesa/tnl/t_split_inplace.c24
-rw-r--r--lib/mesa/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp15
-rw-r--r--lib/mesa/src/util/tests/fast_idiv_by_const/meson.build9
-rw-r--r--lib/mesa/src/util/tests/set/meson.build8
-rw-r--r--lib/mesa/src/util/tests/set/set_test.cpp58
-rw-r--r--lib/mesa/src/util/tests/string_buffer/meson.build9
11 files changed, 171 insertions, 233 deletions
diff --git a/lib/mesa/src/mesa/tnl/t_rebase.c b/lib/mesa/src/mesa/tnl/t_rebase.c
index 047189564..b6950e04f 100644
--- a/lib/mesa/src/mesa/tnl/t_rebase.c
+++ b/lib/mesa/src/mesa/tnl/t_rebase.c
@@ -39,7 +39,7 @@
*
* If we just upload the new data, however, the indices will be
* incorrect as we tend to upload each set of vertex data to a new
- * region.
+ * region.
*
* This file provides a helper to adjust the arrays, primitives and
* indices of a draw call so that it can be re-issued with a min_index
@@ -50,7 +50,7 @@
#include "main/bufferobj.h"
#include "main/errors.h"
#include "main/glheader.h"
-#include "main/macros.h"
+#include "main/imports.h"
#include "main/mtypes.h"
#include "vbo/vbo.h"
@@ -58,30 +58,32 @@
#define REBASE(TYPE) \
-static void *rebase_##TYPE(const void *ptr, \
- unsigned start, \
- unsigned count, \
- TYPE min_index) \
+static void *rebase_##TYPE( const void *ptr, \
+ GLuint count, \
+ TYPE min_index ) \
{ \
+ GLuint i; \
const TYPE *in = (TYPE *)ptr; \
- TYPE *tmp_indices = malloc((start + count) * sizeof(TYPE)); \
- \
+ TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \
+ \
if (tmp_indices == NULL) { \
_mesa_error_no_memory(__func__); \
return NULL; \
} \
- \
- for (unsigned i = 0; i < count; i++) \
- tmp_indices[start + i] = in[start + i] - min_index; \
- \
+ \
+ for (i = 0; i < count; i++) \
+ tmp_indices[i] = in[i] - min_index; \
+ \
return (void *)tmp_indices; \
}
+
REBASE(GLuint)
REBASE(GLushort)
REBASE(GLubyte)
+
/* Adjust primitives, indices and vertex definitions so that min_index
* becomes zero. There are lots of reasons for wanting to do this, eg:
*
@@ -90,7 +92,7 @@ REBASE(GLubyte)
* min_index will be transformed.
*
* Hardware tnl:
- * - if ib != NULL and min_index != 0, otherwise vertices lower than
+ * - if ib != NULL and min_index != 0, otherwise vertices lower than
* min_index will be uploaded. Requires adjusting index values.
*
* - if ib == NULL and min_index != 0, just for convenience so this doesn't
@@ -101,16 +103,14 @@ REBASE(GLubyte)
* - can't save time by trying to upload half a vbo - typically it is
* all or nothing.
*/
-void t_rebase_prims(struct gl_context *ctx,
- const struct tnl_vertex_array *arrays,
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index,
- GLuint num_instances,
- GLuint base_instance,
- tnl_draw_func draw)
+void t_rebase_prims( struct gl_context *ctx,
+ const struct tnl_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 )
{
struct gl_array_attributes tmp_attribs[VERT_ATTRIB_MAX];
struct tnl_vertex_array tmp_arrays[VERT_ATTRIB_MAX];
@@ -125,12 +125,13 @@ void t_rebase_prims(struct gl_context *ctx,
if (0)
printf("%s %d..%d\n", __func__, min_index, max_index);
+
/* XXX this path is disabled for now.
* There's rendering corruption in some apps when it's enabled.
*/
if (0 && ib && ctx->Extensions.ARB_draw_elements_base_vertex) {
- /* If we can just tell the hardware or the TNL to interpret our indices
- * with a different base, do so.
+ /* If we can just tell the hardware or the TNL to interpret our
+ * indices with a different base, do so.
*/
tmp_prims = malloc(sizeof(*prim) * nr_prims);
@@ -140,75 +141,57 @@ void t_rebase_prims(struct gl_context *ctx,
}
for (i = 0; i < nr_prims; i++) {
- tmp_prims[i] = prim[i];
- tmp_prims[i].basevertex -= min_index;
+ tmp_prims[i] = prim[i];
+ tmp_prims[i].basevertex -= min_index;
}
prim = tmp_prims;
} else if (ib) {
- unsigned start = prim[0].start;
- for (i = 1; i < nr_prims; i++) {
- if (prim[i].start != start) {
- if (0) {
- printf("%s recursing due to mismatched start "
- "(prim[0].start = %u vs. prim[%u].start = %u)\n",
- __func__, start, i, prim[i].start);
- }
-
- t_rebase_prims(ctx, arrays, &prim[0], i, ib, min_index,
- max_index, num_instances, base_instance, draw);
- t_rebase_prims(ctx, arrays, &prim[i], nr_prims - i, ib, min_index,
- max_index, num_instances, base_instance, draw);
- return;
- }
- }
-
/* Unfortunately need to adjust each index individually.
*/
- bool map_ib = false;
- const void *ptr;
-
- if (ib->obj) {
- if (!ib->obj->Mappings[MAP_INTERNAL].Pointer) {
- ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
- ib->obj, MAP_INTERNAL);
- map_ib = true;
- }
-
- ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
- } else
- ptr = ib->ptr;
-
- /* Some users might prefer it if we translated elements to GLuints here.
- * Others wouldn't...
+ GLboolean map_ib = ib->obj->Name &&
+ !ib->obj->Mappings[MAP_INTERNAL].Pointer;
+ void *ptr;
+
+ if (map_ib)
+ ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
+ ib->obj, MAP_INTERNAL);
+
+
+ ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
+
+ /* Some users might prefer it if we translated elements to
+ * GLuints here. Others wouldn't...
*/
- switch (ib->index_size_shift) {
+ switch (ib->index_size) {
+ case 4:
+ tmp_indices = rebase_GLuint( ptr, ib->count, min_index );
+ break;
case 2:
- tmp_indices = rebase_GLuint(ptr, start, ib->count, min_index);
- break;
+ tmp_indices = rebase_GLushort( ptr, ib->count, min_index );
+ break;
case 1:
- tmp_indices = rebase_GLushort(ptr, start, ib->count, min_index);
- break;
- case 0:
- tmp_indices = rebase_GLubyte(ptr, start, ib->count, min_index);
- break;
- }
+ tmp_indices = rebase_GLubyte( ptr, ib->count, min_index );
+ break;
+ }
- if (map_ib)
- ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
+ if (map_ib)
+ ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
- if (tmp_indices == NULL)
+ if (tmp_indices == NULL) {
return;
+ }
- tmp_ib.obj = NULL;
+ tmp_ib.obj = ctx->Shared->NullBufferObj;
tmp_ib.ptr = tmp_indices;
tmp_ib.count = ib->count;
- tmp_ib.index_size_shift = ib->index_size_shift;
+ tmp_ib.index_size = ib->index_size;
ib = &tmp_ib;
}
else {
- /* Otherwise the primitives need adjustment. */
+ /* Otherwise the primitives need adjustment.
+ */
tmp_prims = malloc(sizeof(*prim) * nr_prims);
if (tmp_prims == NULL) {
@@ -217,11 +200,12 @@ void t_rebase_prims(struct gl_context *ctx,
}
for (i = 0; i < nr_prims; i++) {
- /* If this fails, it could indicate an application error: */
- assert(prim[i].start >= min_index);
+ /* If this fails, it could indicate an application error:
+ */
+ assert(prim[i].start >= min_index);
- tmp_prims[i] = prim[i];
- tmp_prims[i].start -= min_index;
+ tmp_prims[i] = prim[i];
+ tmp_prims[i].start -= min_index;
}
prim = tmp_prims;
@@ -241,25 +225,27 @@ void t_rebase_prims(struct gl_context *ctx,
tmp_attribs[i] = *(arrays[i].VertexAttrib);
tmp_arrays[i].BufferBinding = arrays[i].BufferBinding;
tmp_arrays[i].VertexAttrib = &tmp_attribs[i];
- if (arrays[i].BufferBinding->BufferObj)
+ if (_mesa_is_bufferobj(arrays[i].BufferBinding->BufferObj))
tmp_attribs[i].RelativeOffset +=
min_index * arrays[i].BufferBinding->Stride;
else
tmp_attribs[i].Ptr += min_index * arrays[i].BufferBinding->Stride;
}
-
- /* Re-issue the draw call. */
- draw(ctx,
- tmp_arrays,
- prim,
- nr_prims,
- ib,
- GL_TRUE,
- 0,
- max_index - min_index,
- num_instances, base_instance);
+
+ /* Re-issue the draw call.
+ */
+ draw( ctx,
+ tmp_arrays,
+ prim,
+ nr_prims,
+ ib,
+ GL_TRUE,
+ 0,
+ max_index - min_index,
+ NULL, 0, NULL );
free(tmp_indices);
+
free(tmp_prims);
}
diff --git a/lib/mesa/src/mesa/tnl/t_rebase.h b/lib/mesa/src/mesa/tnl/t_rebase.h
index b596d9399..d0aa9e189 100644
--- a/lib/mesa/src/mesa/tnl/t_rebase.h
+++ b/lib/mesa/src/mesa/tnl/t_rebase.h
@@ -34,8 +34,6 @@ 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/lib/mesa/src/mesa/tnl/t_split.c b/lib/mesa/src/mesa/tnl/t_split.c
index 3959e11d2..d7aac10e4 100644
--- a/lib/mesa/src/mesa/tnl/t_split.c
+++ b/lib/mesa/src/mesa/tnl/t_split.c
@@ -106,8 +106,6 @@ _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)
{
@@ -137,7 +135,7 @@ _tnl_split_prims(struct gl_context *ctx,
* individual primitives.
*/
_tnl_split_inplace(ctx, arrays, prim, nr_prims, ib,
- num_instances, base_instance, draw, limits);
+ min_index, max_index, draw, limits);
}
else {
/* Why were we called? */
@@ -151,7 +149,7 @@ _tnl_split_prims(struct gl_context *ctx,
* otherwise try to split the individual primitives.
*/
_tnl_split_inplace(ctx, arrays, prim, nr_prims, ib,
- num_instances, base_instance, draw, limits);
+ min_index, max_index, draw, limits);
}
else {
/* Why were we called? */
diff --git a/lib/mesa/src/mesa/tnl/t_split.h b/lib/mesa/src/mesa/tnl/t_split.h
index 8f2d1baa5..49017e5df 100644
--- a/lib/mesa/src/mesa/tnl/t_split.h
+++ b/lib/mesa/src/mesa/tnl/t_split.h
@@ -55,8 +55,8 @@ _tnl_split_inplace(struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
- GLuint num_instances,
- GLuint base_instance,
+ GLuint min_index,
+ GLuint max_index,
tnl_draw_func draw,
const struct split_limits *limits);
diff --git a/lib/mesa/src/mesa/tnl/t_split_copy.c b/lib/mesa/src/mesa/tnl/t_split_copy.c
index cee50fc96..085ae9a28 100644
--- a/lib/mesa/src/mesa/tnl/t_split_copy.c
+++ b/lib/mesa/src/mesa/tnl/t_split_copy.c
@@ -33,7 +33,7 @@
#include "main/glheader.h"
#include "main/bufferobj.h"
-
+#include "main/imports.h"
#include "main/glformats.h"
#include "main/macros.h"
#include "main/mtypes.h"
@@ -105,6 +105,13 @@ struct copy_context {
};
+static GLuint
+attr_size(const struct gl_array_attributes *attrib)
+{
+ return attrib->Size * _mesa_sizeof_type(attrib->Type);
+}
+
+
/**
* Shallow copy one vertex array to another.
*/
@@ -146,10 +153,13 @@ check_flush(struct copy_context *copy)
* Dump the parameters/info for a vbo->draw() call.
*/
static void
-dump_draw_info(const struct tnl_vertex_array *arrays,
+dump_draw_info(struct gl_context *ctx,
+ const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
- const struct _mesa_index_buffer *ib)
+ const struct _mesa_index_buffer *ib,
+ GLuint min_index,
+ GLuint max_index)
{
GLuint i, j;
@@ -166,7 +176,7 @@ dump_draw_info(const struct tnl_vertex_array *arrays,
const GLubyte *ptr = _mesa_vertex_attrib_address(attrib, binding);
printf(" array %d at %p:\n", j, (void*) &arrays[j]);
printf(" ptr %p, size %d, type 0x%x, stride %d\n",
- ptr, attrib->Format.Size, attrib->Format.Type, binding->Stride);
+ ptr, attrib->Size, attrib->Type, binding->Stride);
if (0) {
GLint k = prims[i].start + prims[i].count - 1;
GLfloat *last = (GLfloat *) (ptr + binding->Stride * k);
@@ -189,10 +199,13 @@ flush(struct copy_context *copy)
copy->dstib.count = copy->dstelt_nr;
#if 0
- dump_draw_info(copy->dstarray,
+ dump_draw_info(copy->ctx,
+ copy->dstarray,
copy->dstprim,
copy->dstprim_nr,
- &copy->dstib);
+ &copy->dstib,
+ 0,
+ copy->dstbuf_nr);
#else
(void) dump_draw_info;
#endif
@@ -205,8 +218,7 @@ flush(struct copy_context *copy)
GL_TRUE,
0,
copy->dstbuf_nr - 1,
- 1,
- 0);
+ NULL, 0, NULL);
/* Reset all pointers:
*/
@@ -232,6 +244,7 @@ begin(struct copy_context *copy, GLenum mode, GLboolean begin_flag)
prim->mode = mode;
prim->begin = begin_flag;
+ prim->num_instances = 1;
}
@@ -263,11 +276,11 @@ elt(struct copy_context *copy, GLuint elt_idx)
csr += copy->varying[i].size;
#ifdef NAN_CHECK
- if (srcarray->Format.Type == GL_FLOAT) {
+ if (srcarray->Type == GL_FLOAT) {
GLuint k;
GLfloat *f = (GLfloat *) srcptr;
for (k = 0; k < srcarray->Size; k++) {
- assert(!util_is_inf_or_nan(f[k]));
+ assert(!IS_INF_OR_NAN(f[k]));
assert(f[k] <= 1.0e20 && f[k] >= -1.0e20);
}
}
@@ -445,20 +458,16 @@ replay_init(struct copy_context *copy)
copy->varying[j].attr = i;
copy->varying[j].array = &copy->array[i];
- copy->varying[j].size = attrib->Format._ElementSize;
- copy->vertex_size += attrib->Format._ElementSize;
+ copy->varying[j].size = attr_size(attrib);
+ copy->vertex_size += attr_size(attrib);
- if (vbo) {
- if (!_mesa_bufferobj_mapped(vbo, MAP_INTERNAL)) {
- ctx->Driver.MapBufferRange(ctx, 0, vbo->Size, GL_MAP_READ_BIT, vbo,
- MAP_INTERNAL);
- }
+ if (_mesa_is_bufferobj(vbo) &&
+ !_mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
+ ctx->Driver.MapBufferRange(ctx, 0, vbo->Size, GL_MAP_READ_BIT, vbo,
+ MAP_INTERNAL);
- copy->varying[j].src_ptr =
- ADD_POINTERS(vbo->Mappings[MAP_INTERNAL].Pointer, ptr);
- } else {
- copy->varying[j].src_ptr = ptr;
- }
+ copy->varying[j].src_ptr =
+ ADD_POINTERS(vbo->Mappings[MAP_INTERNAL].Pointer, ptr);
copy->dstarray[i].VertexAttrib = &copy->varying[j].dstattribs;
copy->dstarray[i].BufferBinding = &copy->varying[j].dstbinding;
@@ -469,19 +478,17 @@ replay_init(struct copy_context *copy)
* caller convert non-indexed prims to indexed. Could alternately
* do it internally.
*/
- if (copy->ib->obj) {
- if (!_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL))
- ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
- copy->ib->obj, MAP_INTERNAL);
-
- srcptr = (const GLubyte *)
- ADD_POINTERS(copy->ib->obj->Mappings[MAP_INTERNAL].Pointer,
- copy->ib->ptr);
- } else
- srcptr = copy->ib->ptr;
-
- switch (copy->ib->index_size_shift) {
- case 0:
+ if (_mesa_is_bufferobj(copy->ib->obj) &&
+ !_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL))
+ ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
+ copy->ib->obj, MAP_INTERNAL);
+
+ srcptr = (const GLubyte *)
+ ADD_POINTERS(copy->ib->obj->Mappings[MAP_INTERNAL].Pointer,
+ copy->ib->ptr);
+
+ switch (copy->ib->index_size) {
+ case 1:
copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
@@ -489,7 +496,7 @@ replay_init(struct copy_context *copy)
copy->translated_elt_buf[i] = ((const GLubyte *)srcptr)[i];
break;
- case 1:
+ case 2:
copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
@@ -497,7 +504,7 @@ replay_init(struct copy_context *copy)
copy->translated_elt_buf[i] = ((const GLushort *)srcptr)[i];
break;
- case 2:
+ case 4:
copy->translated_elt_buf = NULL;
copy->srcelt = (const GLuint *)srcptr;
break;
@@ -528,10 +535,16 @@ replay_init(struct copy_context *copy)
struct gl_vertex_buffer_binding *dstbind = &copy->varying[i].dstbinding;
struct gl_array_attributes *dstattr = &copy->varying[i].dstattribs;
- dstattr->Format = srcattr->Format;
- dstattr->Ptr = copy->dstbuf + offset;
+ dstattr->Size = srcattr->Size;
+ dstattr->Type = srcattr->Type;
+ dstattr->Format = GL_RGBA;
dstbind->Stride = copy->vertex_size;
- dstbind->BufferObj = NULL;
+ dstattr->Ptr = copy->dstbuf + offset;
+ dstattr->Normalized = srcattr->Normalized;
+ dstattr->Integer = srcattr->Integer;
+ dstattr->Doubles = srcattr->Doubles;
+ dstbind->BufferObj = ctx->Shared->NullBufferObj;
+ dstattr->_ElementSize = srcattr->_ElementSize;
dst->BufferBinding = dstbind;
dst->VertexAttrib = dstattr;
@@ -549,8 +562,8 @@ replay_init(struct copy_context *copy)
* list:
*/
copy->dstib.count = 0; /* duplicates dstelt_nr */
- copy->dstib.index_size_shift = 2;
- copy->dstib.obj = NULL;
+ copy->dstib.index_size = 4;
+ copy->dstib.obj = ctx->Shared->NullBufferObj;
copy->dstib.ptr = copy->dstelt;
}
@@ -573,12 +586,12 @@ replay_finish(struct copy_context *copy)
for (i = 0; i < copy->nr_varying; i++) {
struct gl_buffer_object *vbo =
copy->varying[i].array->BufferBinding->BufferObj;
- if (vbo && _mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
+ if (_mesa_is_bufferobj(vbo) && _mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
ctx->Driver.UnmapBuffer(ctx, vbo, MAP_INTERNAL);
}
/* Unmap index buffer */
- if (copy->ib->obj &&
+ if (_mesa_is_bufferobj(copy->ib->obj) &&
_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL)) {
ctx->Driver.UnmapBuffer(ctx, copy->ib->obj, MAP_INTERNAL);
}
diff --git a/lib/mesa/src/mesa/tnl/t_split_inplace.c b/lib/mesa/src/mesa/tnl/t_split_inplace.c
index 126f6fddf..8e9ecb704 100644
--- a/lib/mesa/src/mesa/tnl/t_split_inplace.c
+++ b/lib/mesa/src/mesa/tnl/t_split_inplace.c
@@ -49,8 +49,6 @@ 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;
@@ -78,7 +76,7 @@ flush_vertex( struct split_context *split)
ib.count = split->max_index - split->min_index + 1;
ib.ptr = (const void *)((const char *)ib.ptr +
- (split->min_index << ib.index_size_shift));
+ split->min_index * ib.index_size);
/* Rebase the primitives to save index buffer entries. */
for (i = 0; i < split->dstprim_nr; i++)
@@ -95,8 +93,7 @@ flush_vertex( struct split_context *split)
!split->ib,
split->min_index,
split->max_index,
- split->num_instances,
- split->base_instance);
+ NULL, 0, NULL);
split->dstprim_nr = 0;
split->min_index = ~0;
@@ -193,6 +190,8 @@ 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);
@@ -226,13 +225,16 @@ split_prims(struct split_context *split)
elts[j] = prim->start + j;
ib.count = count;
- ib.index_size_shift = 2;
- ib.obj = NULL;
+ ib.index_size = 4;
+ ib.obj = split->ctx->Shared->NullBufferObj;
ib.ptr = elts;
tmpprim = *prim;
+ tmpprim.indexed = 1;
tmpprim.start = 0;
tmpprim.count = count;
+ tmpprim.num_instances = 1;
+ tmpprim.base_instance = 0;
flush_vertex(split);
@@ -267,8 +269,8 @@ _tnl_split_inplace(struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
- GLuint num_instances,
- GLuint base_instance,
+ GLuint min_index,
+ GLuint max_index,
tnl_draw_func draw,
const struct split_limits *limits)
{
@@ -285,8 +287,6 @@ _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;
@@ -294,3 +294,5 @@ _tnl_split_inplace(struct gl_context *ctx,
split_prims(&split);
}
+
+
diff --git a/lib/mesa/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp b/lib/mesa/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp
index abf607994..3983a39ed 100644
--- a/lib/mesa/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp
+++ b/lib/mesa/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp
@@ -21,8 +21,6 @@
* IN THE SOFTWARE.
*/
-#undef NDEBUG
-
#include <gtest/gtest.h>
#include "util/bigmath.h"
#include "util/fast_idiv_by_const.h"
@@ -30,6 +28,9 @@
#define RAND_TEST_ITERATIONS 100000
+#define MAX_UINT(bits) \
+ (((bits) == 64) ? UINT64_MAX : ((1ull << (bits)) - 1))
+
static inline uint64_t
utrunc(uint64_t x, unsigned num_bits)
{
@@ -45,7 +46,7 @@ strunc(int64_t x, unsigned num_bits)
if (num_bits == 64)
return x;
- return (int64_t)((uint64_t)x << (64 - num_bits)) >> (64 - num_bits);
+ return (x << (64 - num_bits)) >> (64 - num_bits);
}
static inline bool
@@ -79,7 +80,7 @@ uadd_sat(uint64_t a, uint64_t b, unsigned num_bits)
return sum < a ? UINT64_MAX : sum;
} else {
/* Check if sum is more than num_bits */
- return (sum >> num_bits) ? u_uintN_max(num_bits) : sum;
+ return (sum >> num_bits) ? MAX_UINT(num_bits) : sum;
}
}
@@ -198,7 +199,7 @@ rand_uint(unsigned bits, unsigned min)
if (k == 17) {
return min + (rand() % 16);
} else if (k == 42) {
- return u_uintN_max(bits) - (rand() % 16);
+ return MAX_UINT(bits) - (rand() % 16);
} else if (k == 9) {
uint64_t r;
do {
@@ -227,7 +228,7 @@ rand_sint(unsigned bits, unsigned min_abs)
{
/* Make sure we hit MIN_INT every once in a while */
if (rand() % 64 == 37)
- return u_intN_min(bits);
+ return -(1 << (bits - 1));
int64_t s = rand_uint(bits - 1, min_abs);
return rand() & 1 ? s : -s;
@@ -303,7 +304,7 @@ random_sdiv_test(unsigned bits)
int64_t d;
do {
d = rand_sint(bits, 2);
- } while (d == INT64_MIN || util_is_power_of_two_or_zero64(llabs(d)));
+ } while (util_is_power_of_two_or_zero64(llabs(d)));
assert(sint_is_in_range(n, bits));
assert(sint_is_in_range(d, bits) && llabs(d) >= 2);
diff --git a/lib/mesa/src/util/tests/fast_idiv_by_const/meson.build b/lib/mesa/src/util/tests/fast_idiv_by_const/meson.build
index 9c8c03d97..8c3b79493 100644
--- a/lib/mesa/src/util/tests/fast_idiv_by_const/meson.build
+++ b/lib/mesa/src/util/tests/fast_idiv_by_const/meson.build
@@ -23,9 +23,8 @@ test(
executable(
'fast_idiv_by_const_test',
'fast_idiv_by_const_test.cpp',
- dependencies : [idep_gtest, idep_mesautil],
- include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
- ),
- suite : ['util'],
- timeout: 60,
+ dependencies : [dep_thread, dep_dl, idep_gtest],
+ include_directories : inc_common,
+ link_with : [libmesa_util],
+ )
)
diff --git a/lib/mesa/src/util/tests/set/meson.build b/lib/mesa/src/util/tests/set/meson.build
index e9b00629b..add3fc560 100644
--- a/lib/mesa/src/util/tests/set/meson.build
+++ b/lib/mesa/src/util/tests/set/meson.build
@@ -23,8 +23,8 @@ test(
executable(
'set_test',
'set_test.cpp',
- dependencies : [dep_thread, dep_dl, idep_gtest, idep_mesautil],
- include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
- ),
- suite : ['util'],
+ dependencies : [dep_thread, dep_dl, idep_gtest],
+ include_directories : inc_common,
+ link_with : [libmesa_util],
+ )
)
diff --git a/lib/mesa/src/util/tests/set/set_test.cpp b/lib/mesa/src/util/tests/set/set_test.cpp
index 67e3085ee..a1eef0b3d 100644
--- a/lib/mesa/src/util/tests/set/set_test.cpp
+++ b/lib/mesa/src/util/tests/set/set_test.cpp
@@ -51,27 +51,6 @@ TEST(set, basic)
entry = _mesa_set_search(s, a);
EXPECT_FALSE(entry);
- _mesa_set_clear(s, NULL);
- EXPECT_EQ(s->entries, 0);
- EXPECT_EQ(s->deleted_entries, 0);
- set_foreach(s, he) {
- GTEST_FAIL();
- }
-
- _mesa_set_add(s, a);
- _mesa_set_add(s, b);
- EXPECT_EQ(s->entries, 2);
- unsigned count = s->entries;
- set_foreach_remove(s, he) {
- EXPECT_TRUE(he->key == a || he->key == b);
- EXPECT_EQ(s->entries, count--);
- EXPECT_EQ(s->deleted_entries, 0);
- }
- EXPECT_EQ(s->entries, 0);
- set_foreach(s, he) {
- GTEST_FAIL();
- }
-
_mesa_set_destroy(s, NULL);
}
@@ -134,40 +113,3 @@ TEST(set, remove_key)
_mesa_set_destroy(s, NULL);
}
-
-static uint32_t hash_int(const void *p)
-{
- int i = *(const int *)p;
- return i;
-}
-
-static bool cmp_int(const void *p1, const void *p2)
-{
- int i1 = *(const int *)p1, i2 = *(const int *)p2;
- return i1 == i2;
-}
-
-TEST(set, search_or_add)
-{
- struct set *s = _mesa_set_create(NULL, hash_int, cmp_int);
-
- int a = 10, b = 20, c = 20, d = 30;
-
- _mesa_set_add(s, &a);
- _mesa_set_add(s, &b);
- EXPECT_EQ(s->entries, 2);
-
- bool found = false;
- struct set_entry *entry = _mesa_set_search_or_add(s, &c, &found);
- EXPECT_EQ(entry->key, (void *)&b);
- EXPECT_EQ(found, true);
- EXPECT_EQ(s->entries, 2);
-
- found = false;
- struct set_entry *entry3 = _mesa_set_search_or_add(s, &d, &found);
- EXPECT_EQ(entry3->key, &d);
- EXPECT_EQ(found, false);
- EXPECT_EQ(s->entries, 3);
-
- _mesa_set_destroy(s, NULL);
-}
diff --git a/lib/mesa/src/util/tests/string_buffer/meson.build b/lib/mesa/src/util/tests/string_buffer/meson.build
index acb6abca4..9f42e3550 100644
--- a/lib/mesa/src/util/tests/string_buffer/meson.build
+++ b/lib/mesa/src/util/tests/string_buffer/meson.build
@@ -23,9 +23,8 @@ test(
executable(
'string_buffer_test',
'string_buffer_test.cpp',
- cpp_args : [cpp_msvc_compat_args],
- dependencies : [idep_gtest, idep_mesautil],
- include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
- ),
- suite : ['util'],
+ dependencies : [dep_thread, dep_dl, idep_gtest],
+ include_directories : inc_common,
+ link_with : [libmesa_util],
+ )
)