summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-09-01 01:10:26 +0200
committerMarek Olšák <[email protected]>2010-09-04 18:56:21 +0200
commitcc8f2d559989f516a6896ac137c8a79c7a212fa5 (patch)
treeb4b079a755de9715de6ab463a50eaea1a60166d2 /src
parent56de72c78afdb14d842a8fabbe2613a4d5eebb8f (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c15
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c16
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c3
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.h1
4 files changed, 20 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index 96c5d6fda9f..fdad1255e9a 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -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;
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index 29c6c869ff7..c98e123411c 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index a3c41d7bd44..9ab52b64eaf 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -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))
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
index e3188676965..56740643f29 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
@@ -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);