Mesa (master): r300/compiler: emulate loops in vertex shaders

Marek Olšák mareko at kemper.freedesktop.org
Tue Jun 22 19:05:55 PDT 2010


Module: Mesa
Branch: master
Commit: 2f6b4187eb6adac6ff7361419269685ed1b2dae2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f6b4187eb6adac6ff7361419269685ed1b2dae2

Author: Marek Olšák <maraeo at gmail.com>
Date:   Wed Jun 23 03:55:20 2010 +0200

r300/compiler: emulate loops in vertex shaders

It is not perfect, but it is the best we got.

---

 src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c |    7 +++----
 src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c |    8 ++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index 3831265..bbdfa0d 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -105,14 +105,13 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
 	 * we don't have branching support for r5xx, we use the emulation
 	 * on all chipsets. */
 	
-	if(c->Base.is_r500){
+	if (c->Base.is_r500) {
 		rc_emulate_loops(&c->Base, R500_PFS_MAX_INST);
-	}
-	else{
+	} else {
 		rc_emulate_loops(&c->Base, R300_PFS_MAX_ALU_INST);
 	}
 	debug_program_log(c, "after emulate loops");
-	
+
 	rc_emulate_branches(&c->Base);
 
 	debug_program_log(c, "after emulate branches");
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index 507b2e5..6a1e3e7 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -30,6 +30,7 @@
 #include "radeon_program_alu.h"
 #include "radeon_swizzle.h"
 #include "radeon_emulate_branches.h"
+#include "radeon_emulate_loops.h"
 
 /*
  * Take an already-setup and valid source then swizzle it appropriately to
@@ -600,6 +601,13 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler)
 	/* 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. */
+	if (compiler->Base.is_r500){
+		rc_emulate_loops(&compiler->Base, R500_VS_MAX_ALU);
+	} else {
+		rc_emulate_loops(&compiler->Base, R300_VS_MAX_ALU);
+	}
+	debug_program_log(compiler, "after emulate loops");
+
 	rc_emulate_branches(&compiler->Base);
 
 	debug_program_log(compiler, "after emulate branches");



More information about the mesa-commit mailing list