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
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);
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");
}
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.*/
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);
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;
#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);
int Endif;
};
-struct loop_info {
+struct r500_loop_info {
int BgnLoop;
int BranchDepth;
unsigned int CurrentBranchDepth;
unsigned int BranchesReserved;
- struct loop_info * Loops;
+ struct r500_loop_info * Loops;
unsigned int CurrentLoopDepth;
unsigned int LoopsReserved;
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;
#include "memory_pool.h"
#include "radeon_code.h"
#include "radeon_program.h"
+#include "radeon_emulate_loops.h"
struct rc_swizzle_caps;
/*@{*/
struct rc_swizzle_caps * SwizzleCaps;
/*@}*/
+
+ struct emulate_loop_state loop_state;
};
void rc_init(struct radeon_compiler * c);
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;
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));
}
}
-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.
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 */