aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-09-01 08:12:51 +0200
committerMarek Olšák <[email protected]>2010-09-04 18:56:22 +0200
commitcfc461fca6ad5656f58c48803d13052537063316 (patch)
treefbeb8c1e4420ecd197a1d3d9b355f17cd8f9a781 /src/mesa
parentd2f4ceaa47695f9dc203c28b39d332eea8a115b2 (diff)
r300g: add a new debug option which disables compiler optimizations
Those are: - dead-code elimination - constant folding - peephole (mainly copy propagation) - register allocation There are some bugs which I need to track down. Also fix up the descriptions of all the debug options.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c7
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c7
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c1
6 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index 096afe8ad6a..137267f4a63 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -94,6 +94,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{
int is_r500 = c->Base.is_r500;
int kill_consts = c->Base.remove_unused_constants;
+ int opt = !c->Base.disable_optimizations;
/* Lists of instruction transformations. */
struct radeon_program_transformation rewrite_tex[] = {
@@ -128,9 +129,9 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{"transform TEX", 1, 1, rc_local_transform, rewrite_tex},
{"native rewrite", 1, is_r500, rc_local_transform, native_rewrite_r500},
{"native rewrite", 1, !is_r500, rc_local_transform, native_rewrite_r300},
- {"deadcode", 1, 1, rc_dataflow_deadcode, dataflow_outputs_mark_use},
+ {"deadcode", 1, opt, rc_dataflow_deadcode, dataflow_outputs_mark_use},
{"emulate loops", 1, !is_r500, rc_emulate_loops, NULL},
- {"dataflow optimize", 1, 1, rc_optimize, NULL},
+ {"dataflow optimize", 1, opt, rc_optimize, NULL},
{"dataflow swizzles", 1, 1, rc_dataflow_swizzles, NULL},
{"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table},
/* This pass makes it easier for the scheduler to group TEX
@@ -139,7 +140,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{"register rename", 1, !is_r500, rc_rename_regs, NULL},
{"pair translate", 1, 1, rc_pair_translate, NULL},
{"pair scheduling", 1, 1, rc_pair_schedule, NULL},
- {"register allocation", 1, 1, rc_pair_regalloc, NULL},
+ {"register allocation", 1, opt, rc_pair_regalloc, NULL},
{"final code validation", 0, 1, rc_validate_final_shader, NULL},
{"machine code generation", 0, is_r500, r500BuildFragmentProgramHwCode, NULL},
{"machine code generation", 0, !is_r500, r300BuildFragmentProgramHwCode, NULL},
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index e9fb49e7c13..3e8a8236c05 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -991,6 +991,7 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
{
int is_r500 = c->Base.is_r500;
int kill_consts = c->Base.remove_unused_constants;
+ int opt = !c->Base.disable_optimizations;
/* Lists of instruction transformations. */
struct radeon_program_transformation alu_rewrite_r500[] = {
@@ -1029,12 +1030,12 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
{"native rewrite", 1, is_r500, rc_local_transform, alu_rewrite_r500},
{"native rewrite", 1, !is_r500, rc_local_transform, alu_rewrite_r300},
{"emulate modifiers", 1, !is_r500, rc_local_transform, emulate_modifiers},
- {"deadcode", 1, 1, rc_dataflow_deadcode, dataflow_outputs_mark_used},
- {"dataflow optimize", 1, 1, rc_optimize, NULL},
+ {"deadcode", 1, opt, rc_dataflow_deadcode, dataflow_outputs_mark_used},
+ {"dataflow optimize", 1, opt, rc_optimize, NULL},
/* This pass must be done after optimizations. */
{"source conflict resolve", 1, 1, rc_local_transform, resolve_src_conflicts},
{"dataflow swizzles", 1, 1, rc_dataflow_swizzles, NULL},
- {"register allocation", 1, 1, allocate_temporary_registers, NULL},
+ {"register allocation", 1, opt, allocate_temporary_registers, NULL},
{"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table},
{"final code validation", 0, 1, rc_validate_final_shader, NULL},
{"machine code generation", 0, 1, translate_vertex_program, NULL},
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
index f6a8e834342..85c2e43ad67 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
@@ -42,6 +42,7 @@ struct radeon_compiler {
/* Hardware specification. */
unsigned is_r500:1;
unsigned has_half_swizzles:1;
+ unsigned disable_optimizations:1;
unsigned max_temp_regs;
unsigned max_constants;
int max_alu_insts;
diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index e43f0eeb889..5f261e07e62 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.disable_optimizations = 0;
compiler.Base.has_half_swizzles = 0;
compiler.Base.max_temp_regs = 32;
compiler.Base.max_constants = 256;
@@ -124,6 +125,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.disable_optimizations = 0;
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;
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 47cf3e49008..d0006d6c3c2 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.disable_optimizations = 0;
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;
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 1d24266fbdd..4a3bbdb44d1 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.disable_optimizations = 0;
compiler.Base.has_half_swizzles = 0;
compiler.Base.max_temp_regs = 32;
compiler.Base.max_constants = 256;