svga: clean up return values and error codes
Previously we were using a hodge podge of int vs. pipe_enum and 0 vs. PIPE_OK. Some functions that always returned PIPE_OK were made void.
This commit is contained in:
@@ -159,7 +159,7 @@ struct pipe_context *svga_context_create( struct pipe_screen *screen,
|
||||
goto no_swtnl;
|
||||
|
||||
ret = svga_emit_initial_state( svga );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto no_state;
|
||||
|
||||
/* Avoid shortcircuiting state with initial value of zero.
|
||||
|
||||
@@ -260,7 +260,7 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
|
||||
unsigned max_index,
|
||||
struct pipe_resource *ib )
|
||||
{
|
||||
int ret = PIPE_OK;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
||||
@@ -272,7 +272,7 @@ svga_hwtnl_draw_arrays( struct svga_hwtnl *hwtnl,
|
||||
gen_size,
|
||||
gen_func,
|
||||
&gen_buf );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto done;
|
||||
|
||||
ret = svga_hwtnl_simple_draw_range_elements( hwtnl,
|
||||
@@ -285,7 +285,7 @@ svga_hwtnl_draw_arrays( struct svga_hwtnl *hwtnl,
|
||||
0,
|
||||
gen_nr );
|
||||
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto done;
|
||||
|
||||
done:
|
||||
|
||||
@@ -112,7 +112,7 @@ svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl,
|
||||
unsigned hw_prim;
|
||||
unsigned hw_count;
|
||||
unsigned index_offset = start * index_size;
|
||||
int ret = PIPE_OK;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
hw_prim = svga_translate_prim(prim, count, &hw_count);
|
||||
if (hw_count == 0)
|
||||
@@ -132,7 +132,7 @@ svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl,
|
||||
&index_offset,
|
||||
&upload_buffer,
|
||||
&flushed );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto done;
|
||||
|
||||
/* Don't need to worry about refcounting index_buffer as this is
|
||||
@@ -150,7 +150,7 @@ svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl,
|
||||
range.indexBias = index_bias;
|
||||
|
||||
ret = svga_hwtnl_prim( hwtnl, &range, min_index, max_index, index_buffer );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto done;
|
||||
|
||||
done:
|
||||
@@ -230,7 +230,7 @@ svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl,
|
||||
gen_size,
|
||||
gen_func,
|
||||
&gen_buf );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto done;
|
||||
|
||||
ret = svga_hwtnl_simple_draw_range_elements( hwtnl,
|
||||
@@ -242,7 +242,7 @@ svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl,
|
||||
gen_prim,
|
||||
0,
|
||||
gen_nr );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto done;
|
||||
|
||||
done:
|
||||
|
||||
@@ -41,7 +41,7 @@ try_clear(struct svga_context *svga,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
{
|
||||
int ret = PIPE_OK;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
SVGA3dRect rect = { 0, 0, 0, 0 };
|
||||
boolean restore_viewport = FALSE;
|
||||
SVGA3dClearFlag flags = 0;
|
||||
@@ -49,7 +49,7 @@ try_clear(struct svga_context *svga,
|
||||
union util_color uc = {0};
|
||||
|
||||
ret = svga_update_state(svga, SVGA_STATE_HW_CLEAR);
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
if (svga->rebind.rendertargets) {
|
||||
@@ -82,7 +82,7 @@ try_clear(struct svga_context *svga,
|
||||
if (memcmp(&rect, &svga->state.hw_clear.viewport, sizeof(rect)) != 0) {
|
||||
restore_viewport = TRUE;
|
||||
ret = SVGA3D_SetViewport(svga->swc, &rect);
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ svga_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
struct svga_context *svga = svga_context( pipe );
|
||||
int ret;
|
||||
enum pipe_error ret;
|
||||
|
||||
if (buffers & PIPE_CLEAR_COLOR)
|
||||
SVGA_DBG(DEBUG_DMA, "clear sid %p\n",
|
||||
|
||||
@@ -226,7 +226,7 @@ retry_draw_range_elements( struct svga_context *svga,
|
||||
unsigned instance_count,
|
||||
boolean do_retry )
|
||||
{
|
||||
enum pipe_error ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
svga_hwtnl_set_unfilled( svga->hwtnl,
|
||||
svga->curr.rast->hw_unfilled );
|
||||
@@ -241,14 +241,14 @@ retry_draw_range_elements( struct svga_context *svga,
|
||||
goto retry;
|
||||
|
||||
ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto retry;
|
||||
|
||||
ret = svga_hwtnl_draw_range_elements( svga->hwtnl,
|
||||
index_buffer, index_size, index_bias,
|
||||
min_index, max_index,
|
||||
prim, start, count );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto retry;
|
||||
|
||||
return PIPE_OK;
|
||||
@@ -292,12 +292,12 @@ retry_draw_arrays( struct svga_context *svga,
|
||||
goto retry;
|
||||
|
||||
ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto retry;
|
||||
|
||||
ret = svga_hwtnl_draw_arrays( svga->hwtnl, prim,
|
||||
start, count );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto retry;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -119,16 +119,17 @@ static void xor_states( unsigned *result,
|
||||
|
||||
|
||||
|
||||
static int update_state( struct svga_context *svga,
|
||||
const struct svga_tracked_state *atoms[],
|
||||
unsigned *state )
|
||||
static enum pipe_error
|
||||
update_state(struct svga_context *svga,
|
||||
const struct svga_tracked_state *atoms[],
|
||||
unsigned *state)
|
||||
{
|
||||
boolean debug = TRUE;
|
||||
enum pipe_error ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
unsigned i;
|
||||
|
||||
ret = svga_hwtnl_flush( svga->hwtnl );
|
||||
if (ret != 0)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
if (debug) {
|
||||
@@ -151,7 +152,7 @@ static int update_state( struct svga_context *svga,
|
||||
if (0)
|
||||
debug_printf("update: %s\n", atoms[i]->name);
|
||||
ret = atoms[i]->update( svga, *state );
|
||||
if (ret != 0)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -174,22 +175,22 @@ static int update_state( struct svga_context *svga,
|
||||
for (i = 0; atoms[i] != NULL; i++) {
|
||||
if (check_state(*state, atoms[i]->dirty)) {
|
||||
ret = atoms[i]->update( svga, *state );
|
||||
if (ret != 0)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int svga_update_state( struct svga_context *svga,
|
||||
unsigned max_level )
|
||||
enum pipe_error
|
||||
svga_update_state(struct svga_context *svga, unsigned max_level)
|
||||
{
|
||||
struct svga_screen *screen = svga_screen(svga->pipe.screen);
|
||||
int ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
int i;
|
||||
|
||||
/* Check for updates to bound textures. This can't be done in an
|
||||
@@ -208,7 +209,7 @@ int svga_update_state( struct svga_context *svga,
|
||||
ret = update_state( svga,
|
||||
state_levels[i],
|
||||
&svga->dirty );
|
||||
if (ret != 0)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
svga->state.dirty[i] = 0;
|
||||
@@ -219,7 +220,7 @@ int svga_update_state( struct svga_context *svga,
|
||||
svga->state.dirty[i] |= svga->dirty;
|
||||
|
||||
svga->dirty = 0;
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +229,7 @@ int svga_update_state( struct svga_context *svga,
|
||||
void svga_update_state_retry( struct svga_context *svga,
|
||||
unsigned max_level )
|
||||
{
|
||||
int ret;
|
||||
enum pipe_error ret;
|
||||
|
||||
ret = svga_update_state( svga, max_level );
|
||||
|
||||
@@ -237,7 +238,7 @@ void svga_update_state_retry( struct svga_context *svga,
|
||||
ret = svga_update_state( svga, max_level );
|
||||
}
|
||||
|
||||
assert( ret == 0 );
|
||||
assert( ret == PIPE_OK );
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +262,7 @@ enum pipe_error svga_emit_initial_state( struct svga_context *svga )
|
||||
enum pipe_error ret;
|
||||
|
||||
ret = SVGA3D_BeginSetRenderState( svga->swc, &rs, COUNT );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
/* Always use D3D style coordinate space as this is the only one
|
||||
@@ -273,6 +274,5 @@ enum pipe_error svga_emit_initial_state( struct svga_context *svga )
|
||||
assert( COUNT == count );
|
||||
SVGA_FIFOCommitAll( svga->swc );
|
||||
|
||||
return 0;
|
||||
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void svga_destroy_state( struct svga_context *svga );
|
||||
struct svga_tracked_state {
|
||||
const char *name;
|
||||
unsigned dirty;
|
||||
int (*update)( struct svga_context *svga, unsigned dirty );
|
||||
enum pipe_error (*update)( struct svga_context *svga, unsigned dirty );
|
||||
};
|
||||
|
||||
/* NEED_SWTNL
|
||||
|
||||
@@ -59,12 +59,10 @@ static int svga_shader_type( int shader )
|
||||
/*
|
||||
* Check and emit one shader constant register.
|
||||
*/
|
||||
static int emit_const( struct svga_context *svga,
|
||||
int unit,
|
||||
int i,
|
||||
const float *value )
|
||||
static enum pipe_error
|
||||
emit_const(struct svga_context *svga, int unit, int i, const float *value)
|
||||
{
|
||||
int ret = PIPE_OK;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
assert(i < CB_MAX);
|
||||
|
||||
@@ -84,7 +82,7 @@ static int emit_const( struct svga_context *svga,
|
||||
svga_shader_type(unit),
|
||||
SVGA3D_CONST_TYPE_FLOAT,
|
||||
value );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
memcpy(svga->state.hw_draw.cb[unit][i], value, 4 * sizeof(float));
|
||||
@@ -207,16 +205,16 @@ static enum pipe_error emit_const_range( struct svga_context *svga,
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
static int emit_consts( struct svga_context *svga,
|
||||
int offset,
|
||||
int unit )
|
||||
|
||||
static enum pipe_error
|
||||
emit_consts(struct svga_context *svga, int offset, int unit)
|
||||
{
|
||||
struct svga_screen *ss = svga_screen(svga->pipe.screen);
|
||||
struct pipe_transfer *transfer = NULL;
|
||||
unsigned count;
|
||||
const float (*data)[4] = NULL;
|
||||
unsigned i;
|
||||
int ret = PIPE_OK;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
if (svga->curr.cb[unit] == NULL)
|
||||
goto done;
|
||||
@@ -252,16 +250,17 @@ done:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int emit_fs_consts( struct svga_context *svga,
|
||||
unsigned dirty )
|
||||
|
||||
|
||||
static enum pipe_error
|
||||
emit_fs_consts(struct svga_context *svga, unsigned dirty)
|
||||
{
|
||||
const struct svga_shader_result *result = svga->state.hw_draw.fs;
|
||||
const struct svga_fs_compile_key *key = &result->key.fkey;
|
||||
int ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
ret = emit_consts( svga, 0, PIPE_SHADER_FRAGMENT );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
/* The internally generated fragment shader for xor blending
|
||||
@@ -288,7 +287,7 @@ static int emit_fs_consts( struct svga_context *svga,
|
||||
PIPE_SHADER_FRAGMENT,
|
||||
key->tex[i].width_height_idx + offset,
|
||||
data );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -312,23 +311,23 @@ struct svga_tracked_state svga_hw_fs_parameters =
|
||||
/***********************************************************************
|
||||
*/
|
||||
|
||||
static int emit_vs_consts( struct svga_context *svga,
|
||||
unsigned dirty )
|
||||
static enum pipe_error
|
||||
emit_vs_consts(struct svga_context *svga, unsigned dirty)
|
||||
{
|
||||
const struct svga_shader_result *result = svga->state.hw_draw.vs;
|
||||
const struct svga_vs_compile_key *key = &result->key.vkey;
|
||||
int ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
unsigned offset;
|
||||
|
||||
/* SVGA_NEW_VS_RESULT
|
||||
*/
|
||||
if (result == NULL)
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
|
||||
/* SVGA_NEW_VS_CONST_BUFFER
|
||||
*/
|
||||
ret = emit_consts( svga, 0, PIPE_SHADER_VERTEX );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
offset = result->shader->info.file_max[TGSI_FILE_CONSTANT] + 1;
|
||||
@@ -338,12 +337,12 @@ static int emit_vs_consts( struct svga_context *svga,
|
||||
if (key->need_prescale) {
|
||||
ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++,
|
||||
svga->state.hw_clear.prescale.scale );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++,
|
||||
svga->state.hw_clear.prescale.translate );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -356,14 +355,14 @@ static int emit_vs_consts( struct svga_context *svga,
|
||||
ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++,
|
||||
svga->curr.zero_stride_constants +
|
||||
4 * curr_zero_stride );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
++curr_zero_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ static enum pipe_error compile_fs( struct svga_context *svga,
|
||||
SVGA3D_SHADERTYPE_PS,
|
||||
result->tokens,
|
||||
result->nr_tokens * sizeof result->tokens[0]);
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto fail;
|
||||
|
||||
*out_result = result;
|
||||
@@ -114,8 +114,9 @@ fail:
|
||||
* SVGA_NEW_NEED_SWTNL
|
||||
* SVGA_NEW_SAMPLER
|
||||
*/
|
||||
static int make_fs_key( const struct svga_context *svga,
|
||||
struct svga_fs_compile_key *key )
|
||||
static enum pipe_error
|
||||
make_fs_key(const struct svga_context *svga,
|
||||
struct svga_fs_compile_key *key)
|
||||
{
|
||||
int i;
|
||||
int idx = 0;
|
||||
@@ -193,17 +194,17 @@ static int make_fs_key( const struct svga_context *svga,
|
||||
key->sprite_origin_lower_left = (svga->curr.rast->templ.sprite_coord_mode
|
||||
== PIPE_SPRITE_COORD_LOWER_LEFT);
|
||||
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int emit_hw_fs( struct svga_context *svga,
|
||||
unsigned dirty )
|
||||
static enum pipe_error
|
||||
emit_hw_fs(struct svga_context *svga, unsigned dirty)
|
||||
{
|
||||
struct svga_shader_result *result = NULL;
|
||||
unsigned id = SVGA3D_INVALID_ID;
|
||||
int ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
struct svga_fragment_shader *fs = svga->curr.fs;
|
||||
struct svga_fs_compile_key key;
|
||||
@@ -215,13 +216,13 @@ static int emit_hw_fs( struct svga_context *svga,
|
||||
* SVGA_NEW_SAMPLER
|
||||
*/
|
||||
ret = make_fs_key( svga, &key );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
result = search_fs_key( fs, &key );
|
||||
if (!result) {
|
||||
ret = compile_fs( svga, fs, &key, &result );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -234,14 +235,14 @@ static int emit_hw_fs( struct svga_context *svga,
|
||||
ret = SVGA3D_SetShader(svga->swc,
|
||||
SVGA3D_SHADERTYPE_PS,
|
||||
id );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
svga->dirty |= SVGA_NEW_FS_RESULT;
|
||||
svga->state.hw_draw.fs = result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
struct svga_tracked_state svga_hw_fs =
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
*/
|
||||
|
||||
|
||||
static int emit_hw_vs_vdecl( struct svga_context *svga,
|
||||
unsigned dirty )
|
||||
static enum pipe_error
|
||||
emit_hw_vs_vdecl(struct svga_context *svga, unsigned dirty)
|
||||
{
|
||||
const struct pipe_vertex_element *ve = svga->curr.velems->velem;
|
||||
SVGA3dVertexDecl decl;
|
||||
@@ -128,17 +128,17 @@ static int emit_hw_vs_vdecl( struct svga_context *svga,
|
||||
}
|
||||
|
||||
svga_hwtnl_set_index_bias( svga->hwtnl, -neg_bias );
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
static int emit_hw_vdecl( struct svga_context *svga,
|
||||
unsigned dirty )
|
||||
static enum pipe_error
|
||||
emit_hw_vdecl(struct svga_context *svga, unsigned dirty)
|
||||
{
|
||||
/* SVGA_NEW_NEED_SWTNL
|
||||
*/
|
||||
if (svga->state.sw.need_swtnl)
|
||||
return 0; /* Do not emit during swtnl */
|
||||
return PIPE_OK; /* Do not emit during swtnl */
|
||||
|
||||
return emit_hw_vs_vdecl( svga, dirty );
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ static enum pipe_error compile_vs( struct svga_context *svga,
|
||||
SVGA3D_SHADERTYPE_VS,
|
||||
result->tokens,
|
||||
result->nr_tokens * sizeof result->tokens[0]);
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
goto fail;
|
||||
|
||||
*out_result = result;
|
||||
@@ -109,8 +109,8 @@ fail:
|
||||
|
||||
/* SVGA_NEW_PRESCALE, SVGA_NEW_RAST, SVGA_NEW_ZERO_STRIDE
|
||||
*/
|
||||
static int make_vs_key( struct svga_context *svga,
|
||||
struct svga_vs_compile_key *key )
|
||||
static void
|
||||
make_vs_key(struct svga_context *svga, struct svga_vs_compile_key *key)
|
||||
{
|
||||
memset(key, 0, sizeof *key);
|
||||
key->need_prescale = svga->state.hw_clear.prescale.enabled;
|
||||
@@ -119,31 +119,28 @@ static int make_vs_key( struct svga_context *svga,
|
||||
svga->curr.zero_stride_vertex_elements;
|
||||
key->num_zero_stride_vertex_elements =
|
||||
svga->curr.num_zero_stride_vertex_elements;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int emit_hw_vs( struct svga_context *svga,
|
||||
unsigned dirty )
|
||||
static enum pipe_error
|
||||
emit_hw_vs(struct svga_context *svga, unsigned dirty)
|
||||
{
|
||||
struct svga_shader_result *result = NULL;
|
||||
unsigned id = SVGA3D_INVALID_ID;
|
||||
int ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
/* SVGA_NEW_NEED_SWTNL */
|
||||
if (!svga->state.sw.need_swtnl) {
|
||||
struct svga_vertex_shader *vs = svga->curr.vs;
|
||||
struct svga_vs_compile_key key;
|
||||
|
||||
ret = make_vs_key( svga, &key );
|
||||
if (ret)
|
||||
return ret;
|
||||
make_vs_key( svga, &key );
|
||||
|
||||
result = search_vs_key( vs, &key );
|
||||
if (!result) {
|
||||
ret = compile_vs( svga, vs, &key, &result );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -155,14 +152,14 @@ static int emit_hw_vs( struct svga_context *svga,
|
||||
ret = SVGA3D_SetShader(svga->swc,
|
||||
SVGA3D_SHADERTYPE_VS,
|
||||
id );
|
||||
if (ret)
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
||||
svga->dirty |= SVGA_NEW_VS_RESULT;
|
||||
svga->state.hw_draw.vs = result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
struct svga_tracked_state svga_hw_vs =
|
||||
|
||||
@@ -176,7 +176,7 @@ svga_vbuf_submit_state( struct svga_vbuf_render *svga_render )
|
||||
|
||||
/* flush the hw state */
|
||||
ret = svga_hwtnl_flush(svga->hwtnl);
|
||||
if (ret) {
|
||||
if (ret != PIPE_OK) {
|
||||
svga_context_flush(svga, NULL);
|
||||
ret = svga_hwtnl_flush(svga->hwtnl);
|
||||
/* if we hit this path we might become synced with hw */
|
||||
@@ -222,7 +222,7 @@ svga_vbuf_render_draw_arrays( struct vbuf_render *render,
|
||||
struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
|
||||
struct svga_context *svga = svga_render->svga;
|
||||
unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size;
|
||||
enum pipe_error ret = 0;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
/* off to hardware */
|
||||
svga_vbuf_submit_state(svga_render);
|
||||
|
||||
@@ -55,7 +55,7 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
|
||||
svga->state.sw.in_swtnl_draw = TRUE;
|
||||
|
||||
ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW);
|
||||
if (ret) {
|
||||
if (ret != PIPE_OK) {
|
||||
svga_context_flush(svga, NULL);
|
||||
ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW);
|
||||
svga->swtnl.new_vbuf = TRUE;
|
||||
|
||||
@@ -175,7 +175,6 @@ svga_tgsi_translate( const struct svga_shader *shader,
|
||||
{
|
||||
struct svga_shader_result *result = NULL;
|
||||
struct svga_shader_emitter emit;
|
||||
int ret = 0;
|
||||
|
||||
memset(&emit, 0, sizeof(emit));
|
||||
|
||||
@@ -183,7 +182,6 @@ svga_tgsi_translate( const struct svga_shader *shader,
|
||||
emit.size = 1024;
|
||||
emit.buf = MALLOC(emit.size);
|
||||
if (emit.buf == NULL) {
|
||||
ret = PIPE_ERROR_OUT_OF_MEMORY;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user