r300: Fix: KIL instruction don't require textures
authorNicolai Haehnle <nhaehnle@gmail.com>
Sat, 24 Mar 2007 12:01:57 +0000 (13:01 +0100)
committerNicolai Haehnle <nhaehnle@gmail.com>
Sat, 24 Mar 2007 13:43:06 +0000 (14:43 +0100)
When no textures were enabled, a KIL instruction triggered an assertion
in r300_setup_rs_unit.

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

index 47f1546c07e350476882805ae36ab7de00e0d852..ef23a61618af27ca230ccf6d8fe530a29cde9d98 100644 (file)
@@ -1210,7 +1210,7 @@ void r300_setup_textures(GLcontext *ctx)
        r300ContextPtr r300 = R300_CONTEXT(ctx);
        int hw_tmu=0;
        int last_hw_tmu=-1; /* -1 translates into no setup costs for fields */
-       int tmu_mappings[R300_MAX_TEXTURE_UNITS] = { -1 };
+       int tmu_mappings[R300_MAX_TEXTURE_UNITS] = { -1, };
        struct r300_fragment_program *rp =
                (struct r300_fragment_program *)
                (char *)ctx->FragmentProgram._Current;
@@ -1307,10 +1307,14 @@ void r300_setup_textures(GLcontext *ctx)
                val = rp->tex.inst[i];
                val &= ~R300_FPITX_IMAGE_MASK;
 
-               assert(tmu_mappings[unit] >= 0);
+               if (((val >> R300_FPITX_OPCODE_SHIFT) & 7) == R300_FPITX_OP_KIL) {
+                       r300->hw.fpt.cmd[R300_FPT_INSTR_0+i] = val;
+               } else {
+                       assert(tmu_mappings[unit] >= 0);
 
-               val |= tmu_mappings[unit] << R300_FPITX_IMAGE_SHIFT;
-               r300->hw.fpt.cmd[R300_FPT_INSTR_0+i] = val;
+                       val |= tmu_mappings[unit] << R300_FPITX_IMAGE_SHIFT;
+                       r300->hw.fpt.cmd[R300_FPT_INSTR_0+i] = val;
+               }
        }
 
        r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, rp->tex.length);