aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-29 12:25:28 +0100
committermarha <marha@users.sourceforge.net>2011-11-29 12:25:28 +0100
commit2cfebffb491807a465a8e5f7daca582d8aefb829 (patch)
tree1e17cf480a441bc4b941008005fcd0cc6c3d09a6 /mesalib/src/mesa/vbo
parent7417e9a171736b5279881cd4381fb58c617a23d9 (diff)
downloadvcxsrv-2cfebffb491807a465a8e5f7daca582d8aefb829.tar.gz
vcxsrv-2cfebffb491807a465a8e5f7daca582d8aefb829.tar.bz2
vcxsrv-2cfebffb491807a465a8e5f7daca582d8aefb829.zip
mesa git update 29 nov 2011
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo_attrib.h59
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c494
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h4
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c24
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c128
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c24
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.c254
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c4
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c18
9 files changed, 498 insertions, 511 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_attrib.h b/mesalib/src/mesa/vbo/vbo_attrib.h
index 0ae928f2a..c2f4e6ec8 100644
--- a/mesalib/src/mesa/vbo/vbo_attrib.h
+++ b/mesalib/src/mesa/vbo/vbo_attrib.h
@@ -60,43 +60,44 @@ enum {
VBO_ATTRIB_TEX5 = 13,
VBO_ATTRIB_TEX6 = 14,
VBO_ATTRIB_TEX7 = 15,
+ VBO_ATTRIB_POINT_SIZE = 16,
- VBO_ATTRIB_GENERIC0 = 16, /* Not used? */
- VBO_ATTRIB_GENERIC1 = 17,
- VBO_ATTRIB_GENERIC2 = 18,
- VBO_ATTRIB_GENERIC3 = 19,
- VBO_ATTRIB_GENERIC4 = 20,
- VBO_ATTRIB_GENERIC5 = 21,
- VBO_ATTRIB_GENERIC6 = 22,
- VBO_ATTRIB_GENERIC7 = 23,
- VBO_ATTRIB_GENERIC8 = 24,
- VBO_ATTRIB_GENERIC9 = 25,
- VBO_ATTRIB_GENERIC10 = 26,
- VBO_ATTRIB_GENERIC11 = 27,
- VBO_ATTRIB_GENERIC12 = 28,
- VBO_ATTRIB_GENERIC13 = 29,
- VBO_ATTRIB_GENERIC14 = 30,
- VBO_ATTRIB_GENERIC15 = 31,
+ VBO_ATTRIB_GENERIC0 = 17, /* Not used? */
+ VBO_ATTRIB_GENERIC1 = 18,
+ VBO_ATTRIB_GENERIC2 = 19,
+ VBO_ATTRIB_GENERIC3 = 20,
+ VBO_ATTRIB_GENERIC4 = 21,
+ VBO_ATTRIB_GENERIC5 = 22,
+ VBO_ATTRIB_GENERIC6 = 23,
+ VBO_ATTRIB_GENERIC7 = 24,
+ VBO_ATTRIB_GENERIC8 = 25,
+ VBO_ATTRIB_GENERIC9 = 26,
+ VBO_ATTRIB_GENERIC10 = 27,
+ VBO_ATTRIB_GENERIC11 = 28,
+ VBO_ATTRIB_GENERIC12 = 29,
+ VBO_ATTRIB_GENERIC13 = 30,
+ VBO_ATTRIB_GENERIC14 = 31,
+ VBO_ATTRIB_GENERIC15 = 32,
/* XXX: in the vertex program InputsRead flag, we alias
* materials and generics and use knowledge about the program
* (whether it is a fixed-function emulation) to
* differentiate. Here we must keep them apart instead.
*/
- VBO_ATTRIB_MAT_FRONT_AMBIENT = 32,
- VBO_ATTRIB_MAT_BACK_AMBIENT = 33,
- VBO_ATTRIB_MAT_FRONT_DIFFUSE = 34,
- VBO_ATTRIB_MAT_BACK_DIFFUSE = 35,
- VBO_ATTRIB_MAT_FRONT_SPECULAR = 36,
- VBO_ATTRIB_MAT_BACK_SPECULAR = 37,
- VBO_ATTRIB_MAT_FRONT_EMISSION = 38,
- VBO_ATTRIB_MAT_BACK_EMISSION = 39,
- VBO_ATTRIB_MAT_FRONT_SHININESS = 40,
- VBO_ATTRIB_MAT_BACK_SHININESS = 41,
- VBO_ATTRIB_MAT_FRONT_INDEXES = 42,
- VBO_ATTRIB_MAT_BACK_INDEXES = 43,
+ VBO_ATTRIB_MAT_FRONT_AMBIENT = 33,
+ VBO_ATTRIB_MAT_BACK_AMBIENT = 34,
+ VBO_ATTRIB_MAT_FRONT_DIFFUSE = 35,
+ VBO_ATTRIB_MAT_BACK_DIFFUSE = 36,
+ VBO_ATTRIB_MAT_FRONT_SPECULAR = 37,
+ VBO_ATTRIB_MAT_BACK_SPECULAR = 38,
+ VBO_ATTRIB_MAT_FRONT_EMISSION = 39,
+ VBO_ATTRIB_MAT_BACK_EMISSION = 40,
+ VBO_ATTRIB_MAT_FRONT_SHININESS = 41,
+ VBO_ATTRIB_MAT_BACK_SHININESS = 42,
+ VBO_ATTRIB_MAT_FRONT_INDEXES = 43,
+ VBO_ATTRIB_MAT_BACK_INDEXES = 44,
- VBO_ATTRIB_MAX = 44
+ VBO_ATTRIB_MAX = 45
};
#define VBO_ATTRIB_FIRST_MATERIAL VBO_ATTRIB_MAT_FRONT_AMBIENT
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index 5f03ce547..b2e6bbc12 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -1,249 +1,245 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "main/api_arrayelt.h"
-#include "main/bufferobj.h"
-#include "math/m_eval.h"
-#include "vbo.h"
-#include "vbo_context.h"
-
-
-
-#define NR_LEGACY_ATTRIBS 16
-#define NR_GENERIC_ATTRIBS 16
-#define NR_MAT_ATTRIBS 12
-
-
-static GLuint check_size( const GLfloat *attr )
-{
- if (attr[3] != 1.0) return 4;
- if (attr[2] != 0.0) return 3;
- if (attr[1] != 0.0) return 2;
- return 1;
-}
-
-
-static void init_legacy_currval(struct gl_context *ctx)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct gl_client_array *arrays = vbo->legacy_currval;
- GLuint i;
-
- memset(arrays, 0, sizeof(*arrays) * NR_LEGACY_ATTRIBS);
-
- /* Set up a constant (StrideB == 0) array for each current
- * attribute:
- */
- for (i = 0; i < NR_LEGACY_ATTRIBS; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- /* Size will have to be determined at runtime:
- */
- cl->Size = check_size(ctx->Current.Attrib[i]);
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->Type = GL_FLOAT;
- cl->Format = GL_RGBA;
- cl->Ptr = (const void *)ctx->Current.Attrib[i];
- cl->_ElementSize = cl->Size * sizeof(GLfloat);
- _mesa_reference_buffer_object(ctx, &cl->BufferObj,
- ctx->Shared->NullBufferObj);
- }
-}
-
-
-static void init_generic_currval(struct gl_context *ctx)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct gl_client_array *arrays = vbo->generic_currval;
- GLuint i;
-
- memset(arrays, 0, sizeof(*arrays) * NR_GENERIC_ATTRIBS);
-
- for (i = 0; i < NR_GENERIC_ATTRIBS; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- /* This will have to be determined at runtime:
- */
- cl->Size = 1;
- cl->Type = GL_FLOAT;
- cl->Format = GL_RGBA;
- cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->_ElementSize = cl->Size * sizeof(GLfloat);
- _mesa_reference_buffer_object(ctx, &cl->BufferObj,
- ctx->Shared->NullBufferObj);
- }
-}
-
-
-static void init_mat_currval(struct gl_context *ctx)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct gl_client_array *arrays = vbo->mat_currval;
- GLuint i;
-
- ASSERT(NR_MAT_ATTRIBS == MAT_ATTRIB_MAX);
-
- memset(arrays, 0, sizeof(*arrays) * NR_MAT_ATTRIBS);
-
- /* Set up a constant (StrideB == 0) array for each current
- * attribute:
- */
- for (i = 0; i < NR_MAT_ATTRIBS; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- /* Size is fixed for the material attributes, for others will
- * be determined at runtime:
- */
- switch (i - VERT_ATTRIB_GENERIC0) {
- case MAT_ATTRIB_FRONT_SHININESS:
- case MAT_ATTRIB_BACK_SHININESS:
- cl->Size = 1;
- break;
- case MAT_ATTRIB_FRONT_INDEXES:
- case MAT_ATTRIB_BACK_INDEXES:
- cl->Size = 3;
- break;
- default:
- cl->Size = 4;
- break;
- }
-
- cl->Ptr = (const void *)ctx->Light.Material.Attrib[i];
- cl->Type = GL_FLOAT;
- cl->Format = GL_RGBA;
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->_ElementSize = cl->Size * sizeof(GLfloat);
- _mesa_reference_buffer_object(ctx, &cl->BufferObj,
- ctx->Shared->NullBufferObj);
- }
-}
-
-
-GLboolean _vbo_CreateContext( struct gl_context *ctx )
-{
- struct vbo_context *vbo = CALLOC_STRUCT(vbo_context);
-
- ctx->swtnl_im = (void *)vbo;
-
- /* Initialize the arrayelt helper
- */
- if (!ctx->aelt_context &&
- !_ae_create_context( ctx )) {
- return GL_FALSE;
- }
-
- /* TODO: remove these pointers.
- */
- vbo->legacy_currval = &vbo->currval[VBO_ATTRIB_POS];
- vbo->generic_currval = &vbo->currval[VBO_ATTRIB_GENERIC0];
- vbo->mat_currval = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT];
-
- init_legacy_currval( ctx );
- init_generic_currval( ctx );
- init_mat_currval( ctx );
-
- /* Build mappings from VERT_ATTRIB -> VBO_ATTRIB depending on type
- * of vertex program active.
- */
- {
- GLuint i;
-
- /* When no vertex program, pull in the material attributes in
- * the 16..32 generic range.
- */
- for (i = 0; i < 16; i++)
- vbo->map_vp_none[i] = i;
- for (i = 0; i < 12; i++)
- vbo->map_vp_none[16+i] = VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
- for (i = 0; i < 4; i++)
- vbo->map_vp_none[28+i] = i;
-
- for (i = 0; i < Elements(vbo->map_vp_arb); i++)
- vbo->map_vp_arb[i] = i;
- }
-
-
- /* Hook our functions into exec and compile dispatch tables. These
- * will pretty much be permanently installed, which means that the
- * vtxfmt mechanism can be removed now.
- */
- vbo_exec_init( ctx );
- if (ctx->API == API_OPENGL)
- vbo_save_init( ctx );
-
- _math_init_eval();
-
- return GL_TRUE;
-}
-
-
-void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state )
-{
- vbo_exec_invalidate_state(ctx, new_state);
-}
-
-
-void _vbo_DestroyContext( struct gl_context *ctx )
-{
- struct vbo_context *vbo = vbo_context(ctx);
-
- if (ctx->aelt_context) {
- _ae_destroy_context( ctx );
- ctx->aelt_context = NULL;
- }
-
- if (vbo) {
- GLuint i;
-
- for (i = 0; i < VBO_ATTRIB_MAX; i++) {
- _mesa_reference_buffer_object(ctx, &vbo->currval[i].BufferObj, NULL);
- }
-
- vbo_exec_destroy(ctx);
- if (ctx->API == API_OPENGL)
- vbo_save_destroy(ctx);
- FREE(vbo);
- ctx->swtnl_im = NULL;
- }
-}
-
-
-void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- vbo->draw_prims = func;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+#include "main/imports.h"
+#include "main/mtypes.h"
+#include "main/api_arrayelt.h"
+#include "main/bufferobj.h"
+#include "math/m_eval.h"
+#include "vbo.h"
+#include "vbo_context.h"
+
+#define NR_MAT_ATTRIBS 12
+
+static GLuint check_size( const GLfloat *attr )
+{
+ if (attr[3] != 1.0) return 4;
+ if (attr[2] != 0.0) return 3;
+ if (attr[1] != 0.0) return 2;
+ return 1;
+}
+
+
+static void init_legacy_currval(struct gl_context *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct gl_client_array *arrays = vbo->legacy_currval;
+ GLuint i;
+
+ memset(arrays, 0, sizeof(*arrays) * VERT_ATTRIB_FF_MAX);
+
+ /* Set up a constant (StrideB == 0) array for each current
+ * attribute:
+ */
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
+ struct gl_client_array *cl = &arrays[i];
+
+ /* Size will have to be determined at runtime:
+ */
+ cl->Size = check_size(ctx->Current.Attrib[i]);
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Enabled = 1;
+ cl->Type = GL_FLOAT;
+ cl->Format = GL_RGBA;
+ cl->Ptr = (const void *)ctx->Current.Attrib[i];
+ cl->_ElementSize = cl->Size * sizeof(GLfloat);
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
+ }
+}
+
+
+static void init_generic_currval(struct gl_context *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct gl_client_array *arrays = vbo->generic_currval;
+ GLuint i;
+
+ memset(arrays, 0, sizeof(*arrays) * VERT_ATTRIB_GENERIC_MAX);
+
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
+ struct gl_client_array *cl = &arrays[i];
+
+ /* This will have to be determined at runtime:
+ */
+ cl->Size = 1;
+ cl->Type = GL_FLOAT;
+ cl->Format = GL_RGBA;
+ cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Enabled = 1;
+ cl->_ElementSize = cl->Size * sizeof(GLfloat);
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
+ }
+}
+
+
+static void init_mat_currval(struct gl_context *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct gl_client_array *arrays = vbo->mat_currval;
+ GLuint i;
+
+ ASSERT(NR_MAT_ATTRIBS == MAT_ATTRIB_MAX);
+
+ memset(arrays, 0, sizeof(*arrays) * NR_MAT_ATTRIBS);
+
+ /* Set up a constant (StrideB == 0) array for each current
+ * attribute:
+ */
+ for (i = 0; i < NR_MAT_ATTRIBS; i++) {
+ struct gl_client_array *cl = &arrays[i];
+
+ /* Size is fixed for the material attributes, for others will
+ * be determined at runtime:
+ */
+ switch (i - VERT_ATTRIB_GENERIC0) {
+ case MAT_ATTRIB_FRONT_SHININESS:
+ case MAT_ATTRIB_BACK_SHININESS:
+ cl->Size = 1;
+ break;
+ case MAT_ATTRIB_FRONT_INDEXES:
+ case MAT_ATTRIB_BACK_INDEXES:
+ cl->Size = 3;
+ break;
+ default:
+ cl->Size = 4;
+ break;
+ }
+
+ cl->Ptr = (const void *)ctx->Light.Material.Attrib[i];
+ cl->Type = GL_FLOAT;
+ cl->Format = GL_RGBA;
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Enabled = 1;
+ cl->_ElementSize = cl->Size * sizeof(GLfloat);
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
+ }
+}
+
+
+GLboolean _vbo_CreateContext( struct gl_context *ctx )
+{
+ struct vbo_context *vbo = CALLOC_STRUCT(vbo_context);
+
+ ctx->swtnl_im = (void *)vbo;
+
+ /* Initialize the arrayelt helper
+ */
+ if (!ctx->aelt_context &&
+ !_ae_create_context( ctx )) {
+ return GL_FALSE;
+ }
+
+ /* TODO: remove these pointers.
+ */
+ vbo->legacy_currval = &vbo->currval[VBO_ATTRIB_POS];
+ vbo->generic_currval = &vbo->currval[VBO_ATTRIB_GENERIC0];
+ vbo->mat_currval = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT];
+
+ init_legacy_currval( ctx );
+ init_generic_currval( ctx );
+ init_mat_currval( ctx );
+
+ /* Build mappings from VERT_ATTRIB -> VBO_ATTRIB depending on type
+ * of vertex program active.
+ */
+ {
+ GLuint i;
+
+ /* When no vertex program, pull in the material attributes in
+ * the generic range.
+ */
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; i++)
+ vbo->map_vp_none[i] = i;
+ for (i = 0; i < NR_MAT_ATTRIBS; i++)
+ vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)]
+ = VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
+ for (i = NR_MAT_ATTRIBS; i < VERT_ATTRIB_GENERIC_MAX; i++)
+ vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)] = i;
+
+ for (i = 0; i < Elements(vbo->map_vp_arb); i++)
+ vbo->map_vp_arb[i] = i;
+ }
+
+
+ /* Hook our functions into exec and compile dispatch tables. These
+ * will pretty much be permanently installed, which means that the
+ * vtxfmt mechanism can be removed now.
+ */
+ vbo_exec_init( ctx );
+ if (ctx->API == API_OPENGL)
+ vbo_save_init( ctx );
+
+ _math_init_eval();
+
+ return GL_TRUE;
+}
+
+
+void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state )
+{
+ vbo_exec_invalidate_state(ctx, new_state);
+}
+
+
+void _vbo_DestroyContext( struct gl_context *ctx )
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+
+ if (ctx->aelt_context) {
+ _ae_destroy_context( ctx );
+ ctx->aelt_context = NULL;
+ }
+
+ if (vbo) {
+ GLuint i;
+
+ for (i = 0; i < VBO_ATTRIB_MAX; i++) {
+ _mesa_reference_buffer_object(ctx, &vbo->currval[i].BufferObj, NULL);
+ }
+
+ vbo_exec_destroy(ctx);
+ if (ctx->API == API_OPENGL)
+ vbo_save_destroy(ctx);
+ FREE(vbo);
+ ctx->swtnl_im = NULL;
+ }
+}
+
+
+void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ vbo->draw_prims = func;
+}
+
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index 8d6b8f95a..cfed8e86d 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -125,8 +125,8 @@ struct vbo_exec_context
/* These just mirror the current arrayobj (todo: make arrayobj
* look like this and remove the mirror):
*/
- const struct gl_client_array *legacy_array[16];
- const struct gl_client_array *generic_array[16];
+ const struct gl_client_array *legacy_array[VERT_ATTRIB_FF_MAX];
+ const struct gl_client_array *generic_array[VERT_ATTRIB_GENERIC_MAX];
/* Arrays and current values manipulated according to program
* mode, etc. These are the attributes as seen by vertex
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 62e7d03f3..70551e0e1 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -1091,15 +1091,23 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
struct gl_client_array *arrays = exec->vtx.arrays;
unsigned i;
- memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
- memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
-
- for (i = 0; i < 16; ++i) {
- arrays[i ].BufferObj = NULL;
- arrays[i + 16].BufferObj = NULL;
- _mesa_reference_buffer_object(ctx, &arrays[i ].BufferObj,
+ memcpy(arrays, vbo->legacy_currval,
+ VERT_ATTRIB_FF_MAX * sizeof(arrays[0]));
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) {
+ struct gl_client_array *array;
+ array = &arrays[VERT_ATTRIB_FF(i)];
+ array->BufferObj = NULL;
+ _mesa_reference_buffer_object(ctx, &arrays->BufferObj,
vbo->legacy_currval[i].BufferObj);
- _mesa_reference_buffer_object(ctx, &arrays[i + 16].BufferObj,
+ }
+
+ memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval,
+ VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0]));
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) {
+ struct gl_client_array *array;
+ array = &arrays[VERT_ATTRIB_GENERIC(i)];
+ array->BufferObj = NULL;
+ _mesa_reference_buffer_object(ctx, &array->BufferObj,
vbo->generic_currval[i].BufferObj);
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 7023380a1..97221a54d 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -270,11 +270,11 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
const void *elemMap;
GLint i, k;
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
elemMap = ctx->Driver.MapBufferRange(ctx, 0,
- ctx->Array.ElementArrayBufferObj->Size,
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Size,
GL_MAP_READ_BIT,
- ctx->Array.ElementArrayBufferObj);
+ ctx->Array.ArrayObj->ElementArrayBufferObj);
elements = ADD_POINTERS(elements, elemMap);
}
@@ -297,29 +297,15 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
}
/* check element j of each enabled array */
- check_array_data(ctx, &arrayObj->Vertex, VERT_ATTRIB_POS, j);
- check_array_data(ctx, &arrayObj->Normal, VERT_ATTRIB_NORMAL, j);
- check_array_data(ctx, &arrayObj->Color, VERT_ATTRIB_COLOR0, j);
- check_array_data(ctx, &arrayObj->SecondaryColor, VERT_ATTRIB_COLOR1, j);
- for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
- check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j);
- }
for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
- check_array_data(ctx, &arrayObj->VertexAttrib[k],
- VERT_ATTRIB_GENERIC0 + k, j);
+ check_array_data(ctx, &arrayObj->VertexAttrib[k], k, j);
}
}
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, ctx->Array.ElementArrayBufferObj);
+ if (_mesa_is_bufferobj(arrayObj->ElementArrayBufferObj)) {
+ ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj);
}
- unmap_array_buffer(ctx, &arrayObj->Vertex);
- unmap_array_buffer(ctx, &arrayObj->Normal);
- unmap_array_buffer(ctx, &arrayObj->Color);
- for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
- unmap_array_buffer(ctx, &arrayObj->TexCoord[k]);
- }
for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]);
}
@@ -398,29 +384,12 @@ bind_array_obj(struct gl_context *ctx)
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint i;
- /* TODO: Fix the ArrayObj struct to keep legacy arrays in an array
- * rather than as individual named arrays. Then this function can
- * go away.
- */
- exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex;
- exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &arrayObj->Weight;
- exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal;
- exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color;
- exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor;
- exec->array.legacy_array[VERT_ATTRIB_FOG] = &arrayObj->FogCoord;
- exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &arrayObj->Index;
- if (arrayObj->PointSize.Enabled) {
- /* this aliases COLOR_INDEX */
- exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &arrayObj->PointSize;
- }
- exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag;
-
- for (i = 0; i < Elements(arrayObj->TexCoord); i++)
- exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i];
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; i++)
+ exec->array.legacy_array[i] = &arrayObj->VertexAttrib[VERT_ATTRIB_FF(i)];
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) {
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
assert(i < Elements(exec->array.generic_array));
- exec->array.generic_array[i] = &arrayObj->VertexAttrib[i];
+ exec->array.generic_array[i] = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
}
}
@@ -439,7 +408,7 @@ recalculate_input_bindings(struct gl_context *ctx)
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
const struct gl_client_array **inputs = &exec->array.inputs[0];
- GLbitfield const_inputs = 0x0;
+ GLbitfield64 const_inputs = 0x0;
GLuint i;
switch (get_program_mode(ctx)) {
@@ -449,26 +418,26 @@ recalculate_input_bindings(struct gl_context *ctx)
* generic slots. This is the only situation where material values
* are available as per-vertex attributes.
*/
- for (i = 0; i <= VERT_ATTRIB_TEX7; i++) {
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
if (exec->array.legacy_array[i]->Enabled)
inputs[i] = exec->array.legacy_array[i];
else {
inputs[i] = &vbo->legacy_currval[i];
- const_inputs |= 1 << i;
+ const_inputs |= VERT_BIT(i);
}
}
for (i = 0; i < MAT_ATTRIB_MAX; i++) {
- inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->mat_currval[i];
- const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->mat_currval[i];
+ const_inputs |= VERT_BIT_GENERIC(i);
}
/* Could use just about anything, just to fill in the empty
* slots:
*/
- for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_MAX - VERT_ATTRIB_GENERIC0; i++) {
- inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
- const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
+ for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_GENERIC_MAX; i++) {
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
+ const_inputs |= VERT_BIT_GENERIC(i);
}
/* There is no need to make _NEW_ARRAY dirty here for the TnL program,
@@ -485,23 +454,24 @@ recalculate_input_bindings(struct gl_context *ctx)
* conventional, legacy arrays. No materials, and the generic
* slots are vacant.
*/
- for (i = 0; i <= VERT_ATTRIB_TEX7; i++) {
- if (exec->array.generic_array[i]->Enabled)
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
+ if (i < VERT_ATTRIB_GENERIC_MAX
+ && exec->array.generic_array[i]->Enabled)
inputs[i] = exec->array.generic_array[i];
else if (exec->array.legacy_array[i]->Enabled)
inputs[i] = exec->array.legacy_array[i];
else {
inputs[i] = &vbo->legacy_currval[i];
- const_inputs |= 1 << i;
+ const_inputs |= VERT_BIT_FF(i);
}
}
/* Could use just about anything, just to fill in the empty
* slots:
*/
- for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
- inputs[i] = &vbo->generic_currval[i - VERT_ATTRIB_GENERIC0];
- const_inputs |= 1 << i;
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
+ const_inputs |= VERT_BIT_GENERIC(i);
}
ctx->NewState |= _NEW_ARRAY;
@@ -521,24 +491,24 @@ recalculate_input_bindings(struct gl_context *ctx)
inputs[0] = exec->array.legacy_array[0];
else {
inputs[0] = &vbo->legacy_currval[0];
- const_inputs |= 1 << 0;
+ const_inputs |= VERT_BIT_POS;
}
- for (i = 1; i <= VERT_ATTRIB_TEX7; i++) {
+ for (i = 1; i < VERT_ATTRIB_FF_MAX; i++) {
if (exec->array.legacy_array[i]->Enabled)
inputs[i] = exec->array.legacy_array[i];
else {
inputs[i] = &vbo->legacy_currval[i];
- const_inputs |= 1 << i;
+ const_inputs |= VERT_BIT_FF(i);
}
}
- for (i = 1; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) {
+ for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) {
if (exec->array.generic_array[i]->Enabled)
- inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i];
+ inputs[VERT_ATTRIB_GENERIC(i)] = exec->array.generic_array[i];
else {
- inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
- const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
+ const_inputs |= VERT_BIT_GENERIC(i);
}
}
@@ -547,7 +517,7 @@ recalculate_input_bindings(struct gl_context *ctx)
break;
}
- _mesa_set_varying_vp_inputs( ctx, ~const_inputs );
+ _mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) );
}
@@ -727,15 +697,15 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLvoid *map =
ctx->Driver.MapBufferRange(ctx, 0,
- ctx->Array.ElementArrayBufferObj->Size,
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Size,
GL_MAP_READ_BIT,
- ctx->Array.ElementArrayBufferObj);
+ ctx->Array.ArrayObj->ElementArrayBufferObj);
switch (type) {
case GL_UNSIGNED_BYTE:
{
const GLubyte *us = (const GLubyte *) map;
GLint i;
- for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size; i++) {
+ for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size; i++) {
printf("%02x ", us[i]);
if (i % 32 == 31)
printf("\n");
@@ -747,7 +717,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLushort *us = (const GLushort *) map;
GLint i;
- for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 2; i++) {
+ for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 2; i++) {
printf("%04x ", us[i]);
if (i % 16 == 15)
printf("\n");
@@ -759,7 +729,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLuint *us = (const GLuint *) map;
GLint i;
- for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 4; i++) {
+ for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 4; i++) {
printf("%08x ", us[i]);
if (i % 8 == 7)
printf("\n");
@@ -771,7 +741,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
;
}
- ctx->Driver.UnmapBuffer(ctx, ctx->Array.ElementArrayBufferObj);
+ ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj);
}
@@ -807,7 +777,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
ib.count = count;
ib.type = type;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
ib.ptr = indices;
prim[0].begin = 1;
@@ -909,8 +879,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
"\tThis should probably be fixed in the application.",
start, end, count, type, indices,
ctx->Array.ArrayObj->_MaxElement - 1,
- ctx->Array.ElementArrayBufferObj->Name,
- (int) ctx->Array.ElementArrayBufferObj->Size);
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Name,
+ (int) ctx->Array.ArrayObj->ElementArrayBufferObj->Size);
}
if (0)
@@ -924,7 +894,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
*/
if (0) {
GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
- ctx->Array.ElementArrayBufferObj);
+ ctx->Array.ArrayObj->ElementArrayBufferObj);
if (max >= ctx->Array.ArrayObj->_MaxElement) {
if (warnCount < 10) {
_mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, "
@@ -934,8 +904,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
"\tSkipping the glDrawRangeElements() call",
start, end, count, type, indices, max,
ctx->Array.ArrayObj->_MaxElement - 1,
- ctx->Array.ElementArrayBufferObj->Name,
- (int) ctx->Array.ElementArrayBufferObj->Size);
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Name,
+ (int) ctx->Array.ArrayObj->ElementArrayBufferObj->Size);
}
}
/* XXX we could also find the min index and compare to 'start'
@@ -958,7 +928,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
"(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
"base %d\n",
start, end, type, count,
- ctx->Array.ElementArrayBufferObj->Name,
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Name,
basevertex);
}
@@ -1171,13 +1141,13 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
* subranges of the index buffer as one large index buffer may lead to
* us reading unmapped memory.
*/
- if (!_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
+ if (!_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj))
fallback = GL_TRUE;
if (!fallback) {
ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
ib.type = type;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
ib.ptr = (void *)min_index_ptr;
for (i = 0; i < primcount; i++) {
@@ -1204,7 +1174,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
for (i = 0; i < primcount; i++) {
ib.count = count[i];
ib.type = type;
- ib.obj = ctx->Array.ElementArrayBufferObj;
+ ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
ib.ptr = indices[i];
prim[0].begin = 1;
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index efb6dd10a..4962b54e1 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -166,19 +166,19 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
const GLuint count = exec->vtx.vert_count;
const GLuint *map;
GLuint attr;
- GLbitfield varying_inputs = 0x0;
+ GLbitfield64 varying_inputs = 0x0;
/* Install the default (ie Current) attributes first, then overlay
* all active ones.
*/
switch (get_program_mode(exec->ctx)) {
case VP_NONE:
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
- ASSERT(attr + 16 < Elements(exec->vtx.inputs));
- exec->vtx.inputs[attr + 16] = &vbo->mat_currval[attr];
+ ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
+ exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->mat_currval[attr];
}
map = vbo->map_vp_none;
break;
@@ -188,10 +188,12 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
* occurred. NV vertex programs cannot access material values,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
- ASSERT(attr + 16 < Elements(exec->vtx.inputs));
- exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr];
+ }
+ for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
+ ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
+ exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr];
}
map = vbo->map_vp_arb;
@@ -201,9 +203,9 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
*/
if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
- exec->vtx.inputs[16] = exec->vtx.inputs[0];
- exec->vtx.attrsz[16] = exec->vtx.attrsz[0];
- exec->vtx.attrptr[16] = exec->vtx.attrptr[0];
+ exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0];
+ exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0];
+ exec->vtx.attrptr[VERT_ATTRIB_GENERIC0] = exec->vtx.attrptr[0];
exec->vtx.attrsz[0] = 0;
}
break;
@@ -248,7 +250,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
exec->vtx.bufferobj);
arrays[attr]._MaxElement = count; /* ??? */
- varying_inputs |= 1 << attr;
+ varying_inputs |= VERT_BIT(attr);
ctx->NewState |= _NEW_ARRAY;
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_save.c b/mesalib/src/mesa/vbo/vbo_save.c
index 4efc6e9d2..e02706191 100644
--- a/mesalib/src/mesa/vbo/vbo_save.c
+++ b/mesalib/src/mesa/vbo/vbo_save.c
@@ -1,123 +1,131 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.2
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-
-#include "main/mtypes.h"
-#include "main/bufferobj.h"
-#include "main/imports.h"
-#include "main/mfeatures.h"
-
-#include "vbo_context.h"
-
-
-#if FEATURE_dlist
-
-
-static void vbo_save_callback_init( struct gl_context *ctx )
-{
- ctx->Driver.NewList = vbo_save_NewList;
- ctx->Driver.EndList = vbo_save_EndList;
- ctx->Driver.SaveFlushVertices = vbo_save_SaveFlushVertices;
- ctx->Driver.BeginCallList = vbo_save_BeginCallList;
- ctx->Driver.EndCallList = vbo_save_EndCallList;
- ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin;
-}
-
-
-
-void vbo_save_init( struct gl_context *ctx )
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct vbo_save_context *save = &vbo->save;
-
- save->ctx = ctx;
-
- vbo_save_api_init( save );
- vbo_save_callback_init(ctx);
-
- {
- struct gl_client_array *arrays = save->arrays;
- unsigned i;
-
- memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
- memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
-
- for (i = 0; i < 16; ++i) {
- arrays[i ].BufferObj = NULL;
- arrays[i + 16].BufferObj = NULL;
- _mesa_reference_buffer_object(ctx, &arrays[i ].BufferObj,
- vbo->legacy_currval[i].BufferObj);
- _mesa_reference_buffer_object(ctx, &arrays[i + 16].BufferObj,
- vbo->generic_currval[i].BufferObj);
- }
- }
-
- ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
-}
-
-
-void vbo_save_destroy( struct gl_context *ctx )
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct vbo_save_context *save = &vbo->save;
- GLuint i;
-
- if (save->prim_store) {
- if ( --save->prim_store->refcount == 0 ) {
- FREE( save->prim_store );
- save->prim_store = NULL;
- }
- if ( --save->vertex_store->refcount == 0 ) {
- _mesa_reference_buffer_object(ctx,
- &save->vertex_store->bufferobj, NULL);
- FREE( save->vertex_store );
- save->vertex_store = NULL;
- }
- }
-
- for (i = 0; i < VBO_ATTRIB_MAX; i++) {
- _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL);
- }
-}
-
-
-
-
-/* Note that this can occur during the playback of a display list:
- */
-void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback )
-{
- struct vbo_save_context *save = &vbo_context(ctx)->save;
-
- if (fallback)
- save->replay_flags |= VBO_SAVE_FALLBACK;
- else
- save->replay_flags &= ~VBO_SAVE_FALLBACK;
-}
-
-
-#endif /* FEATURE_dlist */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.2
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+
+#include "main/mtypes.h"
+#include "main/bufferobj.h"
+#include "main/imports.h"
+#include "main/mfeatures.h"
+
+#include "vbo_context.h"
+
+
+#if FEATURE_dlist
+
+
+static void vbo_save_callback_init( struct gl_context *ctx )
+{
+ ctx->Driver.NewList = vbo_save_NewList;
+ ctx->Driver.EndList = vbo_save_EndList;
+ ctx->Driver.SaveFlushVertices = vbo_save_SaveFlushVertices;
+ ctx->Driver.BeginCallList = vbo_save_BeginCallList;
+ ctx->Driver.EndCallList = vbo_save_EndCallList;
+ ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin;
+}
+
+
+
+void vbo_save_init( struct gl_context *ctx )
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_save_context *save = &vbo->save;
+
+ save->ctx = ctx;
+
+ vbo_save_api_init( save );
+ vbo_save_callback_init(ctx);
+
+ {
+ struct gl_client_array *arrays = save->arrays;
+ unsigned i;
+
+ memcpy(arrays, vbo->legacy_currval,
+ VERT_ATTRIB_FF_MAX * sizeof(arrays[0]));
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) {
+ struct gl_client_array *array;
+ array = &arrays[VERT_ATTRIB_FF(i)];
+ array->BufferObj = NULL;
+ _mesa_reference_buffer_object(ctx, &arrays->BufferObj,
+ vbo->legacy_currval[i].BufferObj);
+ }
+
+ memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval,
+ VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0]));
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) {
+ struct gl_client_array *array;
+ array = &arrays[VERT_ATTRIB_GENERIC(i)];
+ array->BufferObj = NULL;
+ _mesa_reference_buffer_object(ctx, &array->BufferObj,
+ vbo->generic_currval[i].BufferObj);
+ }
+ }
+
+ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+}
+
+
+void vbo_save_destroy( struct gl_context *ctx )
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_save_context *save = &vbo->save;
+ GLuint i;
+
+ if (save->prim_store) {
+ if ( --save->prim_store->refcount == 0 ) {
+ FREE( save->prim_store );
+ save->prim_store = NULL;
+ }
+ if ( --save->vertex_store->refcount == 0 ) {
+ _mesa_reference_buffer_object(ctx,
+ &save->vertex_store->bufferobj, NULL);
+ FREE( save->vertex_store );
+ save->vertex_store = NULL;
+ }
+ }
+
+ for (i = 0; i < VBO_ATTRIB_MAX; i++) {
+ _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL);
+ }
+}
+
+
+
+
+/* Note that this can occur during the playback of a display list:
+ */
+void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback )
+{
+ struct vbo_save_context *save = &vbo_context(ctx)->save;
+
+ if (fallback)
+ save->replay_flags |= VBO_SAVE_FALLBACK;
+ else
+ save->replay_flags &= ~VBO_SAVE_FALLBACK;
+}
+
+
+#endif /* FEATURE_dlist */
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index 64da7ac49..9d8bada04 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -1119,9 +1119,9 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
_ae_map_vbos(ctx);
- if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj))
indices =
- ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Pointer, indices);
+ ADD_POINTERS(ctx->Array.ArrayObj->ElementArrayBufferObj->Pointer, indices);
vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_WEAK |
VBO_SAVE_PRIM_NO_CURRENT_UPDATE));
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index 6cda831aa..0773786b3 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -137,7 +137,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
const GLuint *map;
GLuint attr;
GLubyte node_attrsz[VBO_ATTRIB_MAX]; /* copy of node->attrsz[] */
- GLbitfield varying_inputs = 0x0;
+ GLbitfield64 varying_inputs = 0x0;
memcpy(node_attrsz, node->attrsz, sizeof(node->attrsz));
@@ -146,11 +146,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
*/
switch (get_program_mode(ctx)) {
case VP_NONE:
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->legacy_currval[attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
- save->inputs[attr + 16] = &vbo->mat_currval[attr];
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->mat_currval[attr];
}
map = vbo->map_vp_none;
break;
@@ -160,9 +160,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
* occurred. NV vertex programs cannot access material values,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->legacy_currval[attr];
- save->inputs[attr + 16] = &vbo->generic_currval[attr];
+ }
+ for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr];
}
map = vbo->map_vp_arb;
@@ -172,8 +174,8 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
*/
if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
- save->inputs[16] = save->inputs[0];
- node_attrsz[16] = node_attrsz[0];
+ save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0];
+ node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0];
node_attrsz[0] = 0;
}
break;
@@ -204,7 +206,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
assert(arrays[attr].BufferObj->Name);
buffer_offset += node->attrsz[src] * sizeof(GLfloat);
- varying_inputs |= 1<<attr;
+ varying_inputs |= VERT_BIT(attr);
ctx->NewState |= _NEW_ARRAY;
}
}