r300/compiler: make the max number of fragment shader temporaries adjustable
authorMarek Olšák <maraeo@gmail.com>
Sun, 14 Feb 2010 22:57:46 +0000 (23:57 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 5 Apr 2010 05:09:45 +0000 (07:09 +0200)
src/gallium/drivers/r300/r300_fs.c
src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
src/mesa/drivers/dri/r300/r300_fragprog_common.c

index e23fef8c9f7df42a5ac2a9be76e478fc4e1e38f4..116bb80007d252d11e13bcf6d5efd9fce0c547a1 100644 (file)
@@ -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;
 
index cc552aee176d210f5e6ca9723f67dd263bf74aa1..37dafa771060b1ba94e1b6cb5c058b5d8cdecac1 100644 (file)
@@ -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)
index c2d5dc27b4902fc599e03b7330785ca4b7e48080..d06429254d89ef4c852fa252938e9b010f25792f 100644 (file)
@@ -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;
index 6bfda0574f64c5793a7904ae8926caae3cf44a91..934ae28da56aef9e0c4bc71eecfc75568eab8b3b 100644 (file)
@@ -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. */
index 0646da46249ea9b5fe36714f0031ff838b03bdb9..ba841229565621aa0d5ea1f44e295696f7533546 100644 (file)
@@ -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;