<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jun 1, 2017 15:06, "Samuel Pitoiset" <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
 src/mesa/main/varray.c | 108 ++++++++++++++++++++++++++++--<wbr>-------------------<br>
 1 file changed, 61 insertions(+), 47 deletions(-)<br>
<br>
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c<br>
index 47528ba2a7..c2c771c173 100644<br>
--- a/src/mesa/main/varray.c<br>
+++ b/src/mesa/main/varray.c<br>
@@ -2117,29 +2117,14 @@ _mesa_VertexArrayVertexBuffer(<wbr>GLuint vaobj, GLuint bindingIndex, GLuint buffer,<br>
 }<br>
<br>
<br>
-static void<br>
+static ALWAYS_INLINE void<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">This seems unrelated to the rest of the patch... It probably needs a motivation also. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 vertex_array_vertex_buffers(<wbr>struct gl_context *ctx,<br>
                             struct gl_vertex_array_object *vao,<br>
                             GLuint first, GLsizei count, const GLuint *buffers,<br>
                             const GLintptr *offsets, const GLsizei *strides,<br>
-                            const char *func)<br>
+                            bool no_error, const char *func)<br>
 {<br>
-   GLuint i;<br>
-<br>
-   ASSERT_OUTSIDE_BEGIN_END(ctx);<br>
-<br>
-   /* The ARB_multi_bind spec says:<br>
-    *<br>
-    *    "An INVALID_OPERATION error is generated if <first> + <count><br>
-    *     is greater than the value of MAX_VERTEX_ATTRIB_BINDINGS."<br>
-    */<br>
-   if (first + count > ctx->Const.<wbr>MaxVertexAttribBindings) {<br>
-      _mesa_error(ctx, GL_INVALID_OPERATION,<br>
-                  "%s(first=%u + count=%d > the value of "<br>
-                  "GL_MAX_VERTEX_ATTRIB_<wbr>BINDINGS=%u)",<br>
-                  func, first, count, ctx->Const.<wbr>MaxVertexAttribBindings);<br>
-      return;<br>
-   }<br>
+   GLint i;<br>
<br>
    if (!buffers) {<br>
       /**<br>
@@ -2184,31 +2169,33 @@ vertex_array_vertex_buffers(<wbr>struct gl_context *ctx,<br>
    for (i = 0; i < count; i++) {<br>
       struct gl_buffer_object *vbo;<br>
<br>
-      /* The ARB_multi_bind spec says:<br>
-       *<br>
-       *    "An INVALID_VALUE error is generated if any value in<br>
-       *     <offsets> or <strides> is negative (per binding)."<br>
-       */<br>
-      if (offsets[i] < 0) {<br>
-         _mesa_error(ctx, GL_INVALID_VALUE,<br>
-                     "%s(offsets[%u]=%" PRId64 " < 0)",<br>
-                     func, i, (int64_t) offsets[i]);<br>
-         continue;<br>
-      }<br>
+      if (!no_error) {<br>
+         /* The ARB_multi_bind spec says:<br>
+          *<br>
+          *    "An INVALID_VALUE error is generated if any value in<br>
+          *     <offsets> or <strides> is negative (per binding)."<br>
+          */<br>
+         if (offsets[i] < 0) {<br>
+            _mesa_error(ctx, GL_INVALID_VALUE,<br>
+                        "%s(offsets[%u]=%" PRId64 " < 0)",<br>
+                        func, i, (int64_t) offsets[i]);<br>
+            continue;<br>
+         }<br>
<br>
-      if (strides[i] < 0) {<br>
-         _mesa_error(ctx, GL_INVALID_VALUE,<br>
-                     "%s(strides[%u]=%d < 0)",<br>
-                     func, i, strides[i]);<br>
-         continue;<br>
-      }<br>
+         if (strides[i] < 0) {<br>
+            _mesa_error(ctx, GL_INVALID_VALUE,<br>
+                        "%s(strides[%u]=%d < 0)",<br>
+                        func, i, strides[i]);<br>
+            continue;<br>
+         }<br>
<br>
-      if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 &&<br>
-          strides[i] > ctx->Const.<wbr>MaxVertexAttribStride) {<br>
-         _mesa_error(ctx, GL_INVALID_VALUE,<br>
-                     "%s(strides[%u]=%d > "<br>
-                     "GL_MAX_VERTEX_ATTRIB_STRIDE)"<wbr>, func, i, strides[i]);<br>
-         continue;<br>
+         if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 &&<br>
+             strides[i] > ctx->Const.<wbr>MaxVertexAttribStride) {<br>
+            _mesa_error(ctx, GL_INVALID_VALUE,<br>
+                        "%s(strides[%u]=%d > "<br>
+                        "GL_MAX_VERTEX_ATTRIB_STRIDE)"<wbr>, func, i, strides[i]);<br>
+            continue;<br>
+         }<br>
       }<br>
<br>
       if (buffers[i]) {<br>
@@ -2234,6 +2221,33 @@ vertex_array_vertex_buffers(<wbr>struct gl_context *ctx,<br>
 }<br>
<br>
<br>
+static void<br>
+vertex_array_vertex_buffers_<wbr>err(struct gl_context *ctx,<br>
+                                struct gl_vertex_array_object *vao,<br>
+                                GLuint first, GLsizei count,<br>
+                                const GLuint *buffers, const GLintptr *offsets,<br>
+                                const GLsizei *strides, const char *func)<br>
+{<br>
+   ASSERT_OUTSIDE_BEGIN_END(ctx);<br>
+<br>
+   /* The ARB_multi_bind spec says:<br>
+    *<br>
+    *    "An INVALID_OPERATION error is generated if <first> + <count><br>
+    *     is greater than the value of MAX_VERTEX_ATTRIB_BINDINGS."<br>
+    */<br>
+   if (first + count > ctx->Const.<wbr>MaxVertexAttribBindings) {<br>
+      _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+                  "%s(first=%u + count=%d > the value of "<br>
+                  "GL_MAX_VERTEX_ATTRIB_<wbr>BINDINGS=%u)",<br>
+                  func, first, count, ctx->Const.<wbr>MaxVertexAttribBindings);<br>
+      return;<br>
+   }<br>
+<br>
+   vertex_array_vertex_buffers(<wbr>ctx, vao, first, count, buffers, offsets,<br>
+                               strides, false, func);<br>
+}<br>
+<br>
+<br>
 void GLAPIENTRY<br>
 _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,<br>
                         const GLintptr *offsets, const GLsizei *strides)<br>
