diff options
author | José Fonseca <[email protected]> | 2010-04-20 11:07:08 +0200 |
---|---|---|
committer | José Fonseca <[email protected]> | 2010-04-20 11:07:08 +0200 |
commit | a6171a9dd99713266091982215bf1008c9ac8e64 (patch) | |
tree | 7be00d0ab09dec383d9acc4fd3b135dfd8ed5c45 /src/gallium/drivers/r300/r300_render.c | |
parent | 49ba607abab17cc07e9f163f5415636474fd7940 (diff) | |
parent | 3dcdca433a5d6cde1c0b4d69ff0aa3a5eee26473 (diff) |
Merge branch 'gallium-index-bias'
Diffstat (limited to 'src/gallium/drivers/r300/r300_render.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index a3fd8cc67d8..23b61df89cc 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -298,6 +298,7 @@ void r500_emit_draw_arrays(struct r300_context *r300, void r500_emit_draw_elements(struct r300_context *r300, struct pipe_resource* indexBuffer, unsigned indexSize, + int indexBias, unsigned minIndex, unsigned maxIndex, unsigned mode, @@ -319,6 +320,8 @@ void r500_emit_draw_elements(struct r300_context *r300, return; } + assert(indexBias == 0); + maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index); DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n", @@ -442,6 +445,7 @@ void r300_emit_draw_arrays(struct r300_context *r300, void r300_emit_draw_elements(struct r300_context *r300, struct pipe_resource* indexBuffer, unsigned indexSize, + int indexBias, unsigned minIndex, unsigned maxIndex, unsigned mode, @@ -449,15 +453,15 @@ void r300_emit_draw_elements(struct r300_context *r300, unsigned count) { if (!r300->stencil_ref_bf_fallback) { - r500_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, - maxIndex, mode, start, count); + r500_emit_draw_elements(r300, indexBuffer, indexSize, indexBias, + minIndex, maxIndex, mode, start, count); } else { r300_begin_stencil_ref_fallback(r300); - r500_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, - maxIndex, mode, start, count); + r500_emit_draw_elements(r300, indexBuffer, indexSize, indexBias, + minIndex, maxIndex, mode, start, count); r300_switch_stencil_ref_side(r300); - r500_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, - maxIndex, mode, start, count); + r500_emit_draw_elements(r300, indexBuffer, indexSize, indexBias, + minIndex, maxIndex, mode, start, count); r300_end_stencil_ref_fallback(r300); } } @@ -528,6 +532,7 @@ static void r300_align_ushort_elts(struct r300_context *r300, void r300_draw_range_elements(struct pipe_context* pipe, struct pipe_resource* indexBuffer, unsigned indexSize, + int indexBias, unsigned minIndex, unsigned maxIndex, unsigned mode, @@ -574,13 +579,14 @@ void r300_draw_range_elements(struct pipe_context* pipe, u_upload_flush(r300->upload_vb); u_upload_flush(r300->upload_ib); if (alt_num_verts || count <= 65535) { - r300->emit_draw_elements(r300, indexBuffer, indexSize, minIndex, - maxIndex, mode, start, count); + r300->emit_draw_elements(r300, indexBuffer, indexSize, indexBias, + minIndex, maxIndex, mode, start, count); } else { do { short_count = MIN2(count, 65534); - r300->emit_draw_elements(r300, indexBuffer, indexSize, minIndex, - maxIndex, mode, start, short_count); + r300->emit_draw_elements(r300, indexBuffer, indexSize, indexBias, + minIndex, maxIndex, + mode, start, short_count); start += short_count; count -= short_count; @@ -602,13 +608,13 @@ void r300_draw_range_elements(struct pipe_context* pipe, /* Simple helpers for context setup. Should probably be moved to util. */ void r300_draw_elements(struct pipe_context* pipe, struct pipe_resource* indexBuffer, - unsigned indexSize, unsigned mode, + unsigned indexSize, int indexBias, unsigned mode, unsigned start, unsigned count) { struct r300_context *r300 = r300_context(pipe); - pipe->draw_range_elements(pipe, indexBuffer, indexSize, 0, - r300->vertex_buffer_max_index, + pipe->draw_range_elements(pipe, indexBuffer, indexSize, indexBias, + 0, r300->vertex_buffer_max_index, mode, start, count); } @@ -698,7 +704,7 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe, draw_set_mapped_vertex_buffer(r300->draw, i, buf); } - draw_set_mapped_element_buffer(r300->draw, 0, NULL); + draw_set_mapped_element_buffer(r300->draw, 0, 0, NULL); draw_arrays(r300->draw, mode, start, count); @@ -713,6 +719,7 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe, void r300_swtcl_draw_range_elements(struct pipe_context* pipe, struct pipe_resource* indexBuffer, unsigned indexSize, + int indexBias, unsigned minIndex, unsigned maxIndex, unsigned mode, @@ -743,7 +750,7 @@ void r300_swtcl_draw_range_elements(struct pipe_context* pipe, indices = pipe_buffer_map(pipe, indexBuffer, PIPE_TRANSFER_READ, &ib_transfer); - draw_set_mapped_element_buffer_range(r300->draw, indexSize, + draw_set_mapped_element_buffer_range(r300->draw, indexSize, indexBias, minIndex, maxIndex, indices); draw_arrays(r300->draw, mode, start, count); @@ -756,8 +763,9 @@ void r300_swtcl_draw_range_elements(struct pipe_context* pipe, pipe_buffer_unmap(pipe, indexBuffer, ib_transfer); - draw_set_mapped_element_buffer_range(r300->draw, 0, start, - start + count - 1, NULL); + draw_set_mapped_element_buffer_range(r300->draw, 0, 0, + start, start + count - 1, + NULL); } /* Object for rendering using Draw. */ |