mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 18:20:10 +01:00
mesa: Implement VertexArrayVertexBuffers
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
This commit is contained in:
parent
cc9b68e9c9
commit
308926853d
4 changed files with 78 additions and 27 deletions
|
|
@ -478,6 +478,15 @@
|
|||
<param name="stride" type="GLsizei" />
|
||||
</function>
|
||||
|
||||
<function name="VertexArrayVertexBuffers" offset="assign">
|
||||
<param name="vaobj" type="GLuint" />
|
||||
<param name="first" type="GLuint" />
|
||||
<param name="count" type="GLsizei" />
|
||||
<param name="buffers" type="const GLuint *" />
|
||||
<param name="offsets" type="const GLintptr *" />
|
||||
<param name="strides" type="const GLsizei *" />
|
||||
</function>
|
||||
|
||||
<!-- Sampler object functions -->
|
||||
|
||||
<function name="CreateSamplers" offset="assign">
|
||||
|
|
|
|||
|
|
@ -1022,6 +1022,7 @@ const struct function gl_core_functions_possible[] = {
|
|||
{ "glEnableVertexArrayAttrib", 45, -1 },
|
||||
{ "glVertexArrayElementBuffer", 45, -1 },
|
||||
{ "glVertexArrayVertexBuffer", 45, -1 },
|
||||
{ "glVertexArrayVertexBuffers", 45, -1 },
|
||||
{ "glCreateSamplers", 45, -1 },
|
||||
{ "glCreateProgramPipelines", 45, -1 },
|
||||
{ "glCreateQueries", 45, -1 },
|
||||
|
|
|
|||
|
|
@ -1612,28 +1612,17 @@ _mesa_VertexArrayVertexBuffer(GLuint vaobj, GLuint bindingIndex, GLuint buffer,
|
|||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
||||
const GLintptr *offsets, const GLsizei *strides)
|
||||
static void
|
||||
vertex_array_vertex_buffers(struct gl_context *ctx,
|
||||
struct gl_vertex_array_object *vao,
|
||||
GLuint first, GLsizei count, const GLuint *buffers,
|
||||
const GLintptr *offsets, const GLsizei *strides,
|
||||
const char *func)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_vertex_array_object * const vao = ctx->Array.VAO;
|
||||
GLuint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
* "An INVALID_OPERATION error is generated if no
|
||||
* vertex array object is bound."
|
||||
*/
|
||||
if (ctx->API == API_OPENGL_CORE &&
|
||||
ctx->Array.VAO == ctx->Array.DefaultVAO) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBindVertexBuffers(No array object bound)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* The ARB_multi_bind spec says:
|
||||
*
|
||||
* "An INVALID_OPERATION error is generated if <first> + <count>
|
||||
|
|
@ -1641,9 +1630,9 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
|||
*/
|
||||
if (first + count > ctx->Const.MaxVertexAttribBindings) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBindVertexBuffers(first=%u + count=%d > the value of "
|
||||
"%s(first=%u + count=%d > the value of "
|
||||
"GL_MAX_VERTEX_ATTRIB_BINDINGS=%u)",
|
||||
first, count, ctx->Const.MaxVertexAttribBindings);
|
||||
func, first, count, ctx->Const.MaxVertexAttribBindings);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1697,23 +1686,23 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
|||
*/
|
||||
if (offsets[i] < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glBindVertexBuffers(offsets[%u]=%" PRId64 " < 0)",
|
||||
i, (int64_t) offsets[i]);
|
||||
"%s(offsets[%u]=%" PRId64 " < 0)",
|
||||
func, i, (int64_t) offsets[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strides[i] < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glBindVertexBuffers(strides[%u]=%d < 0)",
|
||||
i, strides[i]);
|
||||
"%s(strides[%u]=%d < 0)",
|
||||
func, i, strides[i]);
|
||||
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]);
|
||||
"%s(strides[%u]=%d > "
|
||||
"GL_MAX_VERTEX_ATTRIB_STRIDE)", func, i, strides[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1724,8 +1713,7 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
|||
if (buffers[i] == binding->BufferObj->Name)
|
||||
vbo = binding->BufferObj;
|
||||
else
|
||||
vbo = _mesa_multi_bind_lookup_bufferobj(ctx, buffers, i,
|
||||
"glBindVertexBuffers");
|
||||
vbo = _mesa_multi_bind_lookup_bufferobj(ctx, buffers, i, func);
|
||||
|
||||
if (!vbo)
|
||||
continue;
|
||||
|
|
@ -1741,6 +1729,54 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
|||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
||||
const GLintptr *offsets, const GLsizei *strides)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
* "An INVALID_OPERATION error is generated if no
|
||||
* vertex array object is bound."
|
||||
*/
|
||||
if (ctx->API == API_OPENGL_CORE &&
|
||||
ctx->Array.VAO == ctx->Array.DefaultVAO) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBindVertexBuffers(No array object bound)");
|
||||
return;
|
||||
}
|
||||
|
||||
vertex_array_vertex_buffers(ctx, ctx->Array.VAO, first, count,
|
||||
buffers, offsets, strides,
|
||||
"glBindVertexBuffers");
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count,
|
||||
const GLuint *buffers,
|
||||
const GLintptr *offsets, const GLsizei *strides)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_vertex_array_object *vao;
|
||||
|
||||
/* The ARB_direct_state_access specification says:
|
||||
*
|
||||
* "An INVALID_OPERATION error is generated by VertexArrayVertexBuffer
|
||||
* if <vaobj> is not [compatibility profile: zero or] the name of an
|
||||
* existing vertex array object."
|
||||
*/
|
||||
vao = _mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayVertexBuffers");
|
||||
if (!vao)
|
||||
return;
|
||||
|
||||
vertex_array_vertex_buffers(ctx, vao, first, count,
|
||||
buffers, offsets, strides,
|
||||
"glVertexArrayVertexBuffers");
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type,
|
||||
GLboolean normalized, GLuint relativeOffset)
|
||||
|
|
|
|||
|
|
@ -298,6 +298,11 @@ extern void GLAPIENTRY
|
|||
_mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
|
||||
const GLintptr *offsets, const GLsizei *strides);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count,
|
||||
const GLuint *buffers,
|
||||
const GLintptr *offsets, const GLsizei *strides);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type,
|
||||
GLboolean normalized, GLuint relativeOffset);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue