From: Marek Olšák Date: Sun, 30 Apr 2017 12:42:45 +0000 (+0200) Subject: st/mesa: fold error handling into setup_(non_)interleaved_attribs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=71fde4905994083d4a85bf373e81292a842153e0;p=mesa.git st/mesa: fold error handling into setup_(non_)interleaved_attribs Tested-by: Edmondo Tommasina Reviewed-by: Brian Paul Reviewed-by: Nicolai Hähnle --- diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index 522073f205d..db03b20a412 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -447,7 +447,7 @@ set_vertex_attribs(struct st_context *st, * \param vbuffer returns vertex buffer info * \param velements returns vertex element info */ -static boolean +static void setup_interleaved_attribs(struct st_context *st, const struct st_vertex_program *vp, const struct st_vp_variant *vpv, @@ -536,7 +536,8 @@ setup_interleaved_attribs(struct st_context *st, struct st_buffer_object *stobj = st_buffer_object(bufobj); if (!stobj || !stobj->buffer) { - return FALSE; /* out-of-memory error probably */ + st->vertex_array_out_of_memory = true; + return; /* out-of-memory error probably */ } vbuffer.buffer.resource = stobj->buffer; @@ -554,7 +555,6 @@ setup_interleaved_attribs(struct st_context *st, set_vertex_attribs(st, &vbuffer, vpv->num_inputs ? 1 : 0, velements, vpv->num_inputs); - return TRUE; } /** @@ -563,7 +563,7 @@ setup_interleaved_attribs(struct st_context *st, * \param vbuffer returns vertex buffer info * \param velements returns vertex element info */ -static boolean +static void setup_non_interleaved_attribs(struct st_context *st, const struct st_vertex_program *vp, const struct st_vp_variant *vpv, @@ -601,7 +601,8 @@ setup_non_interleaved_attribs(struct st_context *st, struct st_buffer_object *stobj = st_buffer_object(bufobj); if (!stobj || !stobj->buffer) { - return FALSE; /* out-of-memory error probably */ + st->vertex_array_out_of_memory = true; + return; /* out-of-memory error probably */ } vbuffer[bufidx].buffer.resource = stobj->buffer; @@ -643,7 +644,6 @@ setup_non_interleaved_attribs(struct st_context *st, } set_vertex_attribs(st, vbuffer, num_vbuffers, velements, vpv->num_inputs); - return TRUE; } void st_update_array(struct st_context *st) @@ -663,16 +663,8 @@ void st_update_array(struct st_context *st) vp = st->vp; vpv = st->vp_variant; - if (is_interleaved_arrays(vp, vpv, arrays)) { - if (!setup_interleaved_attribs(st, vp, vpv, arrays)) { - st->vertex_array_out_of_memory = TRUE; - return; - } - } - else { - if (!setup_non_interleaved_attribs(st, vp, vpv, arrays)) { - st->vertex_array_out_of_memory = TRUE; - return; - } - } + if (is_interleaved_arrays(vp, vpv, arrays)) + setup_interleaved_attribs(st, vp, vpv, arrays); + else + setup_non_interleaved_attribs(st, vp, vpv, arrays); }