r300/compiler: use null-terminated array of transformation functions
I need to reduce the number of parameters of each compiler pass function. This is part of a larger cleanup.
This commit is contained in:
@@ -123,9 +123,10 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
|
||||
{ &r500_transform_IF, 0 },
|
||||
{ &radeonTransformALU, 0 },
|
||||
{ &radeonTransformDeriv, 0 },
|
||||
{ &radeonTransformTrigScale, 0 }
|
||||
{ &radeonTransformTrigScale, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 4, transformations);
|
||||
radeonLocalTransform(&c->Base, transformations);
|
||||
|
||||
debug_program_log(c, "after native rewrite part 1");
|
||||
|
||||
@@ -133,9 +134,10 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
|
||||
} else {
|
||||
struct radeon_program_transformation transformations[] = {
|
||||
{ &radeonTransformALU, 0 },
|
||||
{ &radeonTransformTrigSimple, 0 }
|
||||
{ &radeonTransformTrigSimple, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 2, transformations);
|
||||
radeonLocalTransform(&c->Base, transformations);
|
||||
|
||||
debug_program_log(c, "after native rewrite part 1");
|
||||
|
||||
@@ -146,11 +148,12 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
|
||||
* Remember, lowering comes last! */
|
||||
struct radeon_program_transformation common_transformations[] = {
|
||||
{ &radeonTransformTEX, c },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 1, common_transformations);
|
||||
radeonLocalTransform(&c->Base, common_transformations);
|
||||
|
||||
common_transformations[0].function = &radeonTransformALU;
|
||||
radeonLocalTransform(&c->Base, 1, common_transformations);
|
||||
radeonLocalTransform(&c->Base, common_transformations);
|
||||
|
||||
if (c->Base.Error)
|
||||
return;
|
||||
|
||||
@@ -1005,9 +1005,10 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||
if (c->Base.is_r500) {
|
||||
struct radeon_program_transformation transformations[] = {
|
||||
{ &r300_transform_vertex_alu, 0 },
|
||||
{ &r300_transform_trig_scale_vertex, 0 }
|
||||
{ &r300_transform_trig_scale_vertex, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 2, transformations);
|
||||
radeonLocalTransform(&c->Base, transformations);
|
||||
if (c->Base.Error)
|
||||
return;
|
||||
|
||||
@@ -1015,9 +1016,10 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||
} else {
|
||||
struct radeon_program_transformation transformations[] = {
|
||||
{ &r300_transform_vertex_alu, 0 },
|
||||
{ &radeonTransformTrigSimple, 0 }
|
||||
{ &radeonTransformTrigSimple, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 2, transformations);
|
||||
radeonLocalTransform(&c->Base, transformations);
|
||||
if (c->Base.Error)
|
||||
return;
|
||||
|
||||
@@ -1028,8 +1030,9 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||
*/
|
||||
struct radeon_program_transformation transformations2[] = {
|
||||
{ &transform_nonnative_modifiers, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 1, transformations2);
|
||||
radeonLocalTransform(&c->Base, transformations2);
|
||||
if (c->Base.Error)
|
||||
return;
|
||||
|
||||
@@ -1043,8 +1046,9 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
||||
*/
|
||||
struct radeon_program_transformation transformations[] = {
|
||||
{ &transform_source_conflicts, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
radeonLocalTransform(&c->Base, 1, transformations);
|
||||
radeonLocalTransform(&c->Base, transformations);
|
||||
if (c->Base.Error)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
*/
|
||||
void radeonLocalTransform(
|
||||
struct radeon_compiler * c,
|
||||
int num_transformations,
|
||||
struct radeon_program_transformation* transformations)
|
||||
{
|
||||
struct rc_instruction * inst = c->Program.Instructions.Next;
|
||||
@@ -60,7 +59,7 @@ void radeonLocalTransform(
|
||||
|
||||
inst = inst->Next;
|
||||
|
||||
for(i = 0; i < num_transformations; ++i) {
|
||||
for(i = 0; transformations[i].function; ++i) {
|
||||
struct radeon_program_transformation* t = transformations + i;
|
||||
|
||||
if (t->function(c, current, t->userData))
|
||||
|
||||
@@ -216,7 +216,6 @@ struct radeon_program_transformation {
|
||||
|
||||
void radeonLocalTransform(
|
||||
struct radeon_compiler *c,
|
||||
int num_transformations,
|
||||
struct radeon_program_transformation* transformations);
|
||||
|
||||
unsigned int rc_find_free_temporary(struct radeon_compiler * c);
|
||||
|
||||
Reference in New Issue
Block a user