diff options
author | Timothy Arceri <[email protected]> | 2014-08-15 00:16:09 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2014-08-27 20:35:56 -1000 |
commit | 3246e11d33b346f904f441fb1772e9e88f29d214 (patch) | |
tree | 4f8830497001bc80afcefaa76e28e9ea733b9ba1 /src/mesa/main/varray.c | |
parent | eae9da879f3143507ef0e238a7e4faa87114d54e (diff) |
mesa: implement GL_MAX_VERTEX_ATTRIB_STRIDE
V2: moved test for the VertexAttrib*Pointer() functions
to update_array(), and made constant available for drivers to set
Signed-off-by: Timothy Arceri <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r-- | src/mesa/main/varray.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 5d3cc2a70c6..7d169f9d49b 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -424,6 +424,13 @@ update_array(struct gl_context *ctx, return; } + if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 && + stride > ctx->Const.MaxVertexAttribStride) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(stride=%d > " + "GL_MAX_VERTEX_ATTRIB_STRIDE)", func, stride); + return; + } + /* Page 29 (page 44 of the PDF) of the OpenGL 3.3 spec says: * * "An INVALID_OPERATION error is generated under any of the following @@ -1437,6 +1444,13 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, return; } + if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 && + stride > ctx->Const.MaxVertexAttribStride) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindVertexBuffer(stride=%d > " + "GL_MAX_VERTEX_ATTRIB_STRIDE)", stride); + return; + } + if (buffer == vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) { vbo = vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj; } else if (buffer != 0) { @@ -1565,6 +1579,14 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, continue; } + if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 && + strides[i] > ctx->Const.MaxVertexAttribStride) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindVertexBuffers(strides[%u]=%d > " + "GL_MAX_VERTEX_ATTRIB_STRIDE)", i, strides[i]); + continue; + } + if (buffers[i]) { struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[VERT_ATTRIB_GENERIC(first + i)]; |