diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-09-01 06:14:58 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2010-09-04 18:56:21 +0200 |
commit | f46fd041369a1c2c188cbd65918c900900724d37 (patch) | |
tree | 1459e5cb9ac0058b7e0ca594d306259679128f52 /src/mesa/drivers | |
parent | 63eafaa8eca04b8b3b30926b5f406c321d757d1b (diff) |
r300/compiler: make optimizations not use 0.5 swizzles in vertex shaders
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_compiler.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_optimize.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_blit.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog_common.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertprog.c | 1 |
5 files changed, 6 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index fcb0aee9f1..f6a8e83434 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -41,6 +41,7 @@ struct radeon_compiler { /* Hardware specification. */ unsigned is_r500:1; + unsigned has_half_swizzles:1; unsigned max_temp_regs; unsigned max_constants; int max_alu_insts; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index 8db521e51b..a9be30706b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -410,7 +410,7 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * newswz = RC_SWIZZLE_ZERO; } else if (baseimm == 1.0) { newswz = RC_SWIZZLE_ONE; - } else if (baseimm == 0.5) { + } else if (baseimm == 0.5 && c->has_half_swizzles) { newswz = RC_SWIZZLE_HALF; } else { have_real_reference = 1; diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index c22890c29e..e43f0eeb88 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -89,6 +89,7 @@ static void create_vertex_program(struct r300_context *r300) compiler.SetHwInputOutput = vp_ins_outs; compiler.code = &r300->blit.vp_code; compiler.Base.is_r500 = r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515; + compiler.Base.has_half_swizzles = 0; compiler.Base.max_temp_regs = 32; compiler.Base.max_constants = 256; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 1024 : 256; @@ -123,6 +124,7 @@ static void create_fragment_program(struct r300_context *r300) compiler.OutputDepth = FRAG_RESULT_DEPTH; compiler.enable_shadow_ambient = GL_TRUE; compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515); + compiler.Base.has_half_swizzles = 1; compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32; compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index cd0f6b3fe6..47cf3e4900 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.state = fp->state; compiler.enable_shadow_ambient = GL_TRUE; compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE; + compiler.Base.has_half_swizzles = 1; compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32; compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index e7dcdef9b0..1d24266fbd 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -245,6 +245,7 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, compiler.RequiredOutputs = compute_required_outputs(vp->Base, vp->key.FpReads); compiler.SetHwInputOutput = &t_inputs_outputs; compiler.Base.is_r500 = R300_CONTEXT(ctx)->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515; + compiler.Base.has_half_swizzles = 0; compiler.Base.max_temp_regs = 32; compiler.Base.max_constants = 256; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 1024 : 256; |