mesa: add vertex_array_element_buffer() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
@@ -642,41 +642,58 @@ _mesa_IsVertexArray( GLuint id )
|
|||||||
* This is the ARB_direct_state_access equivalent of
|
* This is the ARB_direct_state_access equivalent of
|
||||||
* glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer).
|
* glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer).
|
||||||
*/
|
*/
|
||||||
void GLAPIENTRY
|
static ALWAYS_INLINE void
|
||||||
_mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
|
vertex_array_element_buffer(struct gl_context *ctx, GLuint vaobj, GLuint buffer,
|
||||||
|
bool no_error)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
|
||||||
struct gl_vertex_array_object *vao;
|
struct gl_vertex_array_object *vao;
|
||||||
struct gl_buffer_object *bufObj;
|
struct gl_buffer_object *bufObj;
|
||||||
|
|
||||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||||
|
|
||||||
/* The GL_ARB_direct_state_access specification says:
|
if (!no_error) {
|
||||||
*
|
/* The GL_ARB_direct_state_access specification says:
|
||||||
* "An INVALID_OPERATION error is generated by VertexArrayElementBuffer
|
*
|
||||||
* if <vaobj> is not [compatibility profile: zero or] the name of an
|
* "An INVALID_OPERATION error is generated by
|
||||||
* existing vertex array object."
|
* VertexArrayElementBuffer if <vaobj> is not [compatibility profile:
|
||||||
*/
|
* zero or] the name of an existing vertex array object."
|
||||||
vao =_mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayElementBuffer");
|
*/
|
||||||
if (!vao)
|
vao =_mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayElementBuffer");
|
||||||
return;
|
if (!vao)
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
vao = _mesa_lookup_vao(ctx, vaobj);
|
||||||
|
}
|
||||||
|
|
||||||
/* The GL_ARB_direct_state_access specification says:
|
if (buffer != 0) {
|
||||||
*
|
if (!no_error) {
|
||||||
* "An INVALID_OPERATION error is generated if <buffer> is not zero or
|
/* The GL_ARB_direct_state_access specification says:
|
||||||
* the name of an existing buffer object."
|
*
|
||||||
*/
|
* "An INVALID_OPERATION error is generated if <buffer> is not zero
|
||||||
if (buffer != 0)
|
* or the name of an existing buffer object."
|
||||||
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
|
*/
|
||||||
"glVertexArrayElementBuffer");
|
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
|
||||||
else
|
"glVertexArrayElementBuffer");
|
||||||
|
} else {
|
||||||
|
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
bufObj = ctx->Shared->NullBufferObj;
|
bufObj = ctx->Shared->NullBufferObj;
|
||||||
|
}
|
||||||
|
|
||||||
if (bufObj)
|
if (bufObj)
|
||||||
_mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, bufObj);
|
_mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, bufObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GLAPIENTRY
|
||||||
|
_mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
|
||||||
|
{
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
vertex_array_element_buffer(ctx, vaobj, buffer, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
|
_mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user