From 6061df09a45c42745253965df012ddf76910ea33 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 29 Mar 2003 17:01:00 +0000 Subject: Basic infrastructure for GL_ARB_vertex_buffer_object. --- src/mesa/main/Makefile.BeOS-R5 | 1 + src/mesa/main/Makefile.DJ | 5 ++- src/mesa/main/Makefile.OSMesa16 | 7 +-- src/mesa/main/Makefile.X11 | 4 +- src/mesa/main/Makefile.ugl | 1 + src/mesa/main/Makefile.win | 1 + src/mesa/main/bufferobj.c | 98 +++++++++++++++++++++++++++++++++++++++++ src/mesa/main/bufferobj.h | 66 +++++++++++++++++++++++++++ src/mesa/main/config.h | 3 +- src/mesa/main/descrip.mms | 2 + src/mesa/main/extensions.c | 3 +- src/mesa/main/mtypes.h | 3 +- src/mesa/main/state.c | 24 ++++++++-- 13 files changed, 206 insertions(+), 12 deletions(-) create mode 100644 src/mesa/main/bufferobj.c create mode 100644 src/mesa/main/bufferobj.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/Makefile.BeOS-R5 b/src/mesa/main/Makefile.BeOS-R5 index c1da7f3f07..43f6ac1f83 100644 --- a/src/mesa/main/Makefile.BeOS-R5 +++ b/src/mesa/main/Makefile.BeOS-R5 @@ -63,6 +63,7 @@ MESA_CORE_SRCS = \ accum.c \ attrib.c \ blend.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ diff --git a/src/mesa/main/Makefile.DJ b/src/mesa/main/Makefile.DJ index 16012c8d42..89f58a5dd4 100644 --- a/src/mesa/main/Makefile.DJ +++ b/src/mesa/main/Makefile.DJ @@ -1,7 +1,7 @@ # Mesa 3-D graphics library -# Version: 4.1 +# Version: 5.1 # -# Copyright (C) 1999-2002 Brian Paul All Rights Reserved. +# Copyright (C) 1999-2003 Brian Paul All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -105,6 +105,7 @@ CORE_SOURCES = \ accum.c \ attrib.c \ blend.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ diff --git a/src/mesa/main/Makefile.OSMesa16 b/src/mesa/main/Makefile.OSMesa16 index 3ed54c4969..62e934405c 100644 --- a/src/mesa/main/Makefile.OSMesa16 +++ b/src/mesa/main/Makefile.OSMesa16 @@ -1,8 +1,8 @@ -# $Id: Makefile.OSMesa16,v 1.13 2003/03/25 02:26:29 brianp Exp $ +# $Id: Makefile.OSMesa16,v 1.14 2003/03/29 17:01:02 brianp Exp $ # Mesa 3-D graphics library -# Version: 5.0 -# Copyright (C) 1995-2002 Brian Paul +# Version: 5.1 +# Copyright (C) 1995-2003 Brian Paul # Makefile for building Mesa for 16/32-bit/channel rendering with the OSMesa # driver. @@ -29,6 +29,7 @@ CORE_SOURCES = \ accum.c \ attrib.c \ blend.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index d95a565a16..adb13c06ed 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.75 2003/03/25 02:26:29 brianp Exp $ +# $Id: Makefile.X11,v 1.76 2003/03/29 17:01:02 brianp Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -28,6 +28,8 @@ CORE_SOURCES = \ accum.c \ attrib.c \ blend.c \ + bufferobj.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ diff --git a/src/mesa/main/Makefile.ugl b/src/mesa/main/Makefile.ugl index 20452e44a4..b01b564f79 100644 --- a/src/mesa/main/Makefile.ugl +++ b/src/mesa/main/Makefile.ugl @@ -58,6 +58,7 @@ GL_SOURCES = \ accum.c \ attrib.c \ blend.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ diff --git a/src/mesa/main/Makefile.win b/src/mesa/main/Makefile.win index d4a45547c6..e1923dffeb 100644 --- a/src/mesa/main/Makefile.win +++ b/src/mesa/main/Makefile.win @@ -18,6 +18,7 @@ CORE_SRCS = \ accum.c \ attrib.c \ blend.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c new file mode 100644 index 0000000000..7742e29a8b --- /dev/null +++ b/src/mesa/main/bufferobj.c @@ -0,0 +1,98 @@ +/* $Id: bufferobj.c,v 1.1 2003/03/29 17:01:00 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file bufferobj.c + * \brief Functions for the GL_ARB_vertex_buffer_object extension. + * \author Brian Paul + */ + + +#include "glheader.h" +#include "imports.h" +#include "bufferobj.h" + + +void +_mesa_BindBufferARB(GLenum target, GLuint buffer) +{ +} + +void +_mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer) +{ +} + +void +_mesa_GenBuffersARB(GLsizei n, GLuint * buffer) +{ +} + +GLboolean +_mesa_IsBufferARB(GLuint buffer) +{ + return GL_FALSE; +} + +void +_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, + const GLvoid * data, GLenum usage) +{ +} + +void +_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, + GLsizeiptrARB size, const GLvoid * data) +{ +} + +void +_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, + GLsizeiptrARB size, void * data) +{ +} + +void +_mesa_MapBufferARB(GLenum target, GLenum access) +{ +} + +GLboolean +_mesa_UnmapBufferARB(GLenum target) +{ + return GL_FALSE; +} + +void +_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) +{ +} + +void +_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) +{ +} diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h new file mode 100644 index 0000000000..2617eb0c3e --- /dev/null +++ b/src/mesa/main/bufferobj.h @@ -0,0 +1,66 @@ +/* $Id: bufferobj.h,v 1.1 2003/03/29 17:01:00 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + +#ifndef BUFFEROBJ_H +#define BUFFEROBJ_H + + +extern void +_mesa_BindBufferARB(GLenum target, GLuint buffer); + +extern void +_mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer); + +extern void +_mesa_GenBuffersARB(GLsizei n, GLuint * buffer); + +GLboolean +_mesa_IsBufferARB(GLuint buffer); + +extern void +_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); + +extern void +_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); + +extern void +_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data); + +extern void +_mesa_MapBufferARB(GLenum target, GLenum access); + +GLboolean +_mesa_UnmapBufferARB(GLenum target); + +extern void +_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params); + +extern void +_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params); + +#endif diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index cfcba306f4..264b57c279 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h,v 1.44 2003/02/25 19:30:59 brianp Exp $ */ +/* $Id: config.h,v 1.45 2003/03/29 17:01:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -228,5 +228,6 @@ #define FEATURE_NV_fragment_program 1 +#define FEATURE_ARB_vertex_buffer_object 1 #endif /* CONFIG_H */ diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms index 345c3e6130..5bb3fc6b95 100644 --- a/src/mesa/main/descrip.mms +++ b/src/mesa/main/descrip.mms @@ -21,6 +21,7 @@ CORE_SOURCES =accum.c \ api_validate.c \ attrib.c \ blend.c \ + bufferobj.c \ buffers.c \ clip.c \ colortab.c \ @@ -90,6 +91,7 @@ RASTER_SOURCES = [.swrast]s_aatriangle.c \ [.swrast]s_alphabuf.c \ [.swrast]s_bitmap.c \ [.swrast]s_blend.c \ +[.swrast]s_bufferobj.c \ [.swrast]s_buffers.c \ [.swrast]s_copypix.c \ [.swrast]s_context.c \ diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 7e1f203872..88616b6309 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.88 2003/01/21 21:47:49 brianp Exp $ */ +/* $Id: extensions.c,v 1.89 2003/03/29 17:01:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -67,6 +67,7 @@ static struct { { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { ON, "GL_ARB_transpose_matrix", 0 }, + { OFF, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) }, { ON, "GL_ARB_window_pos", F(ARB_window_pos) }, { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)}, { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)}, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5a946d81ad..a1c8dac03f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.107 2003/03/19 05:34:24 brianp Exp $ */ +/* $Id: mtypes.h,v 1.108 2003/03/29 17:01:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1402,6 +1402,7 @@ struct gl_extensions { GLboolean ARB_texture_env_crossbar; GLboolean ARB_texture_env_dot3; GLboolean ARB_texture_mirrored_repeat; + GLboolean ARB_vertex_buffer_object; GLboolean ARB_window_pos; GLboolean ATI_texture_mirror_once; GLboolean ATI_texture_env_combine3; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index a2cd89e445..000a1fd578 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.101 2003/03/29 16:37:07 brianp Exp $ */ +/* $Id: state.c,v 1.102 2003/03/29 17:01:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -26,8 +26,8 @@ /* - * This file manages recalculation of derived values in the - * __GLcontext. + * /brief This file manages recalculation of derived values in the + * __GLcontext. Also, this is where we initialize the API dispatch table. */ @@ -36,6 +36,9 @@ #include "api_loopback.h" #include "attrib.h" #include "blend.h" +#if FEATURE_ARB_vertex_buffer_object +#include "bufferobj.h" +#endif #include "buffers.h" #include "clip.h" #include "colortab.h" @@ -550,6 +553,21 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) /* ARB 14. GL_ARB_point_parameters */ /* reuse EXT_point_parameters functions */ + + /* ARB 28. GL_ARB_vertex_buffer_object */ +#if FEATURE_ARB_vertex_buffer_object + exec->BindBufferARB = _mesa_BindBufferARB; + exec->DeleteBuffersARB = _mesa_DeleteBuffersARB; + exec->GenBuffersARB = _mesa_GenBuffersARB; + exec->IsBufferARB = _mesa_IsBufferARB; + exec->BufferDataARB = _mesa_BufferDataARB; + exec->BufferSubDataARB = _mesa_BufferSubDataARB; + exec->GetBufferSubDataARB = _mesa_GetBufferSubDataARB; + exec->MapBufferARB = _mesa_MapBufferARB; + exec->UnmapBufferARB = _mesa_UnmapBufferARB; + exec->GetBufferParameterivARB = _mesa_GetBufferParameterivARB; + exec->GetBufferPointervARB = _mesa_GetBufferPointervARB; +#endif } -- cgit v1.2.3