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

Author: Marek Olšák <[email protected]>
Date:   Sun Feb 14 23:57:46 2010 +0100

r300/compiler: make the max number of fragment shader temporaries adjustable

---

 src/gallium/drivers/r300/r300_fs.c                 |    1 +
 .../drivers/dri/r300/compiler/r300_fragprog_emit.c |    2 +-
 src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c |    5 +----
 .../drivers/dri/r300/compiler/radeon_compiler.h    |    1 +
 src/mesa/drivers/dri/r300/r300_fragprog_common.c   |    1 +
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_fs.c 
b/src/gallium/drivers/r300/r300_fs.c
index e23fef8..116bb80 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -169,6 +169,7 @@ static void r300_translate_fragment_shader(
     compiler.code = &shader->code;
     compiler.state = shader->compare_state;
     compiler.is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
+    compiler.max_temp_regs = compiler.is_r500 ? 128 : 32;
     compiler.AllocateHwInputs = &allocate_hardware_inputs;
     compiler.UserData = &fs->inputs;
 
diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c 
b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
index cc552ae..37dafa7 100644
--- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
@@ -353,7 +353,7 @@ void r300BuildFragmentProgramHwCode(struct 
r300_fragment_program_compiler *compi
                }
        }
 
-       if (code->pixsize >= R300_PFS_NUM_TEMP_REGS)
+       if (code->pixsize >= compiler->max_temp_regs)
                rc_error(&compiler->Base, "Too many hardware temporaries 
used.\n");
 
        if (compiler->Base.Error)
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c 
b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index c2d5dc2..d064292 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -156,10 +156,7 @@ void r3xx_compile_fragment_program(struct 
r300_fragment_program_compiler* c)
                fflush(stderr);
        }
 
-       if (c->is_r500)
-               rc_pair_regalloc(c, 128);
-       else
-               rc_pair_regalloc(c, R300_PFS_NUM_TEMP_REGS);
+       rc_pair_regalloc(c, c->max_temp_regs);
 
        if (c->Base.Error)
                return;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h 
b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
index 6bfda05..934ae28 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
@@ -83,6 +83,7 @@ struct r300_fragment_program_compiler {
        struct rX00_fragment_program_code *code;
        struct r300_fragment_program_external_state state;
        unsigned is_r500;
+       unsigned max_temp_regs;
     /* Register corresponding to the depthbuffer. */
        unsigned OutputDepth;
     /* Registers corresponding to the four colorbuffers. */
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c 
b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 0646da4..ba84122 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -220,6 +220,7 @@ static void translate_fragment_program(GLcontext *ctx, 
struct r300_fragment_prog
        compiler.code = &fp->code;
        compiler.state = fp->state;
        compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= 
CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE;
+       compiler.max_temp_regs = (compiler.is_r500) ? 128 : 32;
        compiler.OutputDepth = FRAG_RESULT_DEPTH;
        memset(compiler.OutputColor, 0, 4 * sizeof(unsigned));
        compiler.OutputColor[0] = FRAG_RESULT_COLOR;

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

Reply via email to