2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
41 /** Is the given buffer object currently mapped? */
42 static inline GLboolean
43 _mesa_bufferobj_mapped(const struct gl_buffer_object
*obj
)
45 return obj
->Pointer
!= NULL
;
49 * Is the given buffer object a user-created buffer object?
50 * Mesa uses default buffer objects in several places. Default buffers
51 * always have Name==0. User created buffers have Name!=0.
53 static inline GLboolean
54 _mesa_is_bufferobj(const struct gl_buffer_object
*obj
)
56 return obj
!= NULL
&& obj
->Name
!= 0;
61 _mesa_init_buffer_objects( struct gl_context
*ctx
);
64 _mesa_free_buffer_objects( struct gl_context
*ctx
);
67 _mesa_update_default_objects_buffer_objects(struct gl_context
*ctx
);
70 extern struct gl_buffer_object
*
71 _mesa_lookup_bufferobj(struct gl_context
*ctx
, GLuint buffer
);
74 _mesa_initialize_buffer_object( struct gl_context
*ctx
,
75 struct gl_buffer_object
*obj
,
76 GLuint name
, GLenum target
);
79 _mesa_reference_buffer_object_(struct gl_context
*ctx
,
80 struct gl_buffer_object
**ptr
,
81 struct gl_buffer_object
*bufObj
);
84 _mesa_reference_buffer_object(struct gl_context
*ctx
,
85 struct gl_buffer_object
**ptr
,
86 struct gl_buffer_object
*bufObj
)
89 _mesa_reference_buffer_object_(ctx
, ptr
, bufObj
);
93 _mesa_total_buffer_object_memory(struct gl_context
*ctx
);
96 _mesa_init_buffer_object_functions(struct dd_function_table
*driver
);
104 _mesa_BindBuffer(GLenum target
, GLuint buffer
);
106 _mesa_DeleteBuffers(GLsizei n
, const GLuint
* buffer
);
108 _mesa_GenBuffers(GLsizei n
, GLuint
* buffer
);
110 _mesa_IsBuffer(GLuint buffer
);
112 _mesa_BufferData(GLenum target
, GLsizeiptrARB size
, const GLvoid
* data
, GLenum usage
);
114 _mesa_BufferSubData(GLenum target
, GLintptrARB offset
, GLsizeiptrARB size
, const GLvoid
* data
);
116 _mesa_GetBufferSubData(GLenum target
, GLintptrARB offset
, GLsizeiptrARB size
, void * data
);
118 _mesa_MapBuffer(GLenum target
, GLenum access
);
120 _mesa_UnmapBuffer(GLenum target
);
122 _mesa_GetBufferParameteriv(GLenum target
, GLenum pname
, GLint
*params
);
124 _mesa_GetBufferParameteri64v(GLenum target
, GLenum pname
, GLint64
*params
);
126 _mesa_GetBufferPointerv(GLenum target
, GLenum pname
, GLvoid
**params
);
128 _mesa_CopyBufferSubData(GLenum readTarget
, GLenum writeTarget
,
129 GLintptr readOffset
, GLintptr writeOffset
,
132 _mesa_MapBufferRange(GLenum target
, GLintptr offset
, GLsizeiptr length
,
135 _mesa_FlushMappedBufferRange(GLenum target
, GLintptr offset
, GLsizeiptr length
);
137 _mesa_ObjectPurgeableAPPLE(GLenum objectType
, GLuint name
, GLenum option
);
139 _mesa_ObjectUnpurgeableAPPLE(GLenum objectType
, GLuint name
, GLenum option
);
141 _mesa_GetObjectParameterivAPPLE(GLenum objectType
, GLuint name
, GLenum pname
,
144 _mesa_BindBufferRange(GLenum target
, GLuint index
,
145 GLuint buffer
, GLintptr offset
, GLsizeiptr size
);
147 _mesa_BindBufferBase(GLenum target
, GLuint index
, GLuint buffer
);
149 _mesa_InvalidateBufferSubData(GLuint buffer
, GLintptr offset
,
152 _mesa_InvalidateBufferData(GLuint buffer
);