r300: fallback to software rendering if we are out of free texcoords
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 19 Sep 2009 16:45:59 +0000 (18:45 +0200)
committerMaciej Cencora <m.cencora@gmail.com>
Wed, 23 Sep 2009 21:22:33 +0000 (23:22 +0200)
Fixes #22741

src/mesa/drivers/dri/r300/r300_fragprog_common.c

index 469c278b510f0d51b25bdb5e801a56aff4bcc588..0bdc90b4a84ead9cf9a5259c835cf33b0d2992d4 100644 (file)
@@ -99,8 +99,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler,
 {
        int i;
 
+       fp->wpos_attr = FRAG_ATTRIB_MAX;
        if (!(compiler->Base.Program.InputsRead & FRAG_BIT_WPOS)) {
-               fp->wpos_attr = FRAG_ATTRIB_MAX;
                return;
        }
 
@@ -112,6 +112,13 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler,
                }
        }
 
+       /* No free texcoord found, fall-back to software rendering */
+       if (fp->wpos_attr == FRAG_ATTRIB_MAX)
+       {
+               compiler->Base.Error = 1;
+               return;
+       }
+
        rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, fp->wpos_attr);
 }
 
@@ -127,8 +134,8 @@ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r
        struct prog_src_register src;
        int i;
 
+       fp->fog_attr = FRAG_ATTRIB_MAX;
        if (!(compiler->Base.Program.InputsRead & FRAG_BIT_FOGC)) {
-               fp->fog_attr = FRAG_ATTRIB_MAX;
                return;
        }
 
@@ -140,6 +147,13 @@ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r
                }
        }
 
+       /* No free texcoord found, fall-back to software rendering */
+       if (fp->fog_attr == FRAG_ATTRIB_MAX)
+       {
+               compiler->Base.Error = 1;
+               return;
+       }
+
        memset(&src, 0, sizeof(src));
        src.File = PROGRAM_INPUT;
        src.Index = fp->fog_attr;