st/mesa: fold error handling into setup_(non_)interleaved_attribs
authorMarek Olšák <marek.olsak@amd.com>
Sun, 30 Apr 2017 12:42:45 +0000 (14:42 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 10 May 2017 17:29:08 +0000 (19:29 +0200)
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/state_tracker/st_atom_array.c

index 522073f205d943764142154a93e3dd7a787c6903..db03b20a4126844b01556fcbfcef83c8ba8b8adb 100644 (file)
@@ -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);
 }