diff options
author | Keith Whitwell <[email protected]> | 2006-11-21 10:11:02 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2006-11-21 10:11:02 +0000 |
commit | d6f89107ba42724803321c9819f9c836d508b899 (patch) | |
tree | f92d92cc10f467985b1186ca1989fecdddf1d3c8 /src | |
parent | 0570fcfd93a29dcd9d41bc709edd78a7c1b4e1e7 (diff) |
Commit Gary Wong & Keith Packard's changes for bug 8867 -- adjust code
after repositioning of INDEX value in BRW_ATTRIB enum.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_attrib.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_save_api.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_save_draw.c | 26 |
3 files changed, 23 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_attrib.h b/src/mesa/drivers/dri/i965/brw_attrib.h index a8efc3a528b..12659bd1cf0 100644 --- a/src/mesa/drivers/dri/i965/brw_attrib.h +++ b/src/mesa/drivers/dri/i965/brw_attrib.h @@ -95,6 +95,7 @@ enum { } ; #define BRW_ATTRIB_FIRST_MATERIAL BRW_ATTRIB_MAT_FRONT_AMBIENT +#define BRW_ATTRIB_LAST_MATERIAL BRW_ATTRIB_MAT_BACK_INDEXES #define BRW_MAX_COPIED_VERTS 3 diff --git a/src/mesa/drivers/dri/i965/brw_save_api.c b/src/mesa/drivers/dri/i965/brw_save_api.c index c541fbe0f46..06ed1d23aa2 100644 --- a/src/mesa/drivers/dri/i965/brw_save_api.c +++ b/src/mesa/drivers/dri/i965/brw_save_api.c @@ -417,7 +417,7 @@ static void _save_copy_to_current( GLcontext *ctx ) struct brw_save_context *save = IMM_CONTEXT(ctx)->save; GLuint i; - for (i = BRW_ATTRIB_POS+1 ; i <= BRW_ATTRIB_INDEX ; i++) { + for (i = BRW_ATTRIB_POS+1 ; i < BRW_ATTRIB_MAX ; i++) { if (save->attrsz[i]) { save->currentsz[i][0] = save->attrsz[i]; COPY_CLEAN_4V(save->current[i], @@ -445,7 +445,7 @@ static void _save_copy_from_current( GLcontext *ctx ) struct brw_save_context *save = IMM_CONTEXT(ctx)->save; GLint i; - for (i = BRW_ATTRIB_POS+1 ; i <= BRW_ATTRIB_INDEX ; i++) + for (i = BRW_ATTRIB_POS+1 ; i < BRW_ATTRIB_MAX ; i++) switch (save->attrsz[i]) { case 4: save->attrptr[i][3] = save->current[i][3]; case 3: save->attrptr[i][2] = save->current[i][2]; @@ -1121,7 +1121,7 @@ static void _save_current_init( GLcontext *ctx ) save->current[i] = ctx->ListState.CurrentAttrib[i]; } - for (i = BRW_ATTRIB_FIRST_MATERIAL; i < BRW_ATTRIB_INDEX; i++) { + for (i = BRW_ATTRIB_FIRST_MATERIAL; i <= BRW_ATTRIB_LAST_MATERIAL; i++) { const GLuint j = i - BRW_ATTRIB_FIRST_MATERIAL; ASSERT(j < MAT_ATTRIB_MAX); save->currentsz[i] = &ctx->ListState.ActiveMaterialSize[j]; diff --git a/src/mesa/drivers/dri/i965/brw_save_draw.c b/src/mesa/drivers/dri/i965/brw_save_draw.c index 84f74d3f6cf..cebdd8d0607 100644 --- a/src/mesa/drivers/dri/i965/brw_save_draw.c +++ b/src/mesa/drivers/dri/i965/brw_save_draw.c @@ -38,7 +38,10 @@ #include "brw_draw.h" #include "brw_fallback.h" - +/* + * After playback, copy everything but the position from the + * last vertex to the saved state + */ static void _playback_copy_to_current( GLcontext *ctx, const struct brw_save_vertex_list *node ) { @@ -47,21 +50,30 @@ static void _playback_copy_to_current( GLcontext *ctx, GLuint i, offset; if (node->count) - offset = node->buffer_offset + (node->count-1) * node->vertex_size; + offset = (node->buffer_offset + + (node->count-1) * node->vertex_size * sizeof(GLfloat)); else offset = node->buffer_offset; - ctx->Driver.GetBufferSubData( ctx, 0, offset, node->vertex_size, + ctx->Driver.GetBufferSubData( ctx, 0, offset, + node->vertex_size * sizeof(GLfloat), data, node->vertex_store->bufferobj ); - for (i = BRW_ATTRIB_POS+1 ; i <= BRW_ATTRIB_INDEX ; i++) { + for (i = 0 ; i < BRW_ATTRIB_MAX ; i++) { if (node->attrsz[i]) { - COPY_CLEAN_4V(save->current[i], node->attrsz[i], data); - data += node->attrsz[i]; + if (i != BRW_ATTRIB_POS) + COPY_CLEAN_4V(save->current[i], node->attrsz[i], data); if (i >= BRW_ATTRIB_MAT_FRONT_AMBIENT && i <= BRW_ATTRIB_MAT_BACK_INDEXES) ctx->NewState |= _NEW_LIGHT; + + /* Edgeflag requires special treatment: + */ + if (i == BRW_ATTRIB_EDGEFLAG) + ctx->Current.EdgeFlag = (data[0] == 1.0); + + data += node->attrsz[i] * sizeof(GLfloat); } } @@ -105,7 +117,7 @@ static void brw_bind_vertex_list( struct brw_save_context *save, memset(arrays, 0, BRW_ATTRIB_MAX * sizeof(arrays[0])); - for (attr = 0; attr <= BRW_ATTRIB_INDEX; attr++) { + for (attr = 0; attr < BRW_ATTRIB_MAX; attr++) { if (node->attrsz[attr]) { arrays[attr].Ptr = (const GLubyte *)data; arrays[attr].Size = node->attrsz[attr]; |