diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-04-19 18:16:08 +0200 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-04-19 18:16:08 +0200 |
commit | 9515b78859b52b4532cc9e06366428f2c49c7869 (patch) | |
tree | 3cdbe6b5bc6040b142f216932985f55775ecc26a | |
parent | 989861fc5ea1792e7ea1be07389db7c3e3b8e383 (diff) |
svga: Implement index bias.
Untested.
-rw-r--r-- | src/gallium/drivers/svga/svga_draw.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_draw_elements.c | 17 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_draw_private.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_draw.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_backend.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_draw.c | 5 |
7 files changed, 32 insertions, 23 deletions
diff --git a/src/gallium/drivers/svga/svga_draw.h b/src/gallium/drivers/svga/svga_draw.h index 81c7f8377d..a2403d802b 100644 --- a/src/gallium/drivers/svga/svga_draw.h +++ b/src/gallium/drivers/svga/svga_draw.h @@ -69,12 +69,12 @@ enum pipe_error svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, struct pipe_resource *indexBuffer, unsigned index_size, + int index_bias, unsigned min_index, unsigned max_index, unsigned prim, unsigned start, - unsigned count, - unsigned bias ); + unsigned count ); enum pipe_error svga_hwtnl_flush( struct svga_hwtnl *hwtnl ); diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c index 7ec4a058fc..c4579177b7 100644 --- a/src/gallium/drivers/svga/svga_draw_elements.c +++ b/src/gallium/drivers/svga/svga_draw_elements.c @@ -99,12 +99,12 @@ enum pipe_error svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl, struct pipe_resource *index_buffer, unsigned index_size, + int index_bias, unsigned min_index, unsigned max_index, unsigned prim, unsigned start, - unsigned count, - unsigned bias ) + unsigned count ) { struct pipe_resource *upload_buffer = NULL; SVGA3dPrimitiveRange range; @@ -143,7 +143,7 @@ svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl, range.indexArray.offset = index_offset; range.indexArray.stride = index_size; range.indexWidth = index_size; - range.indexBias = bias; + range.indexBias = index_bias; ret = svga_hwtnl_prim( hwtnl, &range, min_index, max_index, index_buffer ); if (ret) @@ -163,10 +163,10 @@ enum pipe_error svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, struct pipe_resource *index_buffer, unsigned index_size, + int index_bias, unsigned min_index, unsigned max_index, - unsigned prim, unsigned start, unsigned count, - unsigned bias) + unsigned prim, unsigned start, unsigned count) { unsigned gen_prim, gen_size, gen_nr, gen_type; u_translate_func gen_func; @@ -204,9 +204,10 @@ svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, */ return svga_hwtnl_simple_draw_range_elements( hwtnl, index_buffer, index_size, + index_bias, min_index, max_index, - gen_prim, start, count, bias ); + gen_prim, start, count ); } else { struct pipe_resource *gen_buf = NULL; @@ -231,12 +232,12 @@ svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, ret = svga_hwtnl_simple_draw_range_elements( hwtnl, gen_buf, gen_size, + index_bias, min_index, max_index, gen_prim, 0, - gen_nr, - bias ); + gen_nr ); if (ret) goto done; diff --git a/src/gallium/drivers/svga/svga_draw_private.h b/src/gallium/drivers/svga/svga_draw_private.h index b6fcd6854c..11afb59875 100644 --- a/src/gallium/drivers/svga/svga_draw_private.h +++ b/src/gallium/drivers/svga/svga_draw_private.h @@ -147,12 +147,12 @@ enum pipe_error svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl, struct pipe_resource *indexBuffer, unsigned index_size, + int index_bias, unsigned min_index, unsigned max_index, unsigned prim, unsigned start, - unsigned count, - unsigned bias ); + unsigned count ); #endif diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index a05272b2e4..58e930d983 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -44,6 +44,7 @@ static enum pipe_error retry_draw_range_elements( struct svga_context *svga, struct pipe_resource *index_buffer, unsigned index_size, + int index_bias, unsigned min_index, unsigned max_index, unsigned prim, @@ -66,9 +67,9 @@ retry_draw_range_elements( struct svga_context *svga, goto retry; ret = svga_hwtnl_draw_range_elements( svga->hwtnl, - index_buffer, index_size, + index_buffer, index_size, index_bias, min_index, max_index, - prim, start, count, 0 ); + prim, start, count ); if (ret) goto retry; @@ -86,7 +87,7 @@ retry: if (do_retry) { return retry_draw_range_elements( svga, - index_buffer, index_size, + index_buffer, index_size, index_bias, min_index, max_index, prim, start, count, FALSE ); @@ -152,6 +153,7 @@ static void svga_draw_range_elements( struct pipe_context *pipe, struct pipe_resource *index_buffer, unsigned index_size, + int index_bias, unsigned min_index, unsigned max_index, unsigned prim, unsigned start, unsigned count) @@ -190,6 +192,7 @@ svga_draw_range_elements( struct pipe_context *pipe, ret = svga_swtnl_draw_range_elements( svga, index_buffer, index_size, + index_bias, min_index, max_index, prim, start, count ); @@ -199,6 +202,7 @@ svga_draw_range_elements( struct pipe_context *pipe, ret = retry_draw_range_elements( svga, index_buffer, index_size, + index_bias, min_index, max_index, prim, @@ -225,11 +229,11 @@ svga_draw_range_elements( struct pipe_context *pipe, static void svga_draw_elements( struct pipe_context *pipe, struct pipe_resource *index_buffer, - unsigned index_size, + unsigned index_size, int index_bias, unsigned prim, unsigned start, unsigned count) { svga_draw_range_elements( pipe, index_buffer, - index_size, + index_size, index_bias, 0, 0xffffffff, prim, start, count ); } @@ -238,7 +242,7 @@ static void svga_draw_arrays( struct pipe_context *pipe, unsigned prim, unsigned start, unsigned count) { - svga_draw_range_elements(pipe, NULL, 0, + svga_draw_range_elements(pipe, NULL, 0, 0, start, start + count - 1, prim, start, count); diff --git a/src/gallium/drivers/svga/svga_swtnl.h b/src/gallium/drivers/svga/svga_swtnl.h index 096ed410b5..8724690f7e 100644 --- a/src/gallium/drivers/svga/svga_swtnl.h +++ b/src/gallium/drivers/svga/svga_swtnl.h @@ -42,6 +42,7 @@ enum pipe_error svga_swtnl_draw_range_elements(struct svga_context *svga, struct pipe_resource *indexBuffer, unsigned indexSize, + int indexBias, unsigned min_index, unsigned max_index, unsigned prim, diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c index e649813608..b0cbead8a5 100644 --- a/src/gallium/drivers/svga/svga_swtnl_backend.c +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c @@ -247,7 +247,7 @@ svga_vbuf_render_draw( struct vbuf_render *render, struct svga_vbuf_render *svga_render = svga_vbuf_render(render); struct svga_context *svga = svga_render->svga; struct pipe_screen *screen = svga->pipe.screen; - unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size; + int bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size; boolean ret; size_t size = 2 * nr_indices; @@ -280,19 +280,21 @@ svga_vbuf_render_draw( struct vbuf_render *render, ret = svga_hwtnl_draw_range_elements(svga->hwtnl, svga_render->ibuf, 2, + bias, svga_render->min_index, svga_render->max_index, svga_render->prim, - svga_render->ibuf_offset / 2, nr_indices, bias); + svga_render->ibuf_offset / 2, nr_indices); if(ret != PIPE_OK) { svga_context_flush(svga, NULL); ret = svga_hwtnl_draw_range_elements(svga->hwtnl, svga_render->ibuf, 2, + bias, svga_render->min_index, svga_render->max_index, svga_render->prim, - svga_render->ibuf_offset / 2, nr_indices, bias); + svga_render->ibuf_offset / 2, nr_indices); svga->swtnl.new_vbuf = TRUE; assert(ret == PIPE_OK); } diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index f771dd59d3..4504bf71fd 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -39,6 +39,7 @@ enum pipe_error svga_swtnl_draw_range_elements(struct svga_context *svga, struct pipe_resource *indexBuffer, unsigned indexSize, + int indexBias, unsigned min_index, unsigned max_index, unsigned prim, unsigned start, unsigned count) @@ -82,7 +83,7 @@ svga_swtnl_draw_range_elements(struct svga_context *svga, &ib_transfer); draw_set_mapped_element_buffer_range(draw, - indexSize, + indexSize, indexBias, min_index, max_index, map); @@ -118,7 +119,7 @@ svga_swtnl_draw_range_elements(struct svga_context *svga, if (indexBuffer) { pipe_buffer_unmap(&svga->pipe, indexBuffer, ib_transfer); - draw_set_mapped_element_buffer(draw, 0, NULL); + draw_set_mapped_element_buffer(draw, 0, 0, NULL); } if (svga->curr.cb[PIPE_SHADER_VERTEX]) { |