r300/compiler: put emulate_loop_state in radeon_compiler
This commit is contained in:
@@ -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.*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user