Mesa (master): mesa: Update _ElementSize.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Apr 7 04:20:29 PDT 2011


Module: Mesa
Branch: master
Commit: 204991bf5d29caa3fa54df9e4f6898faa73752cf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=204991bf5d29caa3fa54df9e4f6898faa73752cf

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Apr  7 12:07:32 2011 +0100

mesa: Update _ElementSize.

---

 src/mesa/main/arrayobj.c      |    2 ++
 src/mesa/vbo/vbo_context.c    |    2 ++
 src/mesa/vbo/vbo_exec_draw.c  |    1 +
 src/mesa/vbo/vbo_save_draw.c  |    1 +
 src/mesa/vbo/vbo_split_copy.c |    1 +
 5 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 85a8e0e..4bfb242 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -41,6 +41,7 @@
 
 #include "glheader.h"
 #include "hash.h"
+#include "image.h"
 #include "imports.h"
 #include "context.h"
 #include "mfeatures.h"
@@ -207,6 +208,7 @@ init_array(struct gl_context *ctx,
    array->Ptr = NULL;
    array->Enabled = GL_FALSE;
    array->Normalized = GL_FALSE;
+   array->_ElementSize = size * _mesa_sizeof_type(type);
 #if FEATURE_ARB_vertex_buffer_object
    /* Vertex array buffers */
    _mesa_reference_buffer_object(ctx, &array->BufferObj,
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 6656ed8..ae17ae2 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -72,6 +72,7 @@ static void init_legacy_currval(struct gl_context *ctx)
       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);
    }
@@ -98,6 +99,7 @@ static void init_generic_currval(struct gl_context *ctx)
       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);
    }
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 5396580..7e8d860 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -239,6 +239,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
 	 arrays[attr].Type = GL_FLOAT;
          arrays[attr].Format = GL_RGBA;
 	 arrays[attr].Enabled = 1;
+         arrays[attr]._ElementSize = arrays[attr].Size * sizeof(GLfloat);
          _mesa_reference_buffer_object(ctx,
                                        &arrays[attr].BufferObj,
                                        exec->vtx.bufferobj);
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 634a6d3..26f1d96 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -193,6 +193,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
 	 arrays[attr].Type = GL_FLOAT;
          arrays[attr].Format = GL_RGBA;
 	 arrays[attr].Enabled = 1;
+         arrays[attr]._ElementSize = arrays[attr].Size * sizeof(GLfloat);
          _mesa_reference_buffer_object(ctx,
                                        &arrays[attr].BufferObj,
                                        node->vertex_store->bufferobj);
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c
index 8c981f9..ecca117 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/vbo/vbo_split_copy.c
@@ -519,6 +519,7 @@ replay_init( struct copy_context *copy )
       dst->Enabled = GL_TRUE;
       dst->Normalized = src->Normalized; 
       dst->BufferObj = ctx->Shared->NullBufferObj;
+      dst->_ElementSize = src->_ElementSize;
       dst->_MaxElement = copy->dstbuf_size; /* may be less! */
 
       offset += copy->varying[i].size;



More information about the mesa-commit mailing list