summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_array_import.c45
-rw-r--r--src/mesa/tnl/t_imm_elt.c24
-rw-r--r--src/mesa/tnl/t_imm_eval.c19
-rw-r--r--src/mesa/tnl/t_imm_exec.c2
4 files changed, 56 insertions, 34 deletions
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index 1bdf1c64e51..ab11f50c8fe 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -1,4 +1,3 @@
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -48,6 +47,7 @@ static void _tnl_import_vertex( GLcontext *ctx,
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
+ GLubyte *data;
tmp = _ac_import_vertex(ctx,
GL_FLOAT,
@@ -56,8 +56,9 @@ static void _tnl_import_vertex( GLcontext *ctx,
writeable,
&is_writeable);
- inputs->Obj.data = (GLfloat (*)[4]) tmp->Ptr;
- inputs->Obj.start = (GLfloat *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->Obj.data = (GLfloat (*)[4]) data;
+ inputs->Obj.start = (GLfloat *) data;
inputs->Obj.stride = tmp->StrideB;
inputs->Obj.size = tmp->Size;
inputs->Obj.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
@@ -74,13 +75,15 @@ static void _tnl_import_normal( GLcontext *ctx,
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
+ GLubyte *data;
tmp = _ac_import_normal(ctx, GL_FLOAT,
stride ? 3*sizeof(GLfloat) : 0, writeable,
&is_writeable);
- inputs->Normal.data = (GLfloat (*)[4]) tmp->Ptr;
- inputs->Normal.start = (GLfloat *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->Normal.data = (GLfloat (*)[4]) data;
+ inputs->Normal.start = (GLfloat *) data;
inputs->Normal.stride = tmp->StrideB;
inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (inputs->Normal.stride != 3*sizeof(GLfloat))
@@ -134,15 +137,17 @@ static void _tnl_import_fogcoord( GLcontext *ctx,
GLboolean stride )
{
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
- struct gl_client_array *tmp;
+ struct gl_client_array *tmp;
GLboolean is_writeable = 0;
+ GLubyte *data;
tmp = _ac_import_fogcoord(ctx, GL_FLOAT,
stride ? sizeof(GLfloat) : 0, writeable,
&is_writeable);
- inputs->FogCoord.data = (GLfloat (*)[4]) tmp->Ptr;
- inputs->FogCoord.start = (GLfloat *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->FogCoord.data = (GLfloat (*)[4]) data;
+ inputs->FogCoord.start = (GLfloat *) data;
inputs->FogCoord.stride = tmp->StrideB;
inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (inputs->FogCoord.stride != sizeof(GLfloat))
@@ -158,13 +163,15 @@ static void _tnl_import_index( GLcontext *ctx,
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
+ GLubyte *data;
tmp = _ac_import_index(ctx, GL_UNSIGNED_INT,
stride ? sizeof(GLuint) : 0, writeable,
&is_writeable);
- inputs->Index.data = (GLuint *) tmp->Ptr;
- inputs->Index.start = (GLuint *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->Index.data = (GLuint *) data;
+ inputs->Index.start = (GLuint *) data;
inputs->Index.stride = tmp->StrideB;
inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (inputs->Index.stride != sizeof(GLuint))
@@ -182,6 +189,7 @@ static void _tnl_import_texcoord( GLcontext *ctx,
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
+ GLubyte *data;
tmp = _ac_import_texcoord(ctx, unit, GL_FLOAT,
stride ? 4 * sizeof(GLfloat) : 0,
@@ -189,8 +197,9 @@ static void _tnl_import_texcoord( GLcontext *ctx,
writeable,
&is_writeable);
- inputs->TexCoord[unit].data = (GLfloat (*)[4]) tmp->Ptr;
- inputs->TexCoord[unit].start = (GLfloat *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->TexCoord[unit].data = (GLfloat (*)[4]) data;
+ inputs->TexCoord[unit].start = (GLfloat *) data;
inputs->TexCoord[unit].stride = tmp->StrideB;
inputs->TexCoord[unit].size = tmp->Size;
inputs->TexCoord[unit].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
@@ -208,14 +217,16 @@ static void _tnl_import_edgeflag( GLcontext *ctx,
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
+ GLubyte *data;
tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE,
stride ? sizeof(GLubyte) : 0,
0,
&is_writeable);
- inputs->EdgeFlag.data = (GLubyte *) tmp->Ptr;
- inputs->EdgeFlag.start = (GLubyte *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->EdgeFlag.data = (GLubyte *) data;
+ inputs->EdgeFlag.start = (GLubyte *) data;
inputs->EdgeFlag.stride = tmp->StrideB;
inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (inputs->EdgeFlag.stride != sizeof(GLubyte))
@@ -234,6 +245,7 @@ static void _tnl_import_attrib( GLcontext *ctx,
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
+ GLubyte *data;
tmp = _ac_import_attrib(ctx, index, GL_FLOAT,
stride ? 4 * sizeof(GLfloat) : 0,
@@ -241,8 +253,9 @@ static void _tnl_import_attrib( GLcontext *ctx,
writeable,
&is_writeable);
- inputs->Attribs[index].data = (GLfloat (*)[4]) tmp->Ptr;
- inputs->Attribs[index].start = (GLfloat *) tmp->Ptr;
+ data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+ inputs->Attribs[index].data = (GLfloat (*)[4]) data;
+ inputs->Attribs[index].start = (GLfloat *) data;
inputs->Attribs[index].stride = tmp->StrideB;
inputs->Attribs[index].size = tmp->Size;
inputs->Attribs[index].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index 44c2a32c858..fdecef61af0 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -516,14 +516,15 @@ static void _tnl_trans_elt_1ui(GLuint *to,
GLuint start,
GLuint n )
{
+ GLubyte *fromData = ADD_POINTERS( from->Ptr, from->BufferObj->Data );
_tnl_trans_elt_1ui_tab[TYPE_IDX(from->Type)]( to,
- from->Ptr,
- from->StrideB,
- flags,
- elts,
- match,
- start,
- n );
+ fromData,
+ from->StrideB,
+ flags,
+ elts,
+ match,
+ start,
+ n );
}
@@ -536,8 +537,9 @@ static void _tnl_trans_elt_1ub(GLubyte *to,
GLuint start,
GLuint n )
{
+ GLubyte *fromData = ADD_POINTERS( from->Ptr, from->BufferObj->Data );
_tnl_trans_elt_1ub_tab[TYPE_IDX(from->Type)]( to,
- from->Ptr,
+ fromData,
from->StrideB,
flags,
elts,
@@ -555,8 +557,9 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4],
GLuint start,
GLuint n )
{
+ GLubyte *fromData = ADD_POINTERS( from->Ptr, from->BufferObj->Data );
_tnl_trans_elt_4f_tab[from->Size][TYPE_IDX(from->Type)]( to,
- from->Ptr,
+ fromData,
from->StrideB,
flags,
elts,
@@ -575,8 +578,9 @@ static void _tnl_trans_elt_4fc(GLfloat (*to)[4],
GLuint start,
GLuint n )
{
+ GLubyte *fromData = ADD_POINTERS( from->Ptr, from->BufferObj->Data );
_tnl_trans_elt_4fc_tab[from->Size][TYPE_IDX(from->Type)]( to,
- from->Ptr,
+ fromData,
from->StrideB,
flags,
elts,
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c
index 8411d7da470..560e0c59334 100644
--- a/src/mesa/tnl/t_imm_eval.c
+++ b/src/mesa/tnl/t_imm_eval.c
@@ -1,4 +1,3 @@
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -120,7 +119,8 @@ static void eval1_4f_ca( struct gl_client_array *dest,
{
const GLfloat u1 = map->u1;
const GLfloat du = map->du;
- GLfloat (*to)[4] = (GLfloat (*)[4])dest->Ptr;
+ GLubyte *destData = ADD_POINTERS(dest->Ptr, dest->BufferObj->Data);
+ GLfloat (*to)[4] = (GLfloat (*)[4]) destData;
GLuint i;
ASSERT(dest->Type == GL_FLOAT);
@@ -258,7 +258,8 @@ static void eval2_4f_ca( struct gl_client_array *dest,
const GLfloat du = map->du;
const GLfloat v1 = map->v1;
const GLfloat dv = map->dv;
- GLfloat (*to)[4] = (GLfloat (*)[4])dest->Ptr;
+ GLubyte *destData = ADD_POINTERS(dest->Ptr, dest->BufferObj->Data);
+ GLfloat (*to)[4] = (GLfloat (*)[4]) destData;
GLuint i;
ASSERT(dest->Type == GL_FLOAT);
@@ -540,11 +541,13 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
if (req & VERT_BIT_COLOR0) {
GLuint generated = 0;
- if (copycount)
- copy_4f_stride( store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart,
- (GLfloat *)tmp->Color.Ptr,
- tmp->Color.StrideB,
- copycount );
+ if (copycount) {
+ GLubyte *destData = ADD_POINTERS(tmp->Color.Ptr, tmp->Color.BufferObj->Data);
+ copy_4f_stride( store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart,
+ (GLfloat *) destData,
+ tmp->Color.StrideB,
+ copycount );
+ }
tmp->Color.Ptr = (GLubyte *) (store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart);
tmp->Color.StrideB = 4 * sizeof(GLfloat);
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index 85f63dd8fbc..14d214e8438 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -538,6 +538,7 @@ void _tnl_imm_init( GLcontext *ctx )
tmp->Color.Stride = 0;
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
+ tmp->Color.BufferObj = ctx->Array.NullBufferObj;
tmp->SecondaryColor.Ptr = NULL;
tmp->SecondaryColor.Type = GL_FLOAT;
@@ -545,6 +546,7 @@ void _tnl_imm_init( GLcontext *ctx )
tmp->SecondaryColor.Stride = 0;
tmp->SecondaryColor.StrideB = 4 * sizeof(GLfloat);
tmp->SecondaryColor.Flags = 0;
+ tmp->SecondaryColor.BufferObj = ctx->Array.NullBufferObj;
_mesa_vector4f_init( &tmp->FogCoord, 0, 0 );
_mesa_vector1ui_init( &tmp->Index, 0, 0 );