nv50: cannot exit shaders on a control flow instruction
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 18 Jan 2010 15:22:59 +0000 (16:22 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 18 Jan 2010 18:53:29 +0000 (19:53 +0100)
Fixes lockup triggered by this ingenious shader:
   1: CALL :3
   2: END
   3: BGNSUB ...

src/gallium/drivers/nv50/nv50_program.c

index 22fa6e6ae423d585752daad6c8c489d0611c731a..20db51070ffa8802ea8c8d55a3d1efed1a1cbc91 100644 (file)
@@ -477,6 +477,12 @@ is_join(struct nv50_program_exec *e)
        return FALSE;
 }
 
+static INLINE boolean
+is_control_flow(struct nv50_program_exec *e)
+{
+       return (e->inst[0] & 2);
+}
+
 static INLINE void
 set_pred(struct nv50_pc *pc, unsigned pred, unsigned idx,
         struct nv50_program_exec *e)
@@ -3166,7 +3172,9 @@ nv50_program_tx_insn(struct nv50_pc *pc,
                if (!is_long(pc->p->exec_tail))
                        convert_to_long(pc, pc->p->exec_tail);
                else
-               if (is_immd(pc->p->exec_tail) || is_join(pc->p->exec_tail))
+               if (is_immd(pc->p->exec_tail) ||
+                   is_join(pc->p->exec_tail) ||
+                   is_control_flow(pc->p->exec_tail))
                        emit_nop(pc);
 
                pc->p->exec_tail->inst[1] |= 1; /* set exit bit */