Mesa (master): r600g: Generalize the pipe_add_vertex_attrib() functions.

Henri Verbeet hverbeet at kemper.freedesktop.org
Mon Feb 7 14:24:46 UTC 2011


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

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Mon Feb  7 15:22:07 2011 +0100

r600g: Generalize the pipe_add_vertex_attrib() functions.

This allows them to be used for VS or PS buffer resources as well.

---

 src/gallium/drivers/r600/evergreen_state.c   |   10 ++++------
 src/gallium/drivers/r600/r600_pipe.h         |   18 ++++++++----------
 src/gallium/drivers/r600/r600_state.c        |   10 ++++------
 src/gallium/drivers/r600/r600_state_common.c |   10 ++++------
 4 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 05539aa..bfa2199 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1492,11 +1492,10 @@ void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx)
 	return rstate;
 }
 
-void evergreen_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
-				      struct r600_pipe_state *rstate,
-				      unsigned index,
-				      struct r600_resource *rbuffer,
-				      unsigned offset, unsigned stride)
+void evergreen_pipe_set_buffer_resource(struct r600_pipe_context *rctx,
+					struct r600_pipe_state *rstate,
+					struct r600_resource *rbuffer,
+					unsigned offset, unsigned stride)
 {
 	r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0,
 				offset, 0xFFFFFFFF, rbuffer->bo);
@@ -1519,5 +1518,4 @@ void evergreen_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
 				0x00000000, 0xFFFFFFFF, NULL);
 	r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7,
 				0xC0000000, 0xFFFFFFFF, NULL);
-	evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, index);
 }
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 6a09953..5f04fbf 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -168,11 +168,10 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
 void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx);
 void evergreen_polygon_offset_update(struct r600_pipe_context *rctx);
-void evergreen_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
-				      struct r600_pipe_state *rstate,
-				      unsigned index,
-				      struct r600_resource *rbuffer,
-				      unsigned offset, unsigned stride);
+void evergreen_pipe_set_buffer_resource(struct r600_pipe_context *rctx,
+					struct r600_pipe_state *rstate,
+					struct r600_resource *rbuffer,
+					unsigned offset, unsigned stride);
 
 /* r600_blit.c */
 void r600_init_blit_functions(struct r600_pipe_context *rctx);
@@ -208,11 +207,10 @@ void r600_spi_update(struct r600_pipe_context *rctx);
 void r600_init_config(struct r600_pipe_context *rctx);
 void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx);
 void r600_polygon_offset_update(struct r600_pipe_context *rctx);
-void r600_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
-				 struct r600_pipe_state *rstate,
-				 unsigned index,
-				 struct r600_resource *rbuffer,
-				 unsigned offset, unsigned stride);
+void r600_pipe_set_buffer_resource(struct r600_pipe_context *rctx,
+				   struct r600_pipe_state *rstate,
+				   struct r600_resource *rbuffer,
+				   unsigned offset, unsigned stride);
 
 /* r600_helper.h */
 int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index a51e705..e4382ba 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1218,11 +1218,10 @@ void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx)
 	return rstate;
 }
 
-void r600_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
-				 struct r600_pipe_state *rstate,
-				 unsigned index,
-				 struct r600_resource *rbuffer,
-				 unsigned offset, unsigned stride)
+void r600_pipe_set_buffer_resource(struct r600_pipe_context *rctx,
+				   struct r600_pipe_state *rstate,
+				   struct r600_resource *rbuffer,
+				   unsigned offset, unsigned stride)
 {
 	r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0,
 				offset, 0xFFFFFFFF, rbuffer->bo);
@@ -1239,5 +1238,4 @@ void r600_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
 				0x00000000, 0xFFFFFFFF, NULL);
 	r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6,
 				0xC0000000, 0xFFFFFFFF, NULL);
-	r600_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, index);
 }
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index b17686d..a2b2c17 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -398,13 +398,11 @@ static void r600_vertex_buffer_update(struct r600_pipe_context *rctx)
 		offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo);
 
 		if (rctx->family >= CHIP_CEDAR) {
-			evergreen_pipe_add_vertex_attrib(rctx, rstate, i,
-							 rbuffer, offset,
-							 vertex_buffer->stride);
+			evergreen_pipe_set_buffer_resource(rctx, rstate, rbuffer, offset, vertex_buffer->stride);
+			evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i);
 		} else {
-			r600_pipe_add_vertex_attrib(rctx, rstate, i,
-						    rbuffer, offset,
-						    vertex_buffer->stride);
+			r600_pipe_set_buffer_resource(rctx, rstate, rbuffer, offset, vertex_buffer->stride);
+			r600_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i);
 		}
 	}
 }




More information about the mesa-commit mailing list