summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_attrib.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_save_api.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_save_draw.c26
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];