From: Marek Olšák Date: Tue, 31 Aug 2010 23:10:26 +0000 (+0200) Subject: r300/compiler: use null-terminated array of transformation functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc8f2d559989f516a6896ac137c8a79c7a212fa5;p=mesa.git 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. --- 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);