@@ -2252,9 +2266,9 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,<br>
       return;<br>
    }<br>
<br>
-   vertex_array_vertex_buffers(<wbr>ctx, ctx->Array.VAO, first, count,<br>
-                               buffers, offsets, strides,<br>
-                               "glBindVertexBuffers");<br>
+   vertex_array_vertex_buffers_<wbr>err(ctx, ctx->Array.VAO, first, count,<br>
+                                   buffers, offsets, strides,<br>
+                                   "glBindVertexBuffers");<br>
 }<br>
<br>
<br>
@@ -2276,9 +2290,9 @@ _mesa_<wbr>VertexArrayVertexBuffers(<wbr>GLuint vaobj, GLuint first, GLsizei count,<br>
    if (!vao)<br>
       return;<br>
<br>
-   vertex_array_vertex_buffers(<wbr>ctx, vao, first, count,<br>
-                               buffers, offsets, strides,<br>
-                               "glVertexArrayVertexBuffers");<br>
+   vertex_array_vertex_buffers_<wbr>err(ctx, vao, first, count,<br>
+                                   buffers, offsets, strides,<br>
+                                   "glVertexArrayVertexBuffers");<br>
 }<br>
<font color="#888888"><br>
<br>
--<br>
2.13.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></blockquote></div><br></div></div></div>