From: Marek Olšák Date: Tue, 31 Aug 2010 18:51:37 +0000 (+0200) Subject: r300/compiler: put emulate_loop_state in radeon_compiler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0fb406d9fd2bcd040f70ba639cc8342c0a92c6d;p=mesa.git r300/compiler: put emulate_loop_state in radeon_compiler --- diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 8613ec51091..f82d0f1e62d 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -99,8 +99,6 @@ static void debug_program_log(struct r300_fragment_program_compiler* c, const ch void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) { - struct emulate_loop_state loop_state; - rewrite_depth_out(c); /* This transformation needs to be done before any of the IF @@ -114,7 +112,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after unroll loops"); } else{ - rc_transform_loops(&c->Base, &loop_state, -1); + rc_transform_loops(&c->Base, -1); debug_program_log(c, "after transform loops"); rc_emulate_branches(&c->Base); @@ -166,8 +164,8 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after deadcode"); - if(!c->Base.is_r500){ - rc_emulate_loops(&loop_state, R300_PFS_MAX_ALU_INST); + if (!c->Base.is_r500) { + rc_emulate_loops(&c->Base, R300_PFS_MAX_ALU_INST); debug_program_log(c, "after emulate loops"); } @@ -188,7 +186,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after constants cleanup"); } - if(!c->Base.is_r500) { + if (!c->Base.is_r500) { /* This pass makes it easier for the scheduler to group TEX * instructions and reduces the chances of creating too * many texture indirections.*/ diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index b05b3aabf30..b5186809bc3 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -979,8 +979,6 @@ static struct rc_swizzle_caps r300_vertprog_swizzle_caps = { void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) { - struct emulate_loop_state loop_state; - c->Base.SwizzleCaps = &r300_vertprog_swizzle_caps; addArtificialOutputs(c); @@ -988,9 +986,9 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) debug_program_log(c, "before compilation"); if (c->Base.is_r500) - rc_transform_loops(&c->Base, &loop_state, R500_VS_MAX_ALU); + rc_transform_loops(&c->Base, R500_VS_MAX_ALU); else - rc_transform_loops(&c->Base, &loop_state, R300_VS_MAX_ALU); + rc_transform_loops(&c->Base, R300_VS_MAX_ALU); if (c->Base.Error) return; diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h index 34173351f83..4efbae7ba67 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h @@ -36,8 +36,6 @@ #include "radeon_compiler.h" #include "radeon_swizzle.h" -struct emulate_loop_state; - extern void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler); extern void r500FragmentProgramDump(struct rX00_fragment_program_code *c); diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 9b60e30f586..5612a4e5ccc 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -63,7 +63,7 @@ struct branch_info { int Endif; }; -struct loop_info { +struct r500_loop_info { int BgnLoop; int BranchDepth; @@ -84,7 +84,7 @@ struct emit_state { unsigned int CurrentBranchDepth; unsigned int BranchesReserved; - struct loop_info * Loops; + struct r500_loop_info * Loops; unsigned int CurrentLoopDepth; unsigned int LoopsReserved; @@ -387,13 +387,13 @@ static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst switch(inst->U.I.Opcode){ struct branch_info * branch; - struct loop_info * loop; + struct r500_loop_info * loop; case RC_OPCODE_BGNLOOP: - memory_pool_array_reserve(&s->C->Pool, struct loop_info, + memory_pool_array_reserve(&s->C->Pool, struct r500_loop_info, s->Loops, s->CurrentLoopDepth, s->LoopsReserved, 1); loop = &s->Loops[s->CurrentLoopDepth++]; - memset(loop, 0, sizeof(struct loop_info)); + memset(loop, 0, sizeof(struct r500_loop_info)); loop->BranchDepth = s->CurrentBranchDepth; loop->BgnLoop = newip; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 5155b912e17..a61c005274a 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -28,6 +28,7 @@ #include "memory_pool.h" #include "radeon_code.h" #include "radeon_program.h" +#include "radeon_emulate_loops.h" struct rc_swizzle_caps; @@ -52,6 +53,8 @@ struct radeon_compiler { /*@{*/ struct rc_swizzle_caps * SwizzleCaps; /*@}*/ + + struct emulate_loop_state loop_state; }; void rc_init(struct radeon_compiler * c); @@ -106,7 +109,6 @@ struct r300_fragment_program_compiler { void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c); - struct r300_vertex_program_compiler { struct radeon_compiler Base; struct r300_vertex_program_code *code; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c index 32d4b45dd6d..dbb41767633 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c @@ -472,9 +472,9 @@ static int transform_loop(struct emulate_loop_state * s, return 1; } -void rc_transform_loops(struct radeon_compiler *c, - struct emulate_loop_state * s, int prog_inst_limit) +void rc_transform_loops(struct radeon_compiler *c, int prog_inst_limit) { + struct emulate_loop_state * s = &c->loop_state; struct rc_instruction * ptr; memset(s, 0, sizeof(struct emulate_loop_state)); @@ -506,8 +506,9 @@ void rc_unroll_loops(struct radeon_compiler *c, int prog_inst_limit) } } -void rc_emulate_loops(struct emulate_loop_state *s, int prog_inst_limit) +void rc_emulate_loops(struct radeon_compiler *c, int prog_inst_limit) { + struct emulate_loop_state * s = &c->loop_state; int i; /* Iterate backwards of the list of loops so that loops that nested * loops are unrolled first. diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h index bba1f68e308..43af8ee480e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h @@ -24,11 +24,10 @@ struct emulate_loop_state { int prog_inst_limit; }; -void rc_transform_loops(struct radeon_compiler *c, - struct emulate_loop_state * s, int prog_inst_limit); +void rc_transform_loops(struct radeon_compiler *c, int prog_inst_limit); void rc_unroll_loops(struct radeon_compiler * c, int prog_inst_limit); -void rc_emulate_loops(struct emulate_loop_state * s, int prog_inst_limit); +void rc_emulate_loops(struct radeon_compiler * c, int prog_inst_limit); #endif /* RADEON_EMULATE_LOOPS_H */