Module: Mesa
Branch: master
Commit: 5ea238b7991331c854e66a16911d616d36965dc9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ea238b7991331c854e66a16911d616d36965dc9

Author: Dave Airlie <airl...@redhat.com>
Date:   Tue Aug 31 09:02:02 2010 +1000

r600g: add missing literals

Also add an error if we hit this problem again, we need to do this better
possibly tying the literal addition to the last flag.

Signed-off-by: Dave Airlie <airl...@redhat.com>

---

 src/gallium/drivers/r600/r600_asm.c    |    3 +++
 src/gallium/drivers/r600/r600_shader.c |   31 ++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index 1a354a6..6483dac 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -375,6 +375,9 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct 
r600_bc_alu *alu, unsign
                                        
S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate);
        }
        if (alu->last) {
+               if (alu->nliteral && !alu->literal_added) {
+                       R600_ERR("Bug in ALU processing for instruction 0x%08x, 
literal not added correctly\n");
+               }
                for (i = 0; i < alu->nliteral; i++) {
                        bc->bytecode[id++] = alu->value[i];
                }
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 652d403..4834eaa 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1018,6 +1018,10 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
        if (r)
                return r;
 
+       r = r600_bc_add_literal(ctx->bc, ctx->value);
+       if (r)
+               return r;
+
        if (inst->Dst[0].Register.WriteMask & (1 << 2))
        {
                int chan;
@@ -1038,6 +1042,9 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
                chan = alu.dst.chan;
                sel = alu.dst.sel;
 
@@ -1063,6 +1070,9 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
                /* dst.z = exp(tmp.x) */
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
@@ -1151,6 +1161,9 @@ static int tgsi_trans_srcx_replicate(struct 
r600_shader_ctx *ctx)
        r = r600_bc_add_alu(ctx->bc, &alu);
        if (r)
                return r;
+       r = r600_bc_add_literal(ctx->bc, ctx->value);
+       if (r)
+               return r;
        /* replicate result */
        return tgsi_helper_tempx_replicate(ctx);
 }
@@ -1760,6 +1773,10 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
+
                alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
                alu.src[0].sel = ctx->temp_reg;
                alu.src[0].chan = 0;
@@ -1771,6 +1788,10 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
+
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
        }
                
        /* result.y = tmp - floor(tmp); */
@@ -1796,6 +1817,9 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
        }
 
        /* result.z = RoughApprox2ToX(tmp);*/
@@ -1816,7 +1840,9 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
        }
 
        /* result.w = 1.0;*/
@@ -1834,6 +1860,9 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
+               r = r600_bc_add_literal(ctx->bc, ctx->value);
+               if (r)
+                       return r;
        }
        return tgsi_helper_copy(ctx, inst);
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to