summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2007-04-18 12:37:09 +0800
committerXiang, Haihao <[email protected]>2007-04-18 12:37:09 +0800
commit565cd49b5fc7a5bd1e533542888bf322b83b8e56 (patch)
tree653072979b49adcda7a5cf97c3593c67b32d674c /src
parenta4b2b8833751555d1e6cbc65f449b7182aa52e54 (diff)
fig segment fault issue in TAG(triangle), (see bug 10589)
Bit SS_TWOSIDE_BIT is set if gl_FrontFacing lives in fragment input (see commit 10b5895597d5e069183cb647d17eb412effceb4f). However, VB->ColorPtr[1] isn't assigned after that.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 5b14b283f12..1fdf0cb5999 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -63,22 +63,24 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (facing == 1) {
if (IND & SS_TWOSIDE_BIT) {
if (IND & SS_RGBA_BIT) {
- GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data;
-
- COPY_CHAN4(saved_color[0], v[0]->color);
- COPY_CHAN4(saved_color[1], v[1]->color);
- COPY_CHAN4(saved_color[2], v[2]->color);
-
- if (VB->ColorPtr[1]->stride) {
- SS_COLOR(v[0]->color, vbcolor[e0]);
- SS_COLOR(v[1]->color, vbcolor[e1]);
- SS_COLOR(v[2]->color, vbcolor[e2]);
- }
- else {
- SS_COLOR(v[0]->color, vbcolor[0]);
- SS_COLOR(v[1]->color, vbcolor[0]);
- SS_COLOR(v[2]->color, vbcolor[0]);
- }
+ if (VB->ColorPtr[1]) {
+ GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data;
+
+ COPY_CHAN4(saved_color[0], v[0]->color);
+ COPY_CHAN4(saved_color[1], v[1]->color);
+ COPY_CHAN4(saved_color[2], v[2]->color);
+
+ if (VB->ColorPtr[1]->stride) {
+ SS_COLOR(v[0]->color, vbcolor[e0]);
+ SS_COLOR(v[1]->color, vbcolor[e1]);
+ SS_COLOR(v[2]->color, vbcolor[e2]);
+ }
+ else {
+ SS_COLOR(v[0]->color, vbcolor[0]);
+ SS_COLOR(v[1]->color, vbcolor[0]);
+ SS_COLOR(v[2]->color, vbcolor[0]);
+ }
+ }
if (VB->SecondaryColorPtr[1]) {
GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
@@ -167,9 +169,12 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & SS_TWOSIDE_BIT) {
if (facing == 1) {
if (IND & SS_RGBA_BIT) {
- COPY_CHAN4(v[0]->color, saved_color[0]);
- COPY_CHAN4(v[1]->color, saved_color[1]);
- COPY_CHAN4(v[2]->color, saved_color[2]);
+ if (VB->ColorPtr[1]) {
+ COPY_CHAN4(v[0]->color, saved_color[0]);
+ COPY_CHAN4(v[1]->color, saved_color[1]);
+ COPY_CHAN4(v[2]->color, saved_color[2]);
+ }
+
if (VB->SecondaryColorPtr[1]) {
COPY_CHAN4(v[0]->specular, saved_spec[0]);
COPY_CHAN4(v[1]->specular, saved_spec[1]);