aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
committermarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
commit8574eba804031f6b19713f0b02952280730bf62e (patch)
tree9afa4d6fe299d43ab7e580dc08a5547120274561 /mesalib/src/mesa/vbo
parenteef70231353a6103f47fcae88a6e89e765e5cd47 (diff)
downloadvcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.gz
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.bz2
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.zip
fontconfig mesa git update 5 Mar 2015
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo.h8
-rw-r--r--mesalib/src/mesa/vbo/vbo_attrib_tmp.h22
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c6
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.h28
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h11
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c52
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c8
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c17
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_eval.c32
-rw-r--r--mesalib/src/mesa/vbo/vbo_rebase.c1
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.h18
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c38
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c10
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_loopback.c1
-rw-r--r--mesalib/src/mesa/vbo/vbo_split_copy.c2
15 files changed, 146 insertions, 108 deletions
diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h
index 6e1a4aa1a..54dee6c46 100644
--- a/mesalib/src/mesa/vbo/vbo.h
+++ b/mesalib/src/mesa/vbo/vbo.h
@@ -35,6 +35,10 @@
#include <stdbool.h>
#include "main/glheader.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct gl_client_array;
struct gl_context;
struct gl_transform_feedback_object;
@@ -228,4 +232,8 @@ _es_VertexAttrib3fv(GLuint indx, const GLfloat* values);
void GLAPIENTRY
_es_VertexAttrib4fv(GLuint indx, const GLfloat* values);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif
diff --git a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
index 0c44540fc..b1c3d9842 100644
--- a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "util/u_format_r11g11b10f.h"
#include "main/varray.h"
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 ) \
+ ATTR_##T((A), (N), (T), (V0), (V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), \
+ UINT_AS_UNION(V2), UINT_AS_UNION(V3))
+#define ATTR_GL_INT( A, N, T, V0, V1, V2, V3 ) \
+ ATTR_UNION(A, N, T, INT_AS_UNION(V0), INT_AS_UNION(V1), \
+ INT_AS_UNION(V2), INT_AS_UNION(V3))
+#define ATTR_GL_FLOAT( A, N, T, V0, V1, V2, V3 ) \
+ ATTR_UNION(A, N, T, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1),\
+ FLOAT_AS_UNION(V2), FLOAT_AS_UNION(V3))
+
+
/* float */
#define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
#define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
@@ -41,8 +57,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* int */
#define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
- INT_AS_FLT(X), INT_AS_FLT(Y), \
- INT_AS_FLT(Z), INT_AS_FLT(W) )
+ X, Y, Z, W )
#define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
#define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
@@ -56,8 +71,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* uint */
#define ATTRUI( A, N, X, Y, Z, W) ATTR( A, N, GL_UNSIGNED_INT, \
- UINT_AS_FLT(X), UINT_AS_FLT(Y), \
- UINT_AS_FLT(Z), UINT_AS_FLT(W) )
+ X, Y, Z, W )
#define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0], (V)[1], 0, 1 )
#define ATTR3UIV( A, V ) ATTRUI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index 19712aa58..fd1ffe2f7 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -108,7 +108,7 @@ static void init_mat_currval(struct gl_context *ctx)
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT];
GLuint i;
- ASSERT(NR_MAT_ATTRIBS == MAT_ATTRIB_MAX);
+ assert(NR_MAT_ATTRIBS == MAT_ATTRIB_MAX);
memset(arrays, 0, sizeof(*arrays) * NR_MAT_ATTRIBS);
@@ -172,14 +172,14 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
GLuint i;
/* identity mapping */
- for (i = 0; i < Elements(vbo->map_vp_none); i++)
+ for (i = 0; i < ARRAY_SIZE(vbo->map_vp_none); i++)
vbo->map_vp_none[i] = i;
/* map material attribs to generic slots */
for (i = 0; i < NR_MAT_ATTRIBS; i++)
vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)]
= VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
- for (i = 0; i < Elements(vbo->map_vp_arb); i++)
+ for (i = 0; i < ARRAY_SIZE(vbo->map_vp_arb); i++)
vbo->map_vp_arb[i] = i;
}
diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h
index e22451305..6099b56e6 100644
--- a/mesalib/src/mesa/vbo/vbo_context.h
+++ b/mesalib/src/mesa/vbo/vbo_context.h
@@ -56,6 +56,11 @@
#include "vbo_exec.h"
#include "vbo_save.h"
+#include "main/macros.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
struct vbo_context {
struct gl_client_array currval[VBO_ATTRIB_MAX];
@@ -124,7 +129,7 @@ vbo_draw_method(struct vbo_context *vbo, gl_draw_method method)
ctx->Array._DrawArrays = vbo->save.inputs;
break;
default:
- ASSERT(0);
+ assert(0);
}
ctx->NewDriverState |= ctx->DriverFlags.NewArray;
@@ -146,33 +151,36 @@ vbo_attrtype_to_integer_flag(GLenum format)
case GL_UNSIGNED_INT:
return GL_TRUE;
default:
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
}
-
/**
* Return default component values for the given format.
- * The return type is an array of floats, because that's how we declare
- * the vertex storage despite the fact we sometimes store integers in there.
+ * The return type is an array of fi_types, because that's how we declare
+ * the vertex storage : floats , integers or unsigned integers.
*/
-static inline const GLfloat *
-vbo_get_default_vals_as_float(GLenum format)
+static inline const fi_type *
+vbo_get_default_vals_as_union(GLenum format)
{
static const GLfloat default_float[4] = { 0, 0, 0, 1 };
static const GLint default_int[4] = { 0, 0, 0, 1 };
switch (format) {
case GL_FLOAT:
- return default_float;
+ return (fi_type *)default_float;
case GL_INT:
case GL_UNSIGNED_INT:
- return (const GLfloat*)default_int;
+ return (fi_type *)default_int;
default:
- ASSERT(0);
+ assert(0);
return NULL;
}
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index bb265def8..f17fe684c 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vbo.h"
#include "vbo_attrib.h"
+#include "main/imports.h"
/**
* Max number of primitives (number of glBegin/End pairs) per VBO.
@@ -71,7 +72,7 @@ struct vbo_exec_eval2_map {
struct vbo_exec_copied_vtx {
- GLfloat buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS];
+ fi_type buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS];
GLuint nr;
};
@@ -91,10 +92,10 @@ struct vbo_exec_context
struct _mesa_prim prim[VBO_MAX_PRIM];
GLuint prim_count;
- GLfloat *buffer_map;
- GLfloat *buffer_ptr; /* cursor, points into buffer */
+ fi_type *buffer_map;
+ fi_type *buffer_ptr; /* cursor, points into buffer */
GLuint buffer_used; /* in bytes */
- GLfloat vertex[VBO_ATTRIB_MAX*4]; /* current vertex */
+ fi_type vertex[VBO_ATTRIB_MAX*4]; /* current vertex */
GLuint vert_count;
GLuint max_vert;
@@ -104,7 +105,7 @@ struct vbo_exec_context
GLenum attrtype[VBO_ATTRIB_MAX];
GLubyte active_sz[VBO_ATTRIB_MAX];
- GLfloat *attrptr[VBO_ATTRIB_MAX];
+ fi_type *attrptr[VBO_ATTRIB_MAX];
struct gl_client_array arrays[VERT_ATTRIB_MAX];
/* According to program mode, the values above plus current
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 5f8250e78..9669abe7d 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -115,7 +115,7 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec )
*/
void vbo_exec_vtx_wrap( struct vbo_exec_context *exec )
{
- GLfloat *data = exec->vtx.copied.buffer;
+ fi_type *data = exec->vtx.copied.buffer;
GLuint i;
/* Run pipeline on current vertices, copy wrapped vertices
@@ -159,9 +159,9 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec )
* ctx->Current.Attrib and ctx->Light.Material.Attrib arrays.
*/
GLfloat *current = (GLfloat *)vbo->currval[i].Ptr;
- GLfloat tmp[4];
+ fi_type tmp[4];
- COPY_CLEAN_4V_TYPE_AS_FLOAT(tmp,
+ COPY_CLEAN_4V_TYPE_AS_UNION(tmp,
exec->vtx.attrsz[i],
exec->vtx.attrptr[i],
exec->vtx.attrtype[i]);
@@ -214,7 +214,7 @@ vbo_exec_copy_from_current(struct vbo_exec_context *exec)
GLint i;
for (i = VBO_ATTRIB_POS + 1; i < VBO_ATTRIB_MAX; i++) {
- const GLfloat *current = (GLfloat *) vbo->currval[i].Ptr;
+ const fi_type *current = (fi_type *) vbo->currval[i].Ptr;
switch (exec->vtx.attrsz[i]) {
case 4: exec->vtx.attrptr[i][3] = current[3];
case 3: exec->vtx.attrptr[i][2] = current[2];
@@ -240,7 +240,7 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
struct gl_context *ctx = exec->ctx;
struct vbo_context *vbo = vbo_context(ctx);
const GLint lastcount = exec->vtx.vert_count;
- GLfloat *old_attrptr[VBO_ATTRIB_MAX];
+ fi_type *old_attrptr[VBO_ATTRIB_MAX];
const GLuint old_vtx_size = exec->vtx.vertex_size; /* floats per vertex */
const GLuint oldSize = exec->vtx.attrsz[attr];
GLuint i;
@@ -287,7 +287,7 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
if (unlikely(oldSize)) {
/* Size changed, recalculate all the attrptr[] values
*/
- GLfloat *tmp = exec->vtx.vertex;
+ fi_type *tmp = exec->vtx.vertex;
for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) {
if (exec->vtx.attrsz[i]) {
@@ -306,7 +306,7 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
else {
/* Just have to append the new attribute at the end */
exec->vtx.attrptr[attr] = exec->vtx.vertex +
- exec->vtx.vertex_size - newSize;
+ exec->vtx.vertex_size - newSize;
}
/* Replay stored vertices to translate them
@@ -315,8 +315,8 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
* -- No need to replay - just copy piecewise
*/
if (unlikely(exec->vtx.copied.nr)) {
- GLfloat *data = exec->vtx.copied.buffer;
- GLfloat *dest = exec->vtx.buffer_ptr;
+ fi_type *data = exec->vtx.copied.buffer;
+ fi_type *dest = exec->vtx.buffer_ptr;
GLuint j;
assert(exec->vtx.buffer_ptr == exec->vtx.buffer_map);
@@ -331,13 +331,13 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
if (j == attr) {
if (oldSize) {
- GLfloat tmp[4];
- COPY_CLEAN_4V_TYPE_AS_FLOAT(tmp, oldSize,
+ fi_type tmp[4];
+ COPY_CLEAN_4V_TYPE_AS_UNION(tmp, oldSize,
data + old_offset,
exec->vtx.attrtype[j]);
COPY_SZ_4V(dest + new_offset, newSize, tmp);
} else {
- GLfloat *current = (GLfloat *)vbo->currval[j].Ptr;
+ fi_type *current = (fi_type *)vbo->currval[j].Ptr;
COPY_SZ_4V(dest + new_offset, sz, current);
}
}
@@ -376,14 +376,14 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr, GLuint newSize)
}
else if (newSize < exec->vtx.active_sz[attr]) {
GLuint i;
- const GLfloat *id =
- vbo_get_default_vals_as_float(exec->vtx.attrtype[attr]);
+ const fi_type *id =
+ vbo_get_default_vals_as_union(exec->vtx.attrtype[attr]);
/* New size is smaller - just need to fill in some
* zeros. Don't need to flush or wrap.
*/
for (i = newSize; i <= exec->vtx.attrsz[attr]; i++)
- exec->vtx.attrptr[attr][i-1] = id[i-1];
+ exec->vtx.attrptr[attr][i-1] = id[i-1];
}
exec->vtx.active_sz[attr] = newSize;
@@ -401,7 +401,7 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr, GLuint newSize)
* This macro is used to implement all the glVertex, glColor, glTexCoord,
* glVertexAttrib, etc functions.
*/
-#define ATTR( A, N, T, V0, V1, V2, V3 ) \
+#define ATTR_UNION( A, N, T, V0, V1, V2, V3 ) \
do { \
struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \
\
@@ -412,12 +412,12 @@ do { \
vbo_exec_fixup_vertex(ctx, A, N); \
\
{ \
- GLfloat *dest = exec->vtx.attrptr[A]; \
+ fi_type *dest = exec->vtx.attrptr[A]; \
if (N>0) dest[0] = V0; \
if (N>1) dest[1] = V1; \
if (N>2) dest[2] = V2; \
if (N>3) dest[3] = V3; \
- exec->vtx.attrtype[A] = T; \
+ exec->vtx.attrtype[A] = T; \
} \
\
if ((A) == 0) { \
@@ -1036,7 +1036,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
&exec->vtx.bufferobj,
ctx->Shared->NullBufferObj);
- ASSERT(!exec->vtx.buffer_map);
+ assert(!exec->vtx.buffer_map);
exec->vtx.buffer_map = _mesa_align_malloc(VBO_VERT_BUFFER_SIZE, 64);
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
@@ -1044,16 +1044,16 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
_mesa_noop_vtxfmt_init(&exec->vtxfmt_noop);
for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) {
- ASSERT(i < Elements(exec->vtx.attrsz));
+ assert(i < ARRAY_SIZE(exec->vtx.attrsz));
exec->vtx.attrsz[i] = 0;
- ASSERT(i < Elements(exec->vtx.attrtype));
+ assert(i < ARRAY_SIZE(exec->vtx.attrtype));
exec->vtx.attrtype[i] = GL_FLOAT;
- ASSERT(i < Elements(exec->vtx.active_sz));
+ assert(i < ARRAY_SIZE(exec->vtx.active_sz));
exec->vtx.active_sz[i] = 0;
}
for (i = 0 ; i < VERT_ATTRIB_MAX; i++) {
- ASSERT(i < Elements(exec->vtx.inputs));
- ASSERT(i < Elements(exec->vtx.arrays));
+ assert(i < ARRAY_SIZE(exec->vtx.inputs));
+ assert(i < ARRAY_SIZE(exec->vtx.arrays));
exec->vtx.inputs[i] = &exec->vtx.arrays[i];
}
@@ -1099,7 +1099,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
/* True VBOs should already be unmapped
*/
if (exec->vtx.buffer_map) {
- ASSERT(exec->vtx.bufferobj->Name == 0 ||
+ assert(exec->vtx.bufferobj->Name == 0 ||
exec->vtx.bufferobj->Name == IMM_BUFFER_NAME);
if (exec->vtx.bufferobj->Name == 0) {
_mesa_align_free(exec->vtx.buffer_map);
@@ -1110,7 +1110,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
/* Drop any outstanding reference to the vertex buffer
*/
- for (i = 0; i < Elements(exec->vtx.arrays); i++) {
+ for (i = 0; i < ARRAY_SIZE(exec->vtx.arrays); i++) {
_mesa_reference_buffer_object(ctx,
&exec->vtx.arrays[i].BufferObj,
NULL);
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index c16fe77ee..3ea775c0e 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -26,6 +26,7 @@
*
**************************************************************************/
+#include <stdio.h>
#include "main/glheader.h"
#include "main/context.h"
#include "main/state.h"
@@ -181,8 +182,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
break;
}
default:
- assert(0);
- break;
+ unreachable("not reached");
}
if (_mesa_is_bufferobj(ib->obj)) {
@@ -331,7 +331,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
}
/* check element j of each enabled array */
- for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
+ for (k = 0; k < ARRAY_SIZE(vao->_VertexAttrib); k++) {
check_array_data(ctx, &vao->_VertexAttrib[k], k, j);
}
}
@@ -341,7 +341,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
MAP_INTERNAL);
}
- for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
+ for (k = 0; k < ARRAY_SIZE(vao->_VertexAttrib); k++) {
unmap_array_buffer(ctx, &vao->_VertexAttrib[k]);
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index 362cc1040..91f2ca43a 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -25,6 +25,7 @@
* Keith Whitwell <keithw@vmware.com>
*/
+#include <stdio.h>
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/compiler.h"
@@ -73,8 +74,8 @@ vbo_copy_vertices( struct vbo_exec_context *exec )
GLuint nr = exec->vtx.prim[exec->vtx.prim_count-1].count;
GLuint ovf, i;
GLuint sz = exec->vtx.vertex_size;
- GLfloat *dst = exec->vtx.copied.buffer;
- const GLfloat *src = (exec->vtx.buffer_map +
+ fi_type *dst = exec->vtx.copied.buffer;
+ const fi_type *src = (exec->vtx.buffer_map +
exec->vtx.prim[exec->vtx.prim_count-1].start *
exec->vtx.vertex_size);
@@ -172,7 +173,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
- ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
+ assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
}
@@ -183,7 +184,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
- ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
+ assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
&vbo->currval[VBO_ATTRIB_GENERIC0+attr];
}
@@ -213,8 +214,8 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
(GLbyte *)exec->vtx.vertex;
/* override the default array set above */
- ASSERT(attr < Elements(exec->vtx.inputs));
- ASSERT(attr < Elements(exec->vtx.arrays)); /* arrays[] */
+ assert(attr < ARRAY_SIZE(exec->vtx.inputs));
+ assert(attr < ARRAY_SIZE(exec->vtx.arrays)); /* arrays[] */
exec->vtx.inputs[attr] = &arrays[attr];
if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
@@ -309,7 +310,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
/* The VBO exists and there's room for more */
if (exec->vtx.bufferobj->Size > 0) {
exec->vtx.buffer_map =
- (GLfloat *)ctx->Driver.MapBufferRange(ctx,
+ (fi_type *)ctx->Driver.MapBufferRange(ctx,
exec->vtx.buffer_used,
(VBO_VERT_BUFFER_SIZE -
exec->vtx.buffer_used),
@@ -336,7 +337,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
exec->vtx.bufferobj)) {
/* buffer allocation worked, now map the buffer */
exec->vtx.buffer_map =
- (GLfloat *)ctx->Driver.MapBufferRange(ctx,
+ (fi_type *)ctx->Driver.MapBufferRange(ctx,
0, VBO_VERT_BUFFER_SIZE,
accessRange,
exec->vtx.bufferobj,
diff --git a/mesalib/src/mesa/vbo/vbo_exec_eval.c b/mesalib/src/mesa/vbo/vbo_exec_eval.c
index 82f89b95f..b26655bd5 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_eval.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_eval.c
@@ -35,20 +35,20 @@
static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr )
{
- assert(attr < Elements(exec->eval.map1));
+ assert(attr < ARRAY_SIZE(exec->eval.map1));
exec->eval.map1[attr].map = NULL;
}
static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr )
{
- assert(attr < Elements(exec->eval.map2));
+ assert(attr < ARRAY_SIZE(exec->eval.map2));
exec->eval.map2[attr].map = NULL;
}
static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
struct gl_1d_map *map )
{
- assert(attr < Elements(exec->eval.map1));
+ assert(attr < ARRAY_SIZE(exec->eval.map1));
if (!exec->eval.map1[attr].map) {
exec->eval.map1[attr].map = map;
exec->eval.map1[attr].sz = dim;
@@ -58,7 +58,7 @@ static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint
static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
struct gl_2d_map *map )
{
- assert(attr < Elements(exec->eval.map2));
+ assert(attr < ARRAY_SIZE(exec->eval.map2));
if (!exec->eval.map2[attr].map) {
exec->eval.map2[attr].map = map;
exec->eval.map2[attr].sz = dim;
@@ -130,11 +130,12 @@ void vbo_exec_do_EvalCoord1f(struct vbo_exec_context *exec, GLfloat u)
struct gl_1d_map *map = exec->eval.map1[attr].map;
if (map) {
GLfloat uu = (u - map->u1) * map->du;
- GLfloat data[4];
+ fi_type data[4];
- ASSIGN_4V(data, 0, 0, 0, 1);
+ ASSIGN_4V(data, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0),
+ FLOAT_AS_UNION(0), FLOAT_AS_UNION(1));
- _math_horner_bezier_curve(map->Points, data, uu,
+ _math_horner_bezier_curve(map->Points, &data[0].f, uu,
exec->eval.map1[attr].sz,
map->Order);
@@ -176,12 +177,13 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
if (map) {
GLfloat uu = (u - map->u1) * map->du;
GLfloat vv = (v - map->v1) * map->dv;
- GLfloat data[4];
+ fi_type data[4];
- ASSIGN_4V(data, 0, 0, 0, 1);
+ ASSIGN_4V(data, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0),
+ FLOAT_AS_UNION(0), FLOAT_AS_UNION(1));
_math_horner_bezier_surf(map->Points,
- data,
+ &data[0].f,
uu, vv,
exec->eval.map2[attr].sz,
map->Uorder, map->Vorder);
@@ -203,7 +205,7 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
ASSIGN_4V(vertex, 0, 0, 0, 1);
if (exec->ctx->Eval.AutoNormal) {
- GLfloat normal[4];
+ fi_type normal[4];
GLfloat du[4], dv[4];
_math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv,
@@ -221,11 +223,11 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
}
- CROSS3(normal, du, dv);
- NORMALIZE_3FV(normal);
- normal[3] = 1.0;
+ CROSS3(&normal[0].f, du, dv);
+ NORMALIZE_3FV(&normal[0].f);
+ normal[3] = FLOAT_AS_UNION(1.0);
- COPY_SZ_4V( exec->vtx.attrptr[VBO_ATTRIB_NORMAL],
+ COPY_SZ_4V( exec->vtx.attrptr[VBO_ATTRIB_NORMAL],
exec->vtx.attrsz[VBO_ATTRIB_NORMAL],
normal );
diff --git a/mesalib/src/mesa/vbo/vbo_rebase.c b/mesalib/src/mesa/vbo/vbo_rebase.c
index 82a0b8e2b..b06df4ab2 100644
--- a/mesalib/src/mesa/vbo/vbo_rebase.c
+++ b/mesalib/src/mesa/vbo/vbo_rebase.c
@@ -46,6 +46,7 @@
* of zero.
*/
+#include <stdio.h>
#include "main/glheader.h"
#include "main/imports.h"
#include "main/mtypes.h"
diff --git a/mesalib/src/mesa/vbo/vbo_save.h b/mesalib/src/mesa/vbo/vbo_save.h
index fd26b5f61..5b1ac8177 100644
--- a/mesalib/src/mesa/vbo/vbo_save.h
+++ b/mesalib/src/mesa/vbo/vbo_save.h
@@ -40,7 +40,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
struct vbo_save_copied_vtx {
- GLfloat buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS];
+ fi_type buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS];
GLuint nr;
};
@@ -69,7 +69,7 @@ struct vbo_save_vertex_list {
* Keep this in regular (non-VBO) memory to avoid repeated
* map/unmap of the VBO when updating GL current data.
*/
- GLfloat *current_data;
+ fi_type *current_data;
GLuint current_size;
GLuint buffer_offset;
@@ -107,7 +107,7 @@ struct vbo_save_vertex_list {
*/
struct vbo_save_vertex_store {
struct gl_buffer_object *bufferobj;
- GLfloat *buffer;
+ fi_type *buffer;
GLuint used;
GLuint refcount;
};
@@ -133,7 +133,7 @@ struct vbo_save_context {
GLboolean out_of_memory; /**< True if last VBO allocation failed */
- GLfloat *buffer;
+ fi_type *buffer;
GLuint count;
GLuint wrap_count;
GLuint replay_flags;
@@ -144,9 +144,9 @@ struct vbo_save_context {
struct vbo_save_vertex_store *vertex_store;
struct vbo_save_primitive_store *prim_store;
- GLfloat *buffer_ptr; /* cursor, points into buffer */
- GLfloat vertex[VBO_ATTRIB_MAX*4]; /* current values */
- GLfloat *attrptr[VBO_ATTRIB_MAX];
+ fi_type *buffer_ptr; /* cursor, points into buffer */
+ fi_type vertex[VBO_ATTRIB_MAX*4]; /* current values */
+ fi_type *attrptr[VBO_ATTRIB_MAX];
GLuint vert_count;
GLuint max_vert;
GLboolean dangling_attr_ref;
@@ -155,7 +155,7 @@ struct vbo_save_context {
struct vbo_save_copied_vtx copied;
- GLfloat *current[VBO_ATTRIB_MAX]; /* points into ctx->ListState */
+ fi_type *current[VBO_ATTRIB_MAX]; /* points into ctx->ListState */
GLubyte *currentsz[VBO_ATTRIB_MAX];
};
@@ -186,7 +186,7 @@ void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data );
void vbo_save_api_init( struct vbo_save_context *save );
-GLfloat *
+fi_type *
vbo_save_map_vertex_store(struct gl_context *ctx,
struct vbo_save_vertex_store *vertex_store);
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index beef342be..fd9a5de3d 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -99,14 +99,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
static GLuint
_save_copy_vertices(struct gl_context *ctx,
const struct vbo_save_vertex_list *node,
- const GLfloat * src_buffer)
+ const fi_type * src_buffer)
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
const struct _mesa_prim *prim = &node->prim[node->prim_count - 1];
GLuint nr = prim->count;
GLuint sz = save->vertex_size;
- const GLfloat *src = src_buffer + prim->start * sz;
- GLfloat *dst = save->copied.buffer;
+ const fi_type *src = src_buffer + prim->start * sz;
+ fi_type *dst = save->copied.buffer;
GLuint ovf, i;
if (prim->end)
@@ -233,7 +233,7 @@ free_vertex_store(struct gl_context *ctx,
}
-GLfloat *
+fi_type *
vbo_save_map_vertex_store(struct gl_context *ctx,
struct vbo_save_vertex_store *vertex_store)
{
@@ -249,7 +249,7 @@ vbo_save_map_vertex_store(struct gl_context *ctx,
/* Map the remaining free space in the VBO */
GLintptr offset = vertex_store->used * sizeof(GLfloat);
GLsizeiptr size = vertex_store->bufferobj->Size - offset;
- GLfloat *range = (GLfloat *)
+ fi_type *range = (fi_type *)
ctx->Driver.MapBufferRange(ctx, offset, size, access,
vertex_store->bufferobj,
MAP_INTERNAL);
@@ -549,7 +549,7 @@ static void
_save_wrap_filled_vertex(struct gl_context *ctx)
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
- GLfloat *data = save->copied.buffer;
+ fi_type *data = save->copied.buffer;
GLuint i;
/* Emit a glEnd to close off the last vertex list.
@@ -578,7 +578,7 @@ _save_copy_to_current(struct gl_context *ctx)
for (i = VBO_ATTRIB_POS + 1; i < VBO_ATTRIB_MAX; i++) {
if (save->attrsz[i]) {
save->currentsz[i][0] = save->attrsz[i];
- COPY_CLEAN_4V_TYPE_AS_FLOAT(save->current[i], save->attrsz[i],
+ COPY_CLEAN_4V_TYPE_AS_UNION(save->current[i], save->attrsz[i],
save->attrptr[i], save->attrtype[i]);
}
}
@@ -620,7 +620,7 @@ _save_upgrade_vertex(struct gl_context *ctx, GLuint attr, GLuint newsz)
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLuint oldsz;
GLuint i;
- GLfloat *tmp;
+ fi_type *tmp;
/* Store the current run of vertices, and emit a GL_END. Emit a
* BEGIN in the new buffer.
@@ -669,8 +669,8 @@ _save_upgrade_vertex(struct gl_context *ctx, GLuint attr, GLuint newsz)
* and will need fixup at runtime.
*/
if (save->copied.nr) {
- const GLfloat *data = save->copied.buffer;
- GLfloat *dest = save->buffer;
+ const fi_type *data = save->copied.buffer;
+ fi_type *dest = save->buffer;
GLuint j;
/* Need to note this and fix up at runtime (or loopback):
@@ -685,7 +685,7 @@ _save_upgrade_vertex(struct gl_context *ctx, GLuint attr, GLuint newsz)
if (save->attrsz[j]) {
if (j == attr) {
if (oldsz) {
- COPY_CLEAN_4V_TYPE_AS_FLOAT(dest, oldsz, data,
+ COPY_CLEAN_4V_TYPE_AS_UNION(dest, oldsz, data,
save->attrtype[j]);
data += oldsz;
dest += newsz;
@@ -729,7 +729,7 @@ save_fixup_vertex(struct gl_context *ctx, GLuint attr, GLuint sz)
}
else if (sz < save->active_sz[attr]) {
GLuint i;
- const GLfloat *id = vbo_get_default_vals_as_float(save->attrtype[attr]);
+ const fi_type *id = vbo_get_default_vals_as_union(save->attrtype[attr]);
/* New size is equal or smaller - just need to fill in some
* zeros.
@@ -772,7 +772,7 @@ _save_reset_vertex(struct gl_context *ctx)
* 3f version won't otherwise set color[3] to 1.0 -- this is the job
* of the chooser function when switching between Color4f and Color3f.
*/
-#define ATTR(A, N, T, V0, V1, V2, V3) \
+#define ATTR_UNION(A, N, T, V0, V1, V2, V3) \
do { \
struct vbo_save_context *save = &vbo_context(ctx)->save; \
\
@@ -780,12 +780,12 @@ do { \
save_fixup_vertex(ctx, A, N); \
\
{ \
- GLfloat *dest = save->attrptr[A]; \
+ fi_type *dest = save->attrptr[A]; \
if (N>0) dest[0] = V0; \
if (N>1) dest[1] = V1; \
if (N>2) dest[2] = V2; \
if (N>3) dest[3] = V3; \
- save->attrtype[A] = T; \
+ save->attrtype[A] = T; \
} \
\
if ((A) == 0) { \
@@ -1564,16 +1564,16 @@ _save_current_init(struct gl_context *ctx)
for (i = VBO_ATTRIB_POS; i <= VBO_ATTRIB_GENERIC15; i++) {
const GLuint j = i - VBO_ATTRIB_POS;
- ASSERT(j < VERT_ATTRIB_MAX);
+ assert(j < VERT_ATTRIB_MAX);
save->currentsz[i] = &ctx->ListState.ActiveAttribSize[j];
- save->current[i] = ctx->ListState.CurrentAttrib[j];
+ save->current[i] = (fi_type *) ctx->ListState.CurrentAttrib[j];
}
for (i = VBO_ATTRIB_FIRST_MATERIAL; i <= VBO_ATTRIB_LAST_MATERIAL; i++) {
const GLuint j = i - VBO_ATTRIB_FIRST_MATERIAL;
- ASSERT(j < MAT_ATTRIB_MAX);
+ assert(j < MAT_ATTRIB_MAX);
save->currentsz[i] = &ctx->ListState.ActiveMaterialSize[j];
- save->current[i] = ctx->ListState.CurrentMaterial[j];
+ save->current[i] = (fi_type *) ctx->ListState.CurrentMaterial[j];
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index d0521d794..74e266d19 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -47,8 +47,8 @@ _playback_copy_to_current(struct gl_context *ctx,
const struct vbo_save_vertex_list *node)
{
struct vbo_context *vbo = vbo_context(ctx);
- GLfloat vertex[VBO_ATTRIB_MAX * 4];
- GLfloat *data;
+ fi_type vertex[VBO_ATTRIB_MAX * 4];
+ fi_type *data;
GLuint i, offset;
if (node->current_size == 0)
@@ -75,10 +75,10 @@ _playback_copy_to_current(struct gl_context *ctx,
for (i = VBO_ATTRIB_POS+1 ; i < VBO_ATTRIB_MAX ; i++) {
if (node->attrsz[i]) {
- GLfloat *current = (GLfloat *)vbo->currval[i].Ptr;
- GLfloat tmp[4];
+ fi_type *current = (fi_type *)vbo->currval[i].Ptr;
+ fi_type tmp[4];
- COPY_CLEAN_4V_TYPE_AS_FLOAT(tmp,
+ COPY_CLEAN_4V_TYPE_AS_UNION(tmp,
node->attrsz[i],
data,
node->attrtype[i]);
diff --git a/mesalib/src/mesa/vbo/vbo_save_loopback.c b/mesalib/src/mesa/vbo/vbo_save_loopback.c
index 8c93ae86a..7410f1875 100644
--- a/mesalib/src/mesa/vbo/vbo_save_loopback.c
+++ b/mesalib/src/mesa/vbo/vbo_save_loopback.c
@@ -25,6 +25,7 @@
*
**************************************************************************/
+#include <stdio.h>
#include "main/context.h"
#include "main/glheader.h"
#include "main/enums.h"
diff --git a/mesalib/src/mesa/vbo/vbo_split_copy.c b/mesalib/src/mesa/vbo/vbo_split_copy.c
index ca752e810..d1107dd84 100644
--- a/mesalib/src/mesa/vbo/vbo_split_copy.c
+++ b/mesalib/src/mesa/vbo/vbo_split_copy.c
@@ -29,6 +29,8 @@
/* Split indexed primitives with per-vertex copying.
*/
+#include <stdio.h>
+
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/imports.h"