-/* $Id: bufferobj.c,v 1.1 2003/03/29 17:01:00 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
#include "glheader.h"
#include "imports.h"
+#include "context.h"
#include "bufferobj.h"
void
_mesa_BindBufferARB(GLenum target, GLuint buffer)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target)");
+ return;
+ }
}
void
-_mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer)
+_mesa_DeleteBuffersARB(GLsizei n, const GLuint *buffer)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)");
+ return;
+ }
+
}
void
-_mesa_GenBuffersARB(GLsizei n, GLuint * buffer)
+_mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB(n)");
+ return;
+ }
}
GLboolean
_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
const GLvoid * data, GLenum usage)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)");
+ return;
+ }
+
+ switch (usage) {
+ case GL_STREAM_DRAW_ARB:
+ case GL_STREAM_READ_ARB:
+ case GL_STREAM_COPY_ARB:
+ case GL_STATIC_DRAW_ARB:
+ case GL_STATIC_READ_ARB:
+ case GL_STATIC_COPY_ARB:
+ case GL_DYNAMIC_DRAW_ARB:
+ case GL_DYNAMIC_READ_ARB:
+ case GL_DYNAMIC_COPY_ARB:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
+ return;
+ }
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(target)");
+ return;
+ }
}
void
_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBufferSubDataARB(size < 0)");
+ return;
+ }
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferSubDataARB(target)");
+ return;
+ }
}
void
_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
GLsizeiptrARB size, void * data)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetBufferSubDataARB(size < 0)");
+ return;
+ }
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferSubDataARB(target)");
+ return;
+ }
}
void
_mesa_MapBufferARB(GLenum target, GLenum access)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (access) {
+ case GL_READ_ONLY_ARB:
+ case GL_WRITE_ONLY_ARB:
+ case GL_READ_WRITE_ARB:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
+ return;
+ }
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(target)");
+ return;
+ }
}
GLboolean
_mesa_UnmapBufferARB(GLenum target)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glUnmapBufferARB(target)");
+ return GL_FALSE;
+ }
return GL_FALSE;
}
void
_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_BUFFER_SIZE_ARB:
+ case GL_BUFFER_USAGE_ARB:
+ case GL_BUFFER_ACCESS_ARB:
+ case GL_BUFFER_MAPPED_ARB:
+ /* ok */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)");
+ return;
+ }
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterARB(target)");
+ return;
+ }
}
void
_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname != GL_BUFFER_MAP_POINTER_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
+ return;
+ }
+
+ if (target == GL_ARRAY_BUFFER_ARB) {
+
+ }
+ else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
+
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(target)");
+ return;
+ }
}
-/* $Id: get.c,v 1.110 2003/04/01 19:07:35 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
*params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_ARB_vertex_buffer_object */
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ArrayBufferBinding);
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.VertexArrayBufferBinding);
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.NormalArrayBufferBinding);
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ColorArrayBufferBinding);
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.IndexArrayBufferBinding);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.TextureArrayBufferBinding);
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.EdgeFlagArrayBufferBinding);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColorArrayBufferBinding);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.FogCoordArrayBufferBinding);
+ break;
+ case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.WeightArrayBufferBinding);
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ElementArrayBufferBinding);
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
}
*params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_ARB_vertex_buffer_object */
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ArrayBufferBinding;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.VertexArrayBufferBinding;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.NormalArrayBufferBinding;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ColorArrayBufferBinding;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.IndexArrayBufferBinding;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.TextureArrayBufferBinding;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.EdgeFlagArrayBufferBinding;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColorArrayBufferBinding;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.FogCoordArrayBufferBinding;
+ break;
+ case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.WeightArrayBufferBinding;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ElementArrayBufferBinding;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname);
}
*params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_ARB_vertex_buffer_object */
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ArrayBufferBinding;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.VertexArrayBufferBinding;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.NormalArrayBufferBinding;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ColorArrayBufferBinding;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.IndexArrayBufferBinding;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.TextureArrayBufferBinding;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.EdgeFlagArrayBufferBinding;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColorArrayBufferBinding;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.FogCoordArrayBufferBinding;
+ break;
+ case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.WeightArrayBufferBinding;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ElementArrayBufferBinding;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname);
}
*params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_ARB_vertex_buffer_object */
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ArrayBufferBinding;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.VertexArrayBufferBinding;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.NormalArrayBufferBinding;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ColorArrayBufferBinding;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.IndexArrayBufferBinding;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.TextureArrayBufferBinding;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.EdgeFlagArrayBufferBinding;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.SecondaryColorArrayBufferBinding;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.FogCoordArrayBufferBinding;
+ break;
+ case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.WeightArrayBufferBinding;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ElementArrayBufferBinding;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
}