mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
svga: clean up retry_draw_range_elements(), retry_draw_arrays()
Get rid of a bunch of goto spaghetti. Remove unneeded do_retry parameter. No Piglit changes. Also tested w/ Google Earth and other apps. Reviewed-by: Neha Bhende <bhenden@vmware.com>
This commit is contained in:
parent
c744289552
commit
7a1401938b
1 changed files with 27 additions and 54 deletions
|
|
@ -65,19 +65,14 @@ retry_draw_range_elements( struct svga_context *svga,
|
||||||
unsigned start,
|
unsigned start,
|
||||||
unsigned count,
|
unsigned count,
|
||||||
unsigned start_instance,
|
unsigned start_instance,
|
||||||
unsigned instance_count,
|
unsigned instance_count)
|
||||||
boolean do_retry )
|
|
||||||
{
|
{
|
||||||
enum pipe_error ret = PIPE_OK;
|
enum pipe_error ret;
|
||||||
|
|
||||||
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWELEMENTS);
|
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWELEMENTS);
|
||||||
|
|
||||||
svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
|
svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
|
||||||
|
|
||||||
ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
|
|
||||||
if (ret != PIPE_OK)
|
|
||||||
goto retry;
|
|
||||||
|
|
||||||
/** determine if flatshade is to be used after svga_update_state()
|
/** determine if flatshade is to be used after svga_update_state()
|
||||||
* in case the fragment shader is changed.
|
* in case the fragment shader is changed.
|
||||||
*/
|
*/
|
||||||
|
|
@ -86,29 +81,21 @@ retry_draw_range_elements( struct svga_context *svga,
|
||||||
is_using_flat_shading(svga),
|
is_using_flat_shading(svga),
|
||||||
svga->curr.rast->templ.flatshade_first);
|
svga->curr.rast->templ.flatshade_first);
|
||||||
|
|
||||||
ret = svga_hwtnl_draw_range_elements( svga->hwtnl,
|
for (unsigned try = 0; try < 2; try++) {
|
||||||
index_buffer, index_size, index_bias,
|
ret = svga_update_state(svga, SVGA_STATE_HW_DRAW);
|
||||||
min_index, max_index,
|
if (ret == PIPE_OK) {
|
||||||
prim, start, count,
|
ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
|
||||||
start_instance, instance_count);
|
index_buffer, index_size,
|
||||||
if (ret != PIPE_OK)
|
index_bias,
|
||||||
goto retry;
|
min_index, max_index,
|
||||||
|
prim, start, count,
|
||||||
goto done;
|
start_instance, instance_count);
|
||||||
|
if (ret == PIPE_OK)
|
||||||
retry:
|
break;
|
||||||
svga_context_flush( svga, NULL );
|
}
|
||||||
|
svga_context_flush(svga, NULL);
|
||||||
if (do_retry)
|
|
||||||
{
|
|
||||||
ret = retry_draw_range_elements(svga,
|
|
||||||
index_buffer, index_size, index_bias,
|
|
||||||
min_index, max_index,
|
|
||||||
prim, start, count,
|
|
||||||
start_instance, instance_count, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
|
||||||
SVGA_STATS_TIME_POP(svga_sws(svga));
|
SVGA_STATS_TIME_POP(svga_sws(svga));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -117,8 +104,7 @@ done:
|
||||||
static enum pipe_error
|
static enum pipe_error
|
||||||
retry_draw_arrays( struct svga_context *svga,
|
retry_draw_arrays( struct svga_context *svga,
|
||||||
enum pipe_prim_type prim, unsigned start, unsigned count,
|
enum pipe_prim_type prim, unsigned start, unsigned count,
|
||||||
unsigned start_instance, unsigned instance_count,
|
unsigned start_instance, unsigned instance_count)
|
||||||
boolean do_retry )
|
|
||||||
{
|
{
|
||||||
enum pipe_error ret;
|
enum pipe_error ret;
|
||||||
|
|
||||||
|
|
@ -126,10 +112,6 @@ retry_draw_arrays( struct svga_context *svga,
|
||||||
|
|
||||||
svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
|
svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
|
||||||
|
|
||||||
ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
|
|
||||||
if (ret != PIPE_OK)
|
|
||||||
goto retry;
|
|
||||||
|
|
||||||
/** determine if flatshade is to be used after svga_update_state()
|
/** determine if flatshade is to be used after svga_update_state()
|
||||||
* in case the fragment shader is changed.
|
* in case the fragment shader is changed.
|
||||||
*/
|
*/
|
||||||
|
|
@ -138,24 +120,17 @@ retry_draw_arrays( struct svga_context *svga,
|
||||||
is_using_flat_shading(svga),
|
is_using_flat_shading(svga),
|
||||||
svga->curr.rast->templ.flatshade_first);
|
svga->curr.rast->templ.flatshade_first);
|
||||||
|
|
||||||
ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
|
for (unsigned try = 0; try < 2; try++) {
|
||||||
start_instance, instance_count);
|
ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
|
||||||
if (ret != PIPE_OK)
|
if (ret == PIPE_OK) {
|
||||||
goto retry;
|
ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
|
||||||
|
start_instance, instance_count);
|
||||||
goto done;
|
if (ret == PIPE_OK)
|
||||||
|
break;
|
||||||
retry:
|
}
|
||||||
if (ret == PIPE_ERROR_OUT_OF_MEMORY && do_retry)
|
svga_context_flush(svga, NULL);
|
||||||
{
|
|
||||||
svga_context_flush( svga, NULL );
|
|
||||||
|
|
||||||
ret = retry_draw_arrays(svga, prim, start, count,
|
|
||||||
start_instance, instance_count,
|
|
||||||
FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
|
||||||
SVGA_STATS_TIME_POP(svga_sws(svga));
|
SVGA_STATS_TIME_POP(svga_sws(svga));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -277,13 +252,11 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
|
||||||
info->start + offset,
|
info->start + offset,
|
||||||
count,
|
count,
|
||||||
info->start_instance,
|
info->start_instance,
|
||||||
info->instance_count,
|
info->instance_count);
|
||||||
TRUE );
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = retry_draw_arrays(svga, info->mode, info->start, count,
|
ret = retry_draw_arrays(svga, info->mode, info->start, count,
|
||||||
info->start_instance, info->instance_count,
|
info->start_instance, info->instance_count);
|
||||||
TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue