Mesa (gallium-index-bias): nvfx: Adapt for index bias interface change.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Apr 19 16:22:37 UTC 2010


Module: Mesa
Branch: gallium-index-bias
Commit: 7c785c0d2c2b5f3ead4b3cf31ad6af02bd90f3a5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c785c0d2c2b5f3ead4b3cf31ad6af02bd90f3a5

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Apr 19 18:18:28 2010 +0200

nvfx: Adapt for index bias interface change.

---

 src/gallium/drivers/nvfx/nvfx_context.h |   15 ++++++++-------
 src/gallium/drivers/nvfx/nvfx_draw.c    |    7 ++++---
 src/gallium/drivers/nvfx/nvfx_vbo.c     |   18 ++++++++++++------
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h
index e2c6d09..e48f9f3 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.h
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -175,9 +175,10 @@ extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers,
 /* nvfx_draw.c */
 extern struct draw_stage *nvfx_draw_render_stage(struct nvfx_context *nvfx);
 extern void nvfx_draw_elements_swtnl(struct pipe_context *pipe,
-					struct pipe_resource *idxbuf,
-					unsigned ib_size, unsigned mode,
-					unsigned start, unsigned count);
+                                     struct pipe_resource *idxbuf,
+                                     unsigned ib_size, int ib_bias,
+                                     unsigned mode,
+                                     unsigned start, unsigned count);
 extern void nvfx_vtxfmt_validate(struct nvfx_context *nvfx);
 
 /* nvfx_fb.c */
@@ -237,10 +238,10 @@ extern void nvfx_vbo_relocate(struct nvfx_context *nvfx);
 extern void nvfx_draw_arrays(struct pipe_context *, unsigned mode,
 				unsigned start, unsigned count);
 extern void nvfx_draw_elements(struct pipe_context *pipe,
-				  struct pipe_resource *indexBuffer,
-				  unsigned indexSize,
-				  unsigned mode, unsigned start,
-				  unsigned count);
+                               struct pipe_resource *indexBuffer,
+                               unsigned indexSize, int indexBias,
+                               unsigned mode, unsigned start,
+                               unsigned count);
 
 /* nvfx_vertprog.c */
 extern boolean nvfx_vertprog_validate(struct nvfx_context *nvfx);
diff --git a/src/gallium/drivers/nvfx/nvfx_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c
index 5eadce1..55b72ac 100644
--- a/src/gallium/drivers/nvfx/nvfx_draw.c
+++ b/src/gallium/drivers/nvfx/nvfx_draw.c
@@ -232,7 +232,8 @@ nvfx_draw_render_stage(struct nvfx_context *nvfx)
 
 void
 nvfx_draw_elements_swtnl(struct pipe_context *pipe,
-			 struct pipe_resource *idxbuf, unsigned idxbuf_size,
+			 struct pipe_resource *idxbuf,
+			 unsigned idxbuf_size, int idxbuf_bias,
 			 unsigned mode, unsigned start, unsigned count)
 {
 	struct nvfx_context *nvfx = nvfx_context(pipe);
@@ -257,9 +258,9 @@ nvfx_draw_elements_swtnl(struct pipe_context *pipe,
 		map = pipe_buffer_map(pipe, idxbuf,
 				      PIPE_TRANSFER_READ,
 				      &ib_transfer);
-		draw_set_mapped_element_buffer(nvfx->draw, idxbuf_size, map);
+		draw_set_mapped_element_buffer(nvfx->draw, idxbuf_size, idx_bufbias, map);
 	} else {
-		draw_set_mapped_element_buffer(nvfx->draw, 0, NULL);
+		draw_set_mapped_element_buffer(nvfx->draw, 0, 0, NULL);
 	}
 
 	if (nvfx->constbuf[PIPE_SHADER_VERTEX]) {
diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c
index 5ffbdfc..d441d03 100644
--- a/src/gallium/drivers/nvfx/nvfx_vbo.c
+++ b/src/gallium/drivers/nvfx/nvfx_vbo.c
@@ -167,7 +167,7 @@ nvfx_draw_arrays(struct pipe_context *pipe,
 
 	nvfx_vbo_set_idxbuf(nvfx, NULL, 0);
 	if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) {
-		nvfx_draw_elements_swtnl(pipe, NULL, 0,
+		nvfx_draw_elements_swtnl(pipe, NULL, 0, 0,
                                            mode, start, count);
                 return;
 	}
@@ -372,7 +372,8 @@ nvfx_draw_elements_u32(struct nvfx_context *nvfx, void *ib,
 
 static void
 nvfx_draw_elements_inline(struct pipe_context *pipe,
-			  struct pipe_resource *ib, unsigned ib_size,
+			  struct pipe_resource *ib,
+			  unsigned ib_size, int ib_bias,
 			  unsigned mode, unsigned start, unsigned count)
 {
 	struct nvfx_context *nvfx = nvfx_context(pipe);
@@ -385,6 +386,8 @@ nvfx_draw_elements_inline(struct pipe_context *pipe,
 		return;
 	}
 
+	assert(ib_bias == 0);
+
 	switch (ib_size) {
 	case 1:
 		nvfx_draw_elements_u08(nvfx, map, mode, start, count);
@@ -460,7 +463,8 @@ nvfx_draw_elements_vbo(struct pipe_context *pipe,
 
 void
 nvfx_draw_elements(struct pipe_context *pipe,
-		   struct pipe_resource *indexBuffer, unsigned indexSize,
+		   struct pipe_resource *indexBuffer,
+		   unsigned indexSize, int indexBias,
 		   unsigned mode, unsigned start, unsigned count)
 {
 	struct nvfx_context *nvfx = nvfx_context(pipe);
@@ -468,15 +472,17 @@ nvfx_draw_elements(struct pipe_context *pipe,
 
 	idxbuf = nvfx_vbo_set_idxbuf(nvfx, indexBuffer, indexSize);
 	if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) {
-		nvfx_draw_elements_swtnl(pipe, indexBuffer, indexSize,
-                                           mode, start, count);
+		nvfx_draw_elements_swtnl(pipe,
+		                         indexBuffer, indexSize, indexBias,
+		                         mode, start, count);
 		return;
 	}
 
 	if (idxbuf) {
 		nvfx_draw_elements_vbo(pipe, mode, start, count);
 	} else {
-		nvfx_draw_elements_inline(pipe, indexBuffer, indexSize,
+		nvfx_draw_elements_inline(pipe,
+		                          indexBuffer, indexSize, indexBias,
 					  mode, start, count);
 	}
 




More information about the mesa-commit mailing list