Fix segfault in pipes by dealing with stride == 0 case in generic_interp_extras
This commit is contained in:
@@ -1031,22 +1031,30 @@ static void generic_interp_extras( GLcontext *ctx,
|
||||
{
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
|
||||
if (VB->ColorPtr[1]) {
|
||||
/* If stride is zero, ColorPtr[1] is constant across the VB, so
|
||||
* there is no point interpolating between two values as they will
|
||||
* be identical. In all other cases, this value is generated by
|
||||
* t_vb_lighttmp.h and has a stride of 4 dwords.
|
||||
*/
|
||||
if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) {
|
||||
assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
|
||||
|
||||
INTERP_4F( t,
|
||||
VB->ColorPtr[1]->data[dst],
|
||||
VB->ColorPtr[1]->data[out],
|
||||
VB->ColorPtr[1]->data[in] );
|
||||
|
||||
if (VB->SecondaryColorPtr[1]) {
|
||||
INTERP_3F( t,
|
||||
VB->SecondaryColorPtr[1]->data[dst],
|
||||
VB->SecondaryColorPtr[1]->data[out],
|
||||
VB->SecondaryColorPtr[1]->data[in] );
|
||||
}
|
||||
}
|
||||
else if (VB->IndexPtr[1]) {
|
||||
|
||||
if (VB->SecondaryColorPtr[1]) {
|
||||
assert(VB->SecondaryColorPtr[1]->stride == 4 * sizeof(GLfloat));
|
||||
|
||||
INTERP_3F( t,
|
||||
VB->SecondaryColorPtr[1]->data[dst],
|
||||
VB->SecondaryColorPtr[1]->data[out],
|
||||
VB->SecondaryColorPtr[1]->data[in] );
|
||||
}
|
||||
|
||||
if (VB->IndexPtr[1]) {
|
||||
VB->IndexPtr[1]->data[dst][0] = LINTERP( t,
|
||||
VB->IndexPtr[1]->data[out][0],
|
||||
VB->IndexPtr[1]->data[in][0] );
|
||||
@@ -1064,16 +1072,19 @@ static void generic_copy_pv_extras( GLcontext *ctx,
|
||||
{
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
|
||||
if (VB->ColorPtr[1]) {
|
||||
/* See above comment:
|
||||
*/
|
||||
if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) {
|
||||
COPY_4FV( VB->ColorPtr[1]->data[dst],
|
||||
VB->ColorPtr[1]->data[src] );
|
||||
|
||||
if (VB->SecondaryColorPtr[1]) {
|
||||
COPY_4FV( VB->SecondaryColorPtr[1]->data[dst],
|
||||
VB->SecondaryColorPtr[1]->data[src] );
|
||||
}
|
||||
}
|
||||
else if (VB->IndexPtr[1]) {
|
||||
|
||||
if (VB->SecondaryColorPtr[1]) {
|
||||
COPY_4FV( VB->SecondaryColorPtr[1]->data[dst],
|
||||
VB->SecondaryColorPtr[1]->data[src] );
|
||||
}
|
||||
|
||||
if (VB->IndexPtr[1]) {
|
||||
VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user