mesa: Implement CreateVertexArrays
v2: Update the documentation for gen_vertex_arrays(). Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
This commit is contained in:
@@ -448,6 +448,13 @@
|
|||||||
<param name="params" type="GLint *" />
|
<param name="params" type="GLint *" />
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
|
<!-- Vertex Array object functions -->
|
||||||
|
|
||||||
|
<function name="CreateVertexArrays" offset="assign">
|
||||||
|
<param name="n" type="GLsizei" />
|
||||||
|
<param name="arrays" type="GLuint *" />
|
||||||
|
</function>
|
||||||
|
|
||||||
<!-- Sampler object functions -->
|
<!-- Sampler object functions -->
|
||||||
|
|
||||||
<function name="CreateSamplers" offset="assign">
|
<function name="CreateSamplers" offset="assign">
|
||||||
|
@@ -481,19 +481,23 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a set of unique array object IDs and store them in \c arrays.
|
* Generate a set of unique array object IDs and store them in \c arrays.
|
||||||
* Helper for _mesa_GenVertexArrays[APPLE]() functions below.
|
* Helper for _mesa_GenVertexArrays[APPLE]() and _mesa_CreateVertexArrays()
|
||||||
|
* below.
|
||||||
|
*
|
||||||
* \param n Number of IDs to generate.
|
* \param n Number of IDs to generate.
|
||||||
* \param arrays Array of \c n locations to store the IDs.
|
* \param arrays Array of \c n locations to store the IDs.
|
||||||
* \param vboOnly Will arrays have to reside in VBOs?
|
* \param create Indicates that the objects should also be created.
|
||||||
|
* \param func The name of the GL entry point.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
|
gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
|
||||||
|
bool create, const char *func)
|
||||||
{
|
{
|
||||||
GLuint first;
|
GLuint first;
|
||||||
GLint i;
|
GLint i;
|
||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArrays");
|
_mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,16 +507,20 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
|
|||||||
|
|
||||||
first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n);
|
first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n);
|
||||||
|
|
||||||
/* Allocate new, empty array objects and return identifiers */
|
/* For the sake of simplicity we create the array objects in both
|
||||||
|
* the Gen* and Create* cases. The only difference is the value of
|
||||||
|
* EverBound, which is set to true in the Create* case.
|
||||||
|
*/
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
struct gl_vertex_array_object *obj;
|
struct gl_vertex_array_object *obj;
|
||||||
GLuint name = first + i;
|
GLuint name = first + i;
|
||||||
|
|
||||||
obj = (*ctx->Driver.NewArrayObject)( ctx, name );
|
obj = (*ctx->Driver.NewArrayObject)( ctx, name );
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArrays");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
obj->EverBound = create;
|
||||||
save_array_object(ctx, obj);
|
save_array_object(ctx, obj);
|
||||||
arrays[i] = first + i;
|
arrays[i] = first + i;
|
||||||
}
|
}
|
||||||
@@ -527,7 +535,7 @@ void GLAPIENTRY
|
|||||||
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
|
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
gen_vertex_arrays(ctx, n, arrays);
|
gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArrays");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -539,7 +547,19 @@ void GLAPIENTRY
|
|||||||
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
|
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
gen_vertex_arrays(ctx, n, arrays);
|
gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArraysAPPLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ARB_direct_state_access
|
||||||
|
* Generates ID's and creates the array objects.
|
||||||
|
*/
|
||||||
|
void GLAPIENTRY
|
||||||
|
_mesa_CreateVertexArrays(GLsizei n, GLuint *arrays)
|
||||||
|
{
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
gen_vertex_arrays(ctx, n, arrays, true, "glCreateVertexArrays");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -93,6 +93,8 @@ void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
|
|||||||
|
|
||||||
void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
|
void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
|
||||||
|
|
||||||
|
void GLAPIENTRY _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays);
|
||||||
|
|
||||||
GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id );
|
GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id );
|
||||||
|
|
||||||
#endif /* ARRAYOBJ_H */
|
#endif /* ARRAYOBJ_H */
|
||||||
|
@@ -1017,6 +1017,7 @@ const struct function gl_core_functions_possible[] = {
|
|||||||
{ "glTextureStorage3DMultisample", 45, -1 },
|
{ "glTextureStorage3DMultisample", 45, -1 },
|
||||||
{ "glTextureBuffer", 45, -1 },
|
{ "glTextureBuffer", 45, -1 },
|
||||||
{ "glTextureBufferRange", 45, -1 },
|
{ "glTextureBufferRange", 45, -1 },
|
||||||
|
{ "glCreateVertexArrays", 45, -1 },
|
||||||
{ "glCreateSamplers", 45, -1 },
|
{ "glCreateSamplers", 45, -1 },
|
||||||
{ "glCreateProgramPipelines", 45, -1 },
|
{ "glCreateProgramPipelines", 45, -1 },
|
||||||
{ "glCreateQueries", 45, -1 },
|
{ "glCreateQueries", 45, -1 },
|
||||||
|
Reference in New Issue
Block a user