mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
svga: Implement index bias.
Untested.
This commit is contained in:
parent
989861fc5e
commit
9515b78859
7 changed files with 32 additions and 23 deletions
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue