#include "radeon_dataflow.h"
#include "radeon_program_alu.h"
#include "radeon_swizzle.h"
-
+#include "radeon_emulate_branches.h"
/*
* Take an already-setup and valid source then swizzle it appropriately to
return 1;
}
+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,
addArtificialOutputs(compiler);
+ debug_program_log(compiler, "before compilation");
+
+ /* XXX Ideally this should be done only for r3xx, but since
+ * we don't have branching support for r5xx, we use the emulation
+ * on all chipsets. */
+ rc_emulate_branches(&compiler->Base);
+
+ debug_program_log(compiler, "after emulate branches");
+
{
struct radeon_program_transformation transformations[] = {
{ &r300_transform_vertex_alu, 0 },
radeonLocalTransform(&compiler->Base, 1, transformations);
}
- if (compiler->Base.Debug) {
- fprintf(stderr, "Vertex program after native rewrite:\n");
- rc_print_program(&compiler->Base.Program);
- fflush(stderr);
- }
+ debug_program_log(compiler, "after native rewrite");
{
/* Note: This pass has to be done seperately from ALU rewrite,
radeonLocalTransform(&compiler->Base, 1, transformations);
}
- if (compiler->Base.Debug) {
- fprintf(stderr, "Vertex program after source conflict resolve:\n");
- rc_print_program(&compiler->Base.Program);
- fflush(stderr);
- }
+ debug_program_log(compiler, "after source conflict resolve");
rc_dataflow_deadcode(&compiler->Base, &dataflow_outputs_mark_used, compiler);
- if (compiler->Base.Debug) {
- fprintf(stderr, "Vertex program after deadcode:\n");
- rc_print_program(&compiler->Base.Program);
- fflush(stderr);
- }
+ debug_program_log(compiler, "after deadcode");
rc_dataflow_swizzles(&compiler->Base);
allocate_temporary_registers(compiler);
- if (compiler->Base.Debug) {
- fprintf(stderr, "Vertex program after dataflow:\n");
- rc_print_program(&compiler->Base.Program);
- fflush(stderr);
- }
+ debug_program_log(compiler, "after dataflow");
translate_vertex_program(compiler);