Mesa (master): r600g: fix fragment shader size calculation

Christian König deathsimple at kemper.freedesktop.org
Sat Mar 5 01:10:13 UTC 2011


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

Author: Christian König <deathsimple at vodafone.de>
Date:   Sat Mar  5 01:46:31 2011 +0100

r600g: fix fragment shader size calculation

bc.ndw is altered in r600_bc_build, respect that
in fragment shader size calculation.

---

 src/gallium/drivers/r600/r600_asm.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 6777be8..626eb71 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2196,14 +2196,6 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
 
 	r600_bc_add_cfinst(&bc, BC_INST(&bc, V_SQ_CF_WORD1_SQ_CF_INST_RETURN));
 
-	/* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
-	ve->fetch_shader = r600_bo(rctx->radeon, bc.ndw*4, 256, PIPE_BIND_VERTEX_BUFFER, 0);
-	if (ve->fetch_shader == NULL) {
-		r600_bc_clear(&bc);
-		return -ENOMEM;
-	}
-
-	ve->fs_size = bc.ndw*4;
 	if ((r = r600_bc_build(&bc))) {
 		r600_bc_clear(&bc);
 		return r;
@@ -2218,6 +2210,15 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
 		fprintf(stderr, "______________________________________________________________\n");
 	}
 
+	ve->fs_size = bc.ndw*4;
+
+	/* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
+	ve->fetch_shader = r600_bo(rctx->radeon, ve->fs_size, 256, PIPE_BIND_VERTEX_BUFFER, 0);
+	if (ve->fetch_shader == NULL) {
+		r600_bc_clear(&bc);
+		return -ENOMEM;
+	}
+
 	bytecode = r600_bo_map(rctx->radeon, ve->fetch_shader, 0, NULL);
 	if (bytecode == NULL) {
 		r600_bc_clear(&bc);




More information about the mesa-commit mailing list