r300/compiler: fix assertion failure in the r500-fragprog emission path
authorMarek Olšák <maraeo@gmail.com>
Sat, 20 Mar 2010 17:31:11 +0000 (18:31 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sun, 21 Mar 2010 01:06:44 +0000 (02:06 +0100)
src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c

index 710cae727a1a321b7874462251505dc18ebf7b59..4e84eefd658ae24a88214e02bef1da7bb65bf989 100644 (file)
@@ -469,9 +469,8 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi
        if (compiler->Base.Error)
                return;
 
-       assert(code->inst_end >= 0);
-
-       if ((code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
+       if (code->inst_end == -1 ||
+           (code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
                /* This may happen when dead-code elimination is disabled or
                 * when most of the fragment program logic is leading to a KIL */
                if (code->inst_end >= 511) {