diff options
author | Marek Olšák <[email protected]> | 2010-05-26 04:18:27 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-05-26 04:47:26 +0200 |
commit | 5c067a63040cc66f0320f30482529a4ff1bd3811 (patch) | |
tree | 0dc371d1dc23ad42a8f5c361acfabd388afbad41 | |
parent | f2582da3bb72b06d7a751537898f752e110857c7 (diff) |
r300/compiler: move hardware caps to the radeon_compiler base struct
Needed for vertex shaders too.
-rw-r--r-- | src/gallium/drivers/r300/r300_fs.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_vs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_compiler.h | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_blit.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog_common.c | 6 |
8 files changed, 23 insertions, 20 deletions
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index b2d3b5243c9..a434808046c 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -251,8 +251,8 @@ static void r300_translate_fragment_shader( compiler.code = &shader->code; compiler.state = shader->compare_state; - compiler.is_r500 = r300->screen->caps.is_r500; - compiler.max_temp_regs = compiler.is_r500 ? 128 : 32; + compiler.Base.is_r500 = r300->screen->caps.is_r500; + compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : 32; compiler.AllocateHwInputs = &allocate_hardware_inputs; compiler.UserData = &shader->inputs; diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 6d69bb3de3e..b25c786d6b3 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -203,6 +203,8 @@ void r300_translate_vertex_shader(struct r300_context *r300, compiler.Base.Debug = DBG_ON(r300, DBG_VP); compiler.code = &vs->code; compiler.UserData = vs; + compiler.Base.is_r500 = r300->screen->caps.is_r500; + compiler.Base.max_temp_regs = 32; if (compiler.Base.Debug) { debug_printf("r300: Initial vertex program\n"); 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 37dafa77106..ef56e623969 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 >= compiler->max_temp_regs) + if (code->pixsize >= compiler->Base.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 3e88ccbc46d..7f3b88ed759 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -107,7 +107,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after emulate branches"); - if (c->is_r500) { + if (c->Base.is_r500) { struct radeon_program_transformation transformations[] = { { &r500_transform_IF, 0 }, { &radeonTransformALU, 0 }, @@ -174,14 +174,14 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after pair scheduling"); - rc_pair_regalloc(c, c->max_temp_regs); + rc_pair_regalloc(c, c->Base.max_temp_regs); if (c->Base.Error) return; debug_program_log(c, "after register allocation"); - if (c->is_r500) { + if (c->Base.is_r500) { r500BuildFragmentProgramHwCode(c); } else { r300BuildFragmentProgramHwCode(c); @@ -190,7 +190,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) rc_constants_copy(&c->code->constants, &c->Base.Program.Constants); if (c->Base.Debug) { - if (c->is_r500) { + if (c->Base.is_r500) { r500FragmentProgramDump(c->code); } else { r300FragmentProgramDump(c->code); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 09794a52ad8..f15905d79d4 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -38,6 +38,10 @@ struct radeon_compiler { unsigned Error:1; char * ErrorMsg; + /* Hardware specification. */ + unsigned is_r500; + unsigned max_temp_regs; + /** * Variables used internally, not be touched by callers * of the compiler @@ -84,12 +88,9 @@ struct r300_fragment_program_compiler { /* Optional transformations and features. */ struct r300_fragment_program_external_state state; unsigned enable_shadow_ambient; - /* Hardware specification. */ - unsigned is_r500; - unsigned max_temp_regs; - /* Register corresponding to the depthbuffer. */ + /* Register corresponding to the depthbuffer. */ unsigned OutputDepth; - /* Registers corresponding to the four colorbuffers. */ + /* Registers corresponding to the four colorbuffers. */ unsigned OutputColor[4]; void * UserData; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 8336e58d554..9c4b65f4c00 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -237,7 +237,7 @@ int radeonTransformTEX( rc_wrap_mode wrapmode = compiler->state.unit[inst->U.I.TexSrcUnit].wrap_mode; /* R300 cannot sample from rectangles. */ - if (!compiler->is_r500) { + if (!c->is_r500) { lower_texture_rect(compiler, inst); } @@ -247,7 +247,7 @@ int radeonTransformTEX( unsigned temp = rc_find_free_temporary(c); /* For NPOT fallback, we need normalized coordinates anyway. */ - if (compiler->is_r500) { + if (c->is_r500) { lower_texture_rect(compiler, inst); } @@ -358,7 +358,7 @@ int radeonTransformTEX( /* Cannot write texture to output registers (all chips) or with masks (non-r500) */ if (inst->U.I.Opcode != RC_OPCODE_KIL && (inst->U.I.DstReg.File != RC_FILE_TEMPORARY || - (!compiler->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) { + (!c->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); inst_mov->U.I.Opcode = RC_OPCODE_MOV; diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 0865a456443..6fd41b6f41c 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -118,8 +118,8 @@ static void create_fragment_program(struct r300_context *r300) compiler.OutputColor[0] = FRAG_RESULT_COLOR; compiler.OutputDepth = FRAG_RESULT_DEPTH; compiler.enable_shadow_ambient = GL_TRUE; - compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515); - compiler.max_temp_regs = (compiler.is_r500) ? 128 : 32; + compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515); + compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32; compiler.code = &r300->blit.fp_code; compiler.AllocateHwInputs = fp_allocate_hw_inputs; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index e678a42ca26..7be2f74b5b2 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -220,8 +220,8 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog compiler.code = &fp->code; compiler.state = fp->state; compiler.enable_shadow_ambient = GL_TRUE; - 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.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE; + compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32; compiler.OutputDepth = FRAG_RESULT_DEPTH; memset(compiler.OutputColor, 0, 4 * sizeof(unsigned)); compiler.OutputColor[0] = FRAG_RESULT_COLOR; @@ -242,7 +242,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog r3xx_compile_fragment_program(&compiler); - if (compiler.is_r500) { + if (compiler.Base.is_r500) { /* We need to support the non-KMS DRM interface, which * artificially limits the number of instructions and * constants which are available to us. |