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],
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];
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];
#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 )
{
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);
}
}
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];