summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-01-10 12:30:08 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-01-10 12:30:08 +0000
commita887a44b2da48dfa50b5c19c2be9ebbef79ae2db (patch)
tree254f7d0b9a781ed3ee60190465e884aac42b007b /src
parent8c231d2e28fde9e9218da3da74dc431075e6fd3f (diff)
Fix segfault in pipes by dealing with stride == 0 case in generic_interp_extras
Diffstat (limited to 'src')
-rw-r--r--src/mesa/tnl/t_vertex.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index e88df0707f..2ed4c41759 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -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] );
- }
+ 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] );
}
- else if (VB->IndexPtr[1]) {
+
+ 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] );
- }
+ if (VB->SecondaryColorPtr[1]) {
+ COPY_4FV( VB->SecondaryColorPtr[1]->data[dst],
+ VB->SecondaryColorPtr[1]->data[src] );
}
- else if (VB->IndexPtr[1]) {
+
+ if (VB->IndexPtr[1]) {
VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0];
}