summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-09-01 03:19:05 +0200
committerMarek Olšák <maraeo@gmail.com>2010-09-04 18:56:21 +0200
commit0b9f8361470564563dc54e6b13879e73182d353b (patch)
tree937017f9442d42ef14a638c8f151b146304c90b8 /src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
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/drivers/dri/r300/compiler/radeon_compiler.c')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
index 935dc9b0a8..4aff69c868 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);
+ }
+ }
+ }
+}