summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-09-01 03:19:05 +0200
committerMarek Olšák <[email protected]>2010-09-04 18:56:21 +0200
commit0b9f8361470564563dc54e6b13879e73182d353b (patch)
tree937017f9442d42ef14a638c8f151b146304c90b8 /src/mesa
parent9a9aa7daa84341daae6a18dd6c13b958979d2343 (diff)
r300/compiler: refactor vertex shader compilation
First list compiler passes in an array, then run the new function rc_run_compiler. Every backend may need a different set of passes. This cleans up the mess in r3xx_compile_vertex_program.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c16
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c200
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c5
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.c24
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.h14
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c3
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c6
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.h6
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h3
18 files changed, 140 insertions, 161 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index 45d51b98351..a3c34beb02f 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -111,10 +111,10 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
rc_unroll_loops(&c->Base);
debug_program_log(c, "after unroll loops");
} else {
- rc_transform_loops(&c->Base);
+ rc_transform_loops(&c->Base, NULL);
debug_program_log(c, "after transform loops");
- rc_emulate_branches(&c->Base);
+ rc_emulate_branches(&c->Base, NULL);
debug_program_log(c, "after emulate branches");
}
@@ -126,7 +126,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{ &radeonTransformTrigScale, 0 },
{ 0, 0 }
};
- radeonLocalTransform(&c->Base, transformations);
+ rc_local_transform(&c->Base, transformations);
debug_program_log(c, "after native rewrite part 1");
@@ -134,10 +134,10 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
} else {
struct radeon_program_transformation transformations[] = {
{ &radeonTransformALU, 0 },
- { &radeonTransformTrigSimple, 0 },
+ { &r300_transform_trig_simple, 0 },
{ 0, 0 }
};
- radeonLocalTransform(&c->Base, transformations);
+ rc_local_transform(&c->Base, transformations);
debug_program_log(c, "after native rewrite part 1");
@@ -150,10 +150,10 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{ &radeonTransformTEX, c },
{ 0, 0 }
};
- radeonLocalTransform(&c->Base, common_transformations);
+ rc_local_transform(&c->Base, common_transformations);
common_transformations[0].function = &radeonTransformALU;
- radeonLocalTransform(&c->Base, common_transformations);
+ rc_local_transform(&c->Base, common_transformations);
if (c->Base.Error)
return;
@@ -175,7 +175,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
debug_program_log(c, "after dataflow optimize");
- rc_dataflow_swizzles(&c->Base);
+ rc_dataflow_swizzles(&c->Base, NULL);
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 d56ba7f4628..eb35265e37e 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -462,8 +462,9 @@ static void ei_endif(struct r300_vertex_program_compiler *compiler,
inst[3] = 0;
}
-static void translate_vertex_program(struct r300_vertex_program_compiler * compiler)
+static void translate_vertex_program(struct radeon_compiler *c, void *user)
{
+ struct r300_vertex_program_compiler *compiler = (struct r300_vertex_program_compiler*)c;
struct rc_instruction *rci;
struct loop * loops = NULL;
@@ -637,8 +638,9 @@ struct temporary_allocation {
struct rc_instruction * LastRead;
};
-static void allocate_temporary_registers(struct r300_vertex_program_compiler * compiler)
+static void allocate_temporary_registers(struct radeon_compiler *c, void *user)
{
+ struct r300_vertex_program_compiler *compiler = (struct r300_vertex_program_compiler*)c;
struct rc_instruction *inst;
struct rc_instruction *end_loop = NULL;
unsigned int num_orig_temps = 0;
@@ -849,8 +851,9 @@ static int transform_source_conflicts(
return 1;
}
-static void addArtificialOutputs(struct r300_vertex_program_compiler * compiler)
+static void rc_vs_add_artificial_outputs(struct radeon_compiler *c, void *user)
{
+ struct r300_vertex_program_compiler * compiler = (struct r300_vertex_program_compiler*)c;
int i;
for(i = 0; i < 32; ++i) {
@@ -926,8 +929,9 @@ static void transform_negative_addressing(struct r300_vertex_program_compiler *c
}
}
-static void rc_emulate_negative_addressing(struct r300_vertex_program_compiler *c)
+static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, void *user)
{
+ struct r300_vertex_program_compiler * c = (struct r300_vertex_program_compiler*)compiler;
struct rc_instruction *inst, *lastARL = NULL;
int min_offset = 0;
@@ -962,144 +966,78 @@ static void rc_emulate_negative_addressing(struct r300_vertex_program_compiler *
transform_negative_addressing(c, lastARL, inst, min_offset);
}
-static void debug_program_log(struct r300_vertex_program_compiler* c, const char * where)
-{
- if (c->Base.Debug) {
- fprintf(stderr, "Vertex Program: %s\n", where);
- rc_print_program(&c->Base.Program);
- }
-}
-
-
static struct rc_swizzle_caps r300_vertprog_swizzle_caps = {
.IsNative = &swizzle_is_native,
.Split = 0 /* should never be called */
};
-
-void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
+static void validate_final_shader(struct radeon_compiler *c, void *user)
{
- c->Base.SwizzleCaps = &r300_vertprog_swizzle_caps;
-
- addArtificialOutputs(c);
-
- debug_program_log(c, "before compilation");
-
- rc_transform_loops(&c->Base);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after emulate loops");
-
- if (!c->Base.is_r500) {
- rc_emulate_branches(&c->Base);
- if (c->Base.Error)
- return;
- debug_program_log(c, "after emulate branches");
- }
-
- rc_emulate_negative_addressing(c);
-
- debug_program_log(c, "after negative addressing emulation");
-
- if (c->Base.is_r500) {
- struct radeon_program_transformation transformations[] = {
- { &r300_transform_vertex_alu, 0 },
- { &r300_transform_trig_scale_vertex, 0 },
- { 0, 0 }
- };
- radeonLocalTransform(&c->Base, transformations);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after native rewrite");
- } else {
- struct radeon_program_transformation transformations[] = {
- { &r300_transform_vertex_alu, 0 },
- { &radeonTransformTrigSimple, 0 },
- { 0, 0 }
- };
- radeonLocalTransform(&c->Base, transformations);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after native rewrite");
-
- /* Note: This pass has to be done seperately from ALU rewrite,
- * because it needs to check every instruction.
- */
- struct radeon_program_transformation transformations2[] = {
- { &transform_nonnative_modifiers, 0 },
- { 0, 0 }
- };
- radeonLocalTransform(&c->Base, transformations2);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after emulate modifiers");
- }
-
- {
- /* Note: This pass has to be done seperately from ALU rewrite,
- * otherwise non-native ALU instructions with source conflits
- * will not be treated properly.
- */
- struct radeon_program_transformation transformations[] = {
- { &transform_source_conflicts, 0 },
- { 0, 0 }
- };
- radeonLocalTransform(&c->Base, transformations);
- if (c->Base.Error)
- return;
+ /* Check the number of constants. */
+ if (c->Program.Constants.Count > 256) {
+ rc_error(c, "Too many constants. Max: 256, Got: %i\n",
+ c->Program.Constants.Count);
}
+}
- debug_program_log(c, "after source conflict resolve");
-
- rc_dataflow_deadcode(&c->Base, &dataflow_outputs_mark_used);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after deadcode");
-
- rc_dataflow_swizzles(&c->Base);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after dataflow");
-
- allocate_temporary_registers(c);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after register allocation");
-
- if (c->Base.remove_unused_constants) {
- rc_remove_unused_constants(&c->Base,
- &c->code->constants_remap_table);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after constants cleanup");
- }
+void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
+{
+ int is_r500 = c->Base.is_r500;
+ int kill_consts = c->Base.remove_unused_constants;
+
+ /* Lists of instruction transformations. */
+ struct radeon_program_transformation alu_rewrite_r500[] = {
+ { &r300_transform_vertex_alu, 0 },
+ { &r300_transform_trig_scale_vertex, 0 },
+ { 0, 0 }
+ };
+
+ struct radeon_program_transformation alu_rewrite_r300[] = {
+ { &r300_transform_vertex_alu, 0 },
+ { &r300_transform_trig_simple, 0 },
+ { 0, 0 }
+ };
+
+ /* Note: These passes have to be done seperately from ALU rewrite,
+ * otherwise non-native ALU instructions with source conflits
+ * or non-native modifiers will not be treated properly.
+ */
+ struct radeon_program_transformation emulate_modifiers[] = {
+ { &transform_nonnative_modifiers, 0 },
+ { 0, 0 }
+ };
+
+ struct radeon_program_transformation resolve_src_conflicts[] = {
+ { &transform_source_conflicts, 0 },
+ { 0, 0 }
+ };
+
+ /* List of compiler passes. */
+ struct radeon_compiler_pass vs_list[] = {
+ /* NAME DUMP PREDICATE FUNCTION PARAM */
+ {"add artificial outputs", 0, 1, rc_vs_add_artificial_outputs, NULL},
+ {"transform loops", 1, 1, rc_transform_loops, NULL},
+ {"emulate branches", 1, !is_r500, rc_emulate_branches, NULL},
+ {"emulate negative addressing", 1, 1, rc_emulate_negative_addressing, NULL},
+ {"native rewrite", 1, is_r500, rc_local_transform, alu_rewrite_r500},
+ {"native rewrite", 1, !is_r500, rc_local_transform, alu_rewrite_r300},
+ {"emulate modifiers", 1, !is_r500, rc_local_transform, emulate_modifiers},
+ {"source conflict resolve", 1, 1, rc_local_transform, resolve_src_conflicts},
+ {"deadcode", 1, 1, rc_dataflow_deadcode, dataflow_outputs_mark_used},
+ {"dataflow swizzles", 1, 1, rc_dataflow_swizzles, NULL},
+ {"register allocation", 1, 1, allocate_temporary_registers, NULL},
+ {"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table},
+ {"final code validation", 0, 1, validate_final_shader, NULL},
+ {"machine code generation", 0, 1, translate_vertex_program, NULL},
+ {"dump machine code", 0,c->Base.Debug,r300_vertex_program_dump, NULL},
+ {NULL, 0, 0, NULL, NULL}
+ };
- translate_vertex_program(c);
- if (c->Base.Error)
- return;
+ c->Base.SwizzleCaps = &r300_vertprog_swizzle_caps;
- rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
+ rc_run_compiler(&c->Base, vs_list, "Vertex Program");
c->code->InputsRead = c->Base.Program.InputsRead;
c->code->OutputsWritten = c->Base.Program.OutputsWritten;
-
- if (c->Base.Debug) {
- fprintf(stderr, "Final vertex program code:\n");
- r300_vertex_program_dump(c);
- }
-
- /* Check the number of constants. */
- if (!c->Base.Error &&
- c->Base.Program.Constants.Count > 256) {
- rc_error(&c->Base, "Too many constants. Max: 256, Got: %i\n",
- c->Base.Program.Constants.Count);
- }
+ rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
}
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c
index e6009338e2e..2bc0a87eed8 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c
@@ -166,12 +166,15 @@ static void r300_vs_src_dump(uint32_t src)
r300_vs_swiz_debug[(src >> 22) & 0x7]);
}
-void r300_vertex_program_dump(struct r300_vertex_program_compiler * c)
+void r300_vertex_program_dump(struct radeon_compiler *compiler, void *user)
{
+ struct r300_vertex_program_compiler *c = (struct r300_vertex_program_compiler*)compiler;
struct r300_vertex_program_code * vs = c->code;
unsigned instrcount = vs->length / 4;
unsigned i;
+ fprintf(stderr, "Final vertex program code:\n");
+
for(i = 0; i < instrcount; i++) {
unsigned offset = i*4;
unsigned src;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
index 935dc9b0a80..4aff69c8683 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
@@ -350,3 +350,27 @@ void rc_transform_fragment_face(struct radeon_compiler *c, unsigned face)
}
}
}
+
+/* Executes a list of compiler passes given in the parameter 'list'. */
+void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
+ const char *shader_name)
+{
+ if (c->Debug) {
+ fprintf(stderr, "%s: before compilation\n", shader_name);
+ rc_print_program(&c->Program);
+ }
+
+ for (unsigned i = 0; list[i].name; i++) {
+ if (list[i].predicate) {
+ list[i].run(c, list[i].user);
+
+ if (c->Error)
+ return;
+
+ if (c->Debug && list[i].dump) {
+ fprintf(stderr, "%s: after '%s'\n", shader_name, list[i].name);
+ rc_print_program(&c->Program);
+ }
+ }
+ }
+}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
index 1833fcebcac..0f6ad278b10 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
@@ -123,6 +123,18 @@ struct r300_vertex_program_compiler {
};
void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* c);
-void r300_vertex_program_dump(struct r300_vertex_program_compiler * c);
+void r300_vertex_program_dump(struct radeon_compiler *compiler, void *user);
+
+struct radeon_compiler_pass {
+ const char *name; /* Name of the pass. */
+ int dump; /* Dump the program if Debug == 1? */
+ int predicate; /* Run this pass? */
+ void (*run)(struct radeon_compiler *c, void *user); /* The main entrypoint. */
+ void *user; /* Optional parameter which is passed to the run function. */
+};
+
+/* Executes a list of compiler passes given in the parameter 'list'. */
+void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
+ const char *shader_name);
#endif /* RADEON_COMPILER_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
index 41501e0551b..7a7a33ec713 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
@@ -61,8 +61,8 @@ void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, v
/*@{*/
typedef void (*rc_dataflow_mark_outputs_fn)(void * userdata, void * data,
void (*mark_fn)(void * data, unsigned int index, unsigned int mask));
-void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce);
-void rc_dataflow_swizzles(struct radeon_compiler * c);
+void rc_dataflow_deadcode(struct radeon_compiler * c, void *user);
+void rc_dataflow_swizzles(struct radeon_compiler * c, void *user);
/*@}*/
void rc_optimize(struct radeon_compiler * c);
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c
index d27d857721e..701092b625e 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c
@@ -213,11 +213,12 @@ static void mark_output_use(void * data, unsigned int index, unsigned int mask)
mark_used(s, RC_FILE_OUTPUT, index, mask);
}
-void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce)
+void rc_dataflow_deadcode(struct radeon_compiler * c, void *user)
{
struct deadcode_state s;
unsigned int nr_instructions;
unsigned has_temp_reladdr_src = 0;
+ rc_dataflow_mark_outputs_fn dce = (rc_dataflow_mark_outputs_fn)user;
memset(&s, 0, sizeof(s));
s.C = c;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
index 33acbd30f44..a0f7bd81741 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
@@ -86,7 +86,7 @@ static void rewrite_source(struct radeon_compiler * c,
}
}
-void rc_dataflow_swizzles(struct radeon_compiler * c)
+void rc_dataflow_swizzles(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c
index 863654cf685..222e5b7e02b 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c
@@ -296,7 +296,7 @@ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruc
* on different register sets and choose between their results
* using CMP instructions in place of the original ENDIF.
*/
-void rc_emulate_branches(struct radeon_compiler * c)
+void rc_emulate_branches(struct radeon_compiler *c, void *user)
{
struct emulate_branch_state s;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h
index e07279f0933..818ab84d0cd 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h
@@ -25,6 +25,6 @@
struct radeon_compiler;
-void rc_emulate_branches(struct radeon_compiler * c);
+void rc_emulate_branches(struct radeon_compiler *c, void *user);
#endif /* RADEON_EMULATE_BRANCHES_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
index d13b2be42db..026556f319f 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
@@ -470,7 +470,7 @@ static int transform_loop(struct emulate_loop_state * s,
return 1;
}
-void rc_transform_loops(struct radeon_compiler *c)
+void rc_transform_loops(struct radeon_compiler *c, void *user)
{
struct emulate_loop_state * s = &c->loop_state;
struct rc_instruction * ptr;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
index caf1c576588..4e37330f81a 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
@@ -23,7 +23,7 @@ struct emulate_loop_state {
unsigned int LoopReserved;
};
-void rc_transform_loops(struct radeon_compiler *c);
+void rc_transform_loops(struct radeon_compiler *c, void *user);
void rc_unroll_loops(struct radeon_compiler * c);
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index 9ab52b64eaf..24b685fbeb4 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -47,10 +47,12 @@
* \note The transform is called 'local' because it can only look at
* one instruction at a time.
*/
-void radeonLocalTransform(
+void rc_local_transform(
struct radeon_compiler * c,
- struct radeon_program_transformation* transformations)
+ void *user)
{
+ struct radeon_program_transformation *transformations =
+ (struct radeon_program_transformation*)user;
struct rc_instruction * inst = c->Program.Instructions.Next;
while(inst != &c->Program.Instructions) {
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
index 56740643f29..ee4fe8192e2 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
@@ -197,7 +197,7 @@ static inline void reset_srcreg(struct rc_src_register* reg)
/**
- * A transformation that can be passed to \ref radeonLocalTransform.
+ * A transformation that can be passed to \ref rc_local_transform.
*
* The function will be called once for each instruction.
* It has to either emit the appropriate transformed code for the instruction
@@ -214,9 +214,9 @@ struct radeon_program_transformation {
void *userData;
};
-void radeonLocalTransform(
+void rc_local_transform(
struct radeon_compiler *c,
- struct radeon_program_transformation* transformations);
+ void *user);
unsigned int rc_find_free_temporary(struct radeon_compiler * c);
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
index 704a7bb2d23..bdff995b071 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -770,7 +770,7 @@ static void transform_r300_vertex_SSG(struct radeon_compiler* c,
}
/**
- * For use with radeonLocalTransform, this transforms non-native ALU
+ * For use with rc_local_transform, this transforms non-native ALU
* instructions of the r300 up to r500 vertex engine.
*/
int r300_transform_vertex_alu(
@@ -870,7 +870,7 @@ static void sin_approx(
* using only the basic instructions
* MOV, ADD, MUL, MAD, FRC
*/
-int radeonTransformTrigSimple(struct radeon_compiler* c,
+int r300_transform_trig_simple(struct radeon_compiler* c,
struct rc_instruction* inst,
void* unused)
{
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h
index e6e2cc20c5a..903f13746de 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h
@@ -40,7 +40,7 @@ int r300_transform_vertex_alu(
struct rc_instruction * inst,
void*);
-int radeonTransformTrigSimple(
+int r300_transform_trig_simple(
struct radeon_compiler * c,
struct rc_instruction * inst,
void*);
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
index be89e9fa5b4..9281feecfa1 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
@@ -27,9 +27,9 @@
#include "radeon_remove_constants.h"
-void rc_remove_unused_constants(struct radeon_compiler *c,
- unsigned **out_remap_table)
+void rc_remove_unused_constants(struct radeon_compiler *c, void *user)
{
+ unsigned **out_remap_table = (unsigned**)user;
unsigned char *const_used;
unsigned *remap_table;
unsigned *inv_remap_table;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h
index 0d3a26ca1ca..f29113b922b 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h
@@ -30,7 +30,6 @@
#include "radeon_compiler.h"
-void rc_remove_unused_constants(struct radeon_compiler *c,
- unsigned **out_remap_table);
+void rc_remove_unused_constants(struct radeon_compiler *c, void *user);
#endif