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

Author: Luca Barbieri <[email protected]>
Date:   Mon Aug 23 20:27:40 2010 +0200

nvfx: improve fp temp accounting

---

 src/gallium/drivers/nvfx/nvfx_fragprog.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c 
b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index 7caddfa..7f6b3f6 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -21,6 +21,7 @@ struct nvfx_fpc {
        struct nvfx_pipe_fragment_program* pfp;
        struct nvfx_fragment_program *fp;
 
+       unsigned max_temps;
        unsigned long long r_temps;
        unsigned long long r_temps_discard;
        struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS];
@@ -51,9 +52,9 @@ struct nvfx_fpc {
 static INLINE struct nvfx_reg
 temp(struct nvfx_fpc *fpc)
 {
-       int idx = ffsll(~fpc->r_temps) - 1;
+       int idx = __builtin_ctzll(~fpc->r_temps);
 
-       if (idx < 0) {
+       if (idx >= fpc->max_temps) {
                NOUVEAU_ERR("out of temps!!\n");
                assert(0);
                return nvfx_reg(NVFXSR_TEMP, 0);
@@ -1022,6 +1023,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx,
        if (!fpc)
                goto out_err;
 
+       fpc->max_temps = nvfx->is_nv4x ? 48 : 32;
        fpc->pfp = pfp;
        fpc->fp = fp;
        fpc->num_regs = 2;

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

Reply via email to