diff options
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 3 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 14 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save.h | 2 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 19 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split_copy.c | 1 |
7 files changed, 40 insertions, 6 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index bbf745b0c6..467ab4e3e5 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -78,6 +78,7 @@ static void init_legacy_currval(GLcontext *ctx) cl->StrideB = 0; cl->Enabled = 1; cl->Type = GL_FLOAT; + cl->Format = GL_RGBA; cl->Ptr = (const void *)ctx->Current.Attrib[i]; cl->BufferObj = ctx->Array.NullBufferObj; } @@ -99,6 +100,7 @@ static void init_generic_currval(GLcontext *ctx) */ cl->Size = 1; cl->Type = GL_FLOAT; + cl->Format = GL_RGBA; cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i]; cl->Stride = 0; cl->StrideB = 0; @@ -143,6 +145,7 @@ static void init_mat_currval(GLcontext *ctx) cl->Ptr = (const void *)ctx->Light.Material.Attrib[i]; cl->Type = GL_FLOAT; + cl->Format = GL_RGBA; cl->Stride = 0; cl->StrideB = 0; cl->Enabled = 1; diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index a6ce26ffed..2743bf6b55 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -156,7 +156,6 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) if (memcmp(current, tmp, sizeof(tmp)) != 0) { memcpy(current, tmp, sizeof(tmp)); - /* Given that we explicitly state size here, there is no need * for the COPY_CLEAN above, could just copy 16 bytes and be diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 5bf3d836db..45133fa4f3 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -176,7 +176,20 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr]; } map = vbo->map_vp_arb; + + /* check if VERT_ATTRIB_POS is not read but VERT_BIT_GENERIC0 is read. + * In that case we effectively need to route the data from + * glVertexAttrib(0, val) calls to feed into the GENERIC0 input. + */ + if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 && + (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) { + exec->vtx.inputs[16] = exec->vtx.inputs[0]; + exec->vtx.attrsz[16] = exec->vtx.attrsz[0]; + exec->vtx.attrsz[0] = 0; + } break; + default: + assert(0); } /* Make all active attributes (including edgeflag) available as @@ -205,6 +218,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat); arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat); arrays[attr].Type = GL_FLOAT; + arrays[attr].Format = GL_RGBA; arrays[attr].Enabled = 1; _mesa_reference_buffer_object(ctx, &arrays[attr].BufferObj, diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index b7e9baabf8..7dda54af48 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -166,7 +166,7 @@ void vbo_loopback_vertex_list( GLcontext *ctx, void vbo_save_EndList( GLcontext *ctx ); void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ); void vbo_save_EndCallList( GLcontext *ctx ); -void vbo_save_BeginCallList( GLcontext *ctx, struct mesa_display_list *list ); +void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *list ); void vbo_save_SaveFlushVertices( GLcontext *ctx ); GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ); diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index f69a33d817..ddfd276577 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -293,7 +293,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) node->count == 0); if (save->dangling_attr_ref) - ctx->ListState.CurrentList->flags |= MESA_DLIST_DANGLING_REFS; + ctx->ListState.CurrentList->Flags |= DLIST_DANGLING_REFS; save->vertex_store->used += save->vertex_size * node->count; save->prim_store->used += node->prim_count; @@ -1076,10 +1076,10 @@ void vbo_save_EndList( GLcontext *ctx ) assert(save->vertex_size == 0); } -void vbo_save_BeginCallList( GLcontext *ctx, struct mesa_display_list *dlist ) +void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *dlist ) { struct vbo_save_context *save = &vbo_context(ctx)->save; - save->replay_flags |= dlist->flags; + save->replay_flags |= dlist->Flags; } void vbo_save_EndCallList( GLcontext *ctx ) diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 0488c5d718..617c5a77ba 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -118,8 +118,11 @@ static void vbo_bind_vertex_list( GLcontext *ctx, GLuint data = node->buffer_offset; const GLuint *map; GLuint attr; + GLubyte node_attrsz[VBO_ATTRIB_MAX]; /* copy of node->attrsz[] */ GLbitfield varying_inputs = 0x0; + memcpy(node_attrsz, node->attrsz, sizeof(node->attrsz)); + /* Install the default (ie Current) attributes first, then overlay * all active ones. */ @@ -144,13 +147,26 @@ static void vbo_bind_vertex_list( GLcontext *ctx, save->inputs[attr + 16] = &vbo->generic_currval[attr]; } map = vbo->map_vp_arb; + + /* check if VERT_ATTRIB_POS is not read but VERT_BIT_GENERIC0 is read. + * In that case we effectively need to route the data from + * glVertexAttrib(0, val) calls to feed into the GENERIC0 input. + */ + if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 && + (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) { + save->inputs[16] = save->inputs[0]; + node_attrsz[16] = node_attrsz[0]; + node_attrsz[0] = 0; + } break; + default: + assert(0); } for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { GLuint src = map[attr]; - if (node->attrsz[src]) { + if (node_attrsz[src]) { /* override the default array set above */ save->inputs[attr] = &arrays[attr]; @@ -159,6 +175,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx, arrays[attr].StrideB = node->vertex_size * sizeof(GLfloat); arrays[attr].Stride = node->vertex_size * sizeof(GLfloat); arrays[attr].Type = GL_FLOAT; + arrays[attr].Format = GL_RGBA; arrays[attr].Enabled = 1; _mesa_reference_buffer_object(ctx, &arrays[attr].BufferObj, diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 685cc0fdf6..5fb66d3318 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -461,6 +461,7 @@ static void replay_init( struct copy_context *copy ) dst->Size = src->Size; dst->Type = src->Type; + dst->Format = GL_RGBA; dst->Stride = copy->vertex_size; dst->StrideB = copy->vertex_size; dst->Ptr = copy->dstbuf + offset; |