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

Author: Rob Clark <[email protected]>
Date:   Wed Apr 24 17:45:00 2013 -0400

freedreno: fix bogus IMM const reg index

We were assigning incorrect const register for immediates, and
potentially writing immediate const to the wrong location.  This fixes
an incorrect-rendering bug with xonotic.

Signed-off-by: Rob Clark <[email protected]>

---

 src/gallium/drivers/freedreno/freedreno_compiler.c |    4 ++--
 src/gallium/drivers/freedreno/freedreno_state.c    |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_compiler.c 
b/src/gallium/drivers/freedreno/freedreno_compiler.c
index b9cac8f..1a596f5 100644
--- a/src/gallium/drivers/freedreno/freedreno_compiler.c
+++ b/src/gallium/drivers/freedreno/freedreno_compiler.c
@@ -201,8 +201,8 @@ compile_init(struct fd_compile_context *ctx, struct 
fd_program_stateobj *prog,
                                ctx->input_export_idx[decl->Range.First] =
                                                semantic_idx(&decl->Semantic);
                        }
-                       ctx->num_regs[decl->Declaration.File] +=
-                                       1 + decl->Range.Last - 
decl->Range.First;
+                       ctx->num_regs[decl->Declaration.File] =
+                                       
MAX2(ctx->num_regs[decl->Declaration.File], decl->Range.Last + 1);
                        break;
                }
                case TGSI_TOKEN_TYPE_IMMEDIATE: {
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c 
b/src/gallium/drivers/freedreno/freedreno_state.c
index 070a042..064a2fa 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -279,7 +279,7 @@ emit_constants(struct fd_ringbuffer *ring, uint32_t base,
        if (shader) {
                for (i = 0; i < shader->num_immediates; i++) {
                        OUT_PKT3(ring, CP_SET_CONSTANT, 5);
-                       OUT_RING(ring, base);
+                       OUT_RING(ring, start_base + (4 * 
(shader->first_immediate + i)));
                        OUT_RING(ring, shader->immediates[i].val[0]);
                        OUT_RING(ring, shader->immediates[i].val[1]);
                        OUT_RING(ring, shader->immediates[i].val[2]);

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to