ReactOS  0.4.12-dev-375-g61fed54
bufferobj.c
Go to the documentation of this file.
1 /*
2  * Mesa 3-D graphics library
3  * Version: 7.6
4  *
5  * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6  * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7  *
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:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
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  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 
33 #include <precomp.h>
34 
35 /* Debug flags */
36 /*#define VBO_DEBUG*/
37 /*#define BOUNDS_CHECK*/
38 
39 
45 
46 
54 static inline struct gl_buffer_object **
56 {
57  switch (target) {
59  return &ctx->Array.ElementArrayBufferObj;
60  default:
61  return NULL;
62  }
63  return NULL;
64 }
65 
66 
74 static inline struct gl_buffer_object *
75 get_buffer(struct gl_context *ctx, const char *func, GLenum target)
76 {
77  struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);
78 
79  if (!bufObj) {
80  _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);
81  return NULL;
82  }
83 
84  if (!_mesa_is_bufferobj(*bufObj)) {
85  _mesa_error(ctx, GL_INVALID_OPERATION, "%s(buffer 0)", func);
86  return NULL;
87  }
88 
89  return *bufObj;
90 }
91 
92 
93 static inline GLenum
94 default_access_mode(const struct gl_context *ctx)
95 {
96  (void)ctx;
98 }
99 
100 
105 static GLenum
107 {
108  const GLbitfield rwFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
109  if ((access & rwFlags) == rwFlags)
110  return GL_READ_WRITE;
112  return GL_READ_ONLY;
114  return GL_WRITE_ONLY;
115  return GL_READ_WRITE; /* this should never happen, but no big deal */
116 }
117 
118 
135 static struct gl_buffer_object *
138  const char *caller )
139 {
140  struct gl_buffer_object *bufObj;
141 
142  if (size < 0) {
143  _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", caller);
144  return NULL;
145  }
146 
147  if (offset < 0) {
148  _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", caller);
149  return NULL;
150  }
151 
152  bufObj = get_buffer(ctx, caller, target);
153  if (!bufObj)
154  return NULL;
155 
156  if (offset + size > bufObj->Size) {
158  "%s(offset %lu + size %lu > buffer size %lu)", caller,
159  (unsigned long) offset,
160  (unsigned long) size,
161  (unsigned long) bufObj->Size);
162  return NULL;
163  }
164  if (_mesa_bufferobj_mapped(bufObj)) {
165  /* Buffer is currently mapped */
166  _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
167  return NULL;
168  }
169 
170  return bufObj;
171 }
172 
173 
179 static struct gl_buffer_object *
181 {
182  struct gl_buffer_object *obj;
183 
184  (void) ctx;
185 
188  return obj;
189 }
190 
191 
197 static void
199  struct gl_buffer_object *bufObj)
200 {
201  (void) ctx;
202 
203  if (bufObj->Data)
204  free(bufObj->Data);
205 
206  /* assign strange values here to help w/ debugging */
207  bufObj->RefCount = -1000;
208  bufObj->Name = ~0;
209 
211  free(bufObj);
212 }
213 
214 
215 
221 void
223  struct gl_buffer_object **ptr,
224  struct gl_buffer_object *bufObj)
225 {
226  if (*ptr) {
227  /* Unreference the old buffer */
228  GLboolean deleteFlag = GL_FALSE;
229  struct gl_buffer_object *oldObj = *ptr;
230 
231  _glthread_LOCK_MUTEX(oldObj->Mutex);
232  ASSERT(oldObj->RefCount > 0);
233  oldObj->RefCount--;
234 #if 0
235  printf("BufferObj %p %d DECR to %d\n",
236  (void *) oldObj, oldObj->Name, oldObj->RefCount);
237 #endif
238  deleteFlag = (oldObj->RefCount == 0);
239  _glthread_UNLOCK_MUTEX(oldObj->Mutex);
240 
241  if (deleteFlag) {
242 
243  /* some sanity checking: don't delete a buffer still in use */
244 #if 0
245  /* unfortunately, these tests are invalid during context tear-down */
246  ASSERT(ctx->Array.ArrayBufferObj != bufObj);
247  ASSERT(ctx->Array.ArrayObj->ElementArrayBufferObj != bufObj);
248  ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj);
249 #endif
250 
251  ASSERT(ctx->Driver.DeleteBuffer);
252  ctx->Driver.DeleteBuffer(ctx, oldObj);
253  }
254 
255  *ptr = NULL;
256  }
257  ASSERT(!*ptr);
258 
259  if (bufObj) {
260  /* reference new buffer */
261  _glthread_LOCK_MUTEX(bufObj->Mutex);
262  if (bufObj->RefCount == 0) {
263  /* this buffer's being deleted (look just above) */
264  /* Not sure this can every really happen. Warn if it does. */
265  _mesa_problem(NULL, "referencing deleted buffer object");
266  *ptr = NULL;
267  }
268  else {
269  bufObj->RefCount++;
270 #if 0
271  printf("BufferObj %p %d INCR to %d\n",
272  (void *) bufObj, bufObj->Name, bufObj->RefCount);
273 #endif
274  *ptr = bufObj;
275  }
276  _glthread_UNLOCK_MUTEX(bufObj->Mutex);
277  }
278 }
279 
280 
284 void
286  struct gl_buffer_object *obj,
288 {
289  (void) target;
290 
291  memset(obj, 0, sizeof(struct gl_buffer_object));
292  _glthread_INIT_MUTEX(obj->Mutex);
293  obj->RefCount = 1;
294  obj->Name = name;
295  obj->Usage = GL_STATIC_DRAW_ARB;
296  obj->AccessFlags = default_access_mode(ctx);
297 }
298 
299 
319 static GLboolean
321  const GLvoid * data, GLenum usage,
322  struct gl_buffer_object * bufObj )
323 {
324  void * new_data;
325 
326  (void) ctx; (void) target;
327 
328  new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
329  if (new_data) {
330  bufObj->Data = (GLubyte *) new_data;
331  bufObj->Size = size;
332  bufObj->Usage = usage;
333 
334  if (data) {
335  memcpy( bufObj->Data, data, size );
336  }
337 
338  return GL_TRUE;
339  }
340  else {
341  return GL_FALSE;
342  }
343 }
344 
345 
363 static void
365  GLsizeiptrARB size, const GLvoid * data,
366  struct gl_buffer_object * bufObj )
367 {
368  (void) ctx;
369 
370  /* this should have been caught in _mesa_BufferSubData() */
372 
373  if (bufObj->Data) {
374  memcpy( (GLubyte *) bufObj->Data + offset, data, size );
375  }
376 }
377 
378 
396 static void
399  struct gl_buffer_object * bufObj )
400 {
401  (void) ctx;
402 
403  if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) {
404  memcpy( data, (GLubyte *) bufObj->Data + offset, size );
405  }
406 }
407 
408 
413 static void *
416  struct gl_buffer_object *bufObj )
417 {
418  (void) ctx;
419  assert(!_mesa_bufferobj_mapped(bufObj));
420  /* Just return a direct pointer to the data */
421  bufObj->Pointer = bufObj->Data + offset;
422  bufObj->Length = length;
423  bufObj->Offset = offset;
424  bufObj->AccessFlags = access;
425  return bufObj->Pointer;
426 }
427 
428 
433 static void
436  struct gl_buffer_object *obj )
437 {
438  (void) ctx;
439  (void) offset;
440  (void) length;
441  (void) obj;
442  /* no-op */
443 }
444 
445 
453 static GLboolean
454 _mesa_buffer_unmap( struct gl_context *ctx, struct gl_buffer_object *bufObj )
455 {
456  (void) ctx;
457  /* XXX we might assert here that bufObj->Pointer is non-null */
458  bufObj->Pointer = NULL;
459  bufObj->Length = 0;
460  bufObj->Offset = 0;
461  bufObj->AccessFlags = 0x0;
462  return GL_TRUE;
463 }
464 
465 
469 void
471 {
474  DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
475 }
476 
477 
482 static void
484 {
485  struct gl_buffer_object *oldBufObj;
486  struct gl_buffer_object *newBufObj = NULL;
487  struct gl_buffer_object **bindTarget = NULL;
488 
489  bindTarget = get_buffer_target(ctx, target);
490  if (!bindTarget) {
491  _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)", target);
492  return;
493  }
494 
495  /* Get pointer to old buffer object (to be unbound) */
496  oldBufObj = *bindTarget;
497  if (oldBufObj && oldBufObj->Name == buffer && !oldBufObj->DeletePending)
498  return; /* rebinding the same buffer object- no change */
499 
500  /*
501  * Get pointer to new buffer object (newBufObj)
502  */
503  if (buffer == 0) {
504  /* The spec says there's not a buffer object named 0, but we use
505  * one internally because it simplifies things.
506  */
507  newBufObj = ctx->Shared->NullBufferObj;
508  }
509  else {
510  /* non-default buffer object */
511  newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
512  if (!newBufObj || newBufObj == &DummyBufferObject) {
513  /* If this is a new buffer object id, or one which was generated but
514  * never used before, allocate a buffer object now.
515  */
516  ASSERT(ctx->Driver.NewBufferObject);
517  newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
518  if (!newBufObj) {
519  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
520  return;
521  }
522  _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj);
523  }
524  }
525 
526  /* bind new buffer */
527  _mesa_reference_buffer_object(ctx, bindTarget, newBufObj);
528 
529  /* Pass BindBuffer call to device driver */
530  if (ctx->Driver.BindBuffer)
531  ctx->Driver.BindBuffer( ctx, target, newBufObj );
532 }
533 
534 
540 void
542 {
543  /* Bind the NullBufferObj to remove references to those
544  * in the shared context hash table.
545  */
548 }
549 
550 
551 
556 struct gl_buffer_object *
558 {
559  if (buffer == 0)
560  return NULL;
561  else
562  return (struct gl_buffer_object *)
563  _mesa_HashLookup(ctx->Shared->BufferObjects, buffer);
564 }
565 
566 
573 static void
574 unbind(struct gl_context *ctx,
575  struct gl_buffer_object **ptr,
576  struct gl_buffer_object *obj)
577 {
578  if (*ptr == obj) {
579  _mesa_reference_buffer_object(ctx, ptr, ctx->Shared->NullBufferObj);
580  }
581 }
582 
583 
588 void
590 {
591  /* GL_ARB_vertex/pixel_buffer_object */
592  driver->NewBufferObject = _mesa_new_buffer_object;
593  driver->DeleteBuffer = _mesa_delete_buffer_object;
594  driver->BindBuffer = NULL;
595  driver->BufferData = _mesa_buffer_data;
596  driver->BufferSubData = _mesa_buffer_subdata;
597  driver->GetBufferSubData = _mesa_buffer_get_subdata;
598  driver->UnmapBuffer = _mesa_buffer_unmap;
599 
600  /* GL_ARB_map_buffer_range */
601  driver->MapBufferRange = _mesa_buffer_map_range;
602  driver->FlushMappedBufferRange = _mesa_buffer_flush_mapped_range;
603 }
604 
605 
606 
607 /**********************************************************************/
608 /* API Functions */
609 /**********************************************************************/
610 
611 void GLAPIENTRY
613 {
614  GET_CURRENT_CONTEXT(ctx);
616 
618  _mesa_debug(ctx, "glBindBuffer(%s, %u)\n",
620 
622 }
623 
624 
631 void GLAPIENTRY
633 {
634  GET_CURRENT_CONTEXT(ctx);
635  GLsizei i;
637  FLUSH_VERTICES(ctx, 0);
638 
639  if (n < 0) {
640  _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)");
641  return;
642  }
643 
644  _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
645 
646  for (i = 0; i < n; i++) {
647  struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
648  if (bufObj) {
649  GLuint j;
650 
651  ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
652 
653  if (_mesa_bufferobj_mapped(bufObj)) {
654  /* if mapped, unmap it now */
655  ctx->Driver.UnmapBuffer(ctx, bufObj);
656  bufObj->AccessFlags = default_access_mode(ctx);
657  bufObj->Pointer = NULL;
658  }
659 
660  /* unbind any vertex pointers bound to this buffer */
661  for (j = 0; j < Elements(ctx->Array.VertexAttrib); j++) {
662  unbind(ctx, &ctx->Array.VertexAttrib[j].BufferObj, bufObj);
663  }
664 
665  if (ctx->Array.ElementArrayBufferObj == bufObj) {
667  }
668 
669  /* The ID is immediately freed for re-use */
670  _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
671  /* Make sure we do not run into the classic ABA problem on bind.
672  * We don't want to allow re-binding a buffer object that's been
673  * "deleted" by glDeleteBuffers().
674  *
675  * The explicit rebinding to the default object in the current context
676  * prevents the above in the current context, but another context
677  * sharing the same objects might suffer from this problem.
678  * The alternative would be to do the hash lookup in any case on bind
679  * which would introduce more runtime overhead than this.
680  */
681  bufObj->DeletePending = GL_TRUE;
682  _mesa_reference_buffer_object(ctx, &bufObj, NULL);
683  }
684  }
685 
686  _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
687 }
688 
689 
696 void GLAPIENTRY
698 {
699  GET_CURRENT_CONTEXT(ctx);
700  GLuint first;
701  GLint i;
703 
705  _mesa_debug(ctx, "glGenBuffers(%d)\n", n);
706 
707  if (n < 0) {
708  _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB");
709  return;
710  }
711 
712  if (!buffer) {
713  return;
714  }
715 
716  /*
717  * This must be atomic (generation and allocation of buffer object IDs)
718  */
719  _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
720 
721  first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
722 
723  /* Insert the ID and pointer to dummy buffer object into hash table */
724  for (i = 0; i < n; i++) {
725  _mesa_HashInsert(ctx->Shared->BufferObjects, first + i,
727  buffer[i] = first + i;
728  }
729 
730  _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
731 }
732 
733 
743 {
744  struct gl_buffer_object *bufObj;
745  GET_CURRENT_CONTEXT(ctx);
747 
748  _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
749  bufObj = _mesa_lookup_bufferobj(ctx, id);
750  _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
751 
752  return bufObj && bufObj != &DummyBufferObject;
753 }
754 
755 
756 void GLAPIENTRY
758  const GLvoid * data, GLenum usage)
759 {
760  GET_CURRENT_CONTEXT(ctx);
761  struct gl_buffer_object *bufObj;
763 
765  _mesa_debug(ctx, "glBufferData(%s, %ld, %p, %s)\n",
767  (long int) size, data,
769 
770  if (size < 0) {
771  _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)");
772  return;
773  }
774 
775  switch (usage) {
776  case GL_STREAM_DRAW_ARB:
777  case GL_STREAM_READ_ARB:
778  case GL_STREAM_COPY_ARB:
779  case GL_STATIC_DRAW_ARB:
780  case GL_STATIC_READ_ARB:
781  case GL_STATIC_COPY_ARB:
782  case GL_DYNAMIC_DRAW_ARB:
783  case GL_DYNAMIC_READ_ARB:
784  case GL_DYNAMIC_COPY_ARB:
785  /* OK */
786  break;
787  default:
788  _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
789  return;
790  }
791 
792  bufObj = get_buffer(ctx, "glBufferDataARB", target);
793  if (!bufObj)
794  return;
795 
796  if (_mesa_bufferobj_mapped(bufObj)) {
797  /* Unmap the existing buffer. We'll replace it now. Not an error. */
798  ctx->Driver.UnmapBuffer(ctx, bufObj);
799  bufObj->AccessFlags = default_access_mode(ctx);
800  ASSERT(bufObj->Pointer == NULL);
801  }
802 
804 
805  bufObj->Written = GL_TRUE;
806 
807 #ifdef VBO_DEBUG
808  printf("glBufferDataARB(%u, sz %ld, from %p, usage 0x%x)\n",
809  bufObj->Name, size, data, usage);
810 #endif
811 
812 #ifdef BOUNDS_CHECK
813  size += 100;
814 #endif
815 
816  ASSERT(ctx->Driver.BufferData);
817  if (!ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj )) {
818  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()");
819  }
820 }
821 
822 
823 void GLAPIENTRY
825  GLsizeiptrARB size, const GLvoid * data)
826 {
827  GET_CURRENT_CONTEXT(ctx);
828  struct gl_buffer_object *bufObj;
830 
832  "glBufferSubDataARB" );
833  if (!bufObj) {
834  /* error already recorded */
835  return;
836  }
837 
838  if (size == 0)
839  return;
840 
841  bufObj->Written = GL_TRUE;
842 
843  ASSERT(ctx->Driver.BufferSubData);
844  ctx->Driver.BufferSubData( ctx, offset, size, data, bufObj );
845 }
846 
847 
848 void GLAPIENTRY
850  GLsizeiptrARB size, void * data)
851 {
852  GET_CURRENT_CONTEXT(ctx);
853  struct gl_buffer_object *bufObj;
855 
857  "glGetBufferSubDataARB" );
858  if (!bufObj) {
859  /* error already recorded */
860  return;
861  }
862 
863  ASSERT(ctx->Driver.GetBufferSubData);
864  ctx->Driver.GetBufferSubData( ctx, offset, size, data, bufObj );
865 }
866 
867 
868 void * GLAPIENTRY
870 {
871  GET_CURRENT_CONTEXT(ctx);
872  struct gl_buffer_object * bufObj;
873  GLbitfield accessFlags;
874  void *map;
875 
877 
878  switch (access) {
879  case GL_READ_ONLY_ARB:
880  accessFlags = GL_MAP_READ_BIT;
881  break;
882  case GL_WRITE_ONLY_ARB:
883  accessFlags = GL_MAP_WRITE_BIT;
884  break;
885  case GL_READ_WRITE_ARB:
886  accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
887  break;
888  default:
889  _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
890  return NULL;
891  }
892 
893  bufObj = get_buffer(ctx, "glMapBufferARB", target);
894  if (!bufObj)
895  return NULL;
896 
897  if (_mesa_bufferobj_mapped(bufObj)) {
898  _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(already mapped)");
899  return NULL;
900  }
901 
902  if (!bufObj->Size) {
904  "glMapBuffer(buffer size = 0)");
905  return NULL;
906  }
907 
908  ASSERT(ctx->Driver.MapBufferRange);
909  map = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size, accessFlags, bufObj);
910  if (!map) {
911  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
912  return NULL;
913  }
914  else {
915  /* The driver callback should have set these fields.
916  * This is important because other modules (like VBO) might call
917  * the driver function directly.
918  */
919  ASSERT(bufObj->Pointer == map);
920  ASSERT(bufObj->Length == bufObj->Size);
921  ASSERT(bufObj->Offset == 0);
922  bufObj->AccessFlags = accessFlags;
923  }
924 
926  bufObj->Written = GL_TRUE;
927 
928 #ifdef VBO_DEBUG
929  printf("glMapBufferARB(%u, sz %ld, access 0x%x)\n",
930  bufObj->Name, bufObj->Size, access);
931  if (access == GL_WRITE_ONLY_ARB) {
932  GLuint i;
933  GLubyte *b = (GLubyte *) bufObj->Pointer;
934  for (i = 0; i < bufObj->Size; i++)
935  b[i] = i & 0xff;
936  }
937 #endif
938 
939 #ifdef BOUNDS_CHECK
940  {
941  GLubyte *buf = (GLubyte *) bufObj->Pointer;
942  GLuint i;
943  /* buffer is 100 bytes larger than requested, fill with magic value */
944  for (i = 0; i < 100; i++) {
945  buf[bufObj->Size - i - 1] = 123;
946  }
947  }
948 #endif
949 
950  return bufObj->Pointer;
951 }
952 
953 
956 {
957  GET_CURRENT_CONTEXT(ctx);
958  struct gl_buffer_object *bufObj;
961 
962  bufObj = get_buffer(ctx, "glUnmapBufferARB", target);
963  if (!bufObj)
964  return GL_FALSE;
965 
966  if (!_mesa_bufferobj_mapped(bufObj)) {
967  _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB");
968  return GL_FALSE;
969  }
970 
971 #ifdef BOUNDS_CHECK
972  if (bufObj->Access != GL_READ_ONLY_ARB) {
973  GLubyte *buf = (GLubyte *) bufObj->Pointer;
974  GLuint i;
975  /* check that last 100 bytes are still = magic value */
976  for (i = 0; i < 100; i++) {
977  GLuint pos = bufObj->Size - i - 1;
978  if (buf[pos] != 123) {
979  _mesa_warning(ctx, "Out of bounds buffer object write detected"
980  " at position %d (value = %u)\n",
981  pos, buf[pos]);
982  }
983  }
984  }
985 #endif
986 
987 #ifdef VBO_DEBUG
988  if (bufObj->AccessFlags & GL_MAP_WRITE_BIT) {
989  GLuint i, unchanged = 0;
990  GLubyte *b = (GLubyte *) bufObj->Pointer;
991  GLint pos = -1;
992  /* check which bytes changed */
993  for (i = 0; i < bufObj->Size - 1; i++) {
994  if (b[i] == (i & 0xff) && b[i+1] == ((i+1) & 0xff)) {
995  unchanged++;
996  if (pos == -1)
997  pos = i;
998  }
999  }
1000  if (unchanged) {
1001  printf("glUnmapBufferARB(%u): %u of %ld unchanged, starting at %d\n",
1002  bufObj->Name, unchanged, bufObj->Size, pos);
1003  }
1004  }
1005 #endif
1006 
1007  status = ctx->Driver.UnmapBuffer( ctx, bufObj );
1008  bufObj->AccessFlags = default_access_mode(ctx);
1009  ASSERT(bufObj->Pointer == NULL);
1010  ASSERT(bufObj->Offset == 0);
1011  ASSERT(bufObj->Length == 0);
1012 
1013  return status;
1014 }
1015 
1016 
1017 void GLAPIENTRY
1019 {
1020  GET_CURRENT_CONTEXT(ctx);
1021  struct gl_buffer_object *bufObj;
1023 
1024  bufObj = get_buffer(ctx, "glGetBufferParameterivARB", target);
1025  if (!bufObj)
1026  return;
1027 
1028  switch (pname) {
1029  case GL_BUFFER_SIZE_ARB:
1030  *params = (GLint) bufObj->Size;
1031  return;
1032  case GL_BUFFER_USAGE_ARB:
1033  *params = bufObj->Usage;
1034  return;
1035  case GL_BUFFER_ACCESS_ARB:
1037  return;
1038  case GL_BUFFER_MAPPED_ARB:
1039  *params = _mesa_bufferobj_mapped(bufObj);
1040  return;
1042  if (!ctx->Extensions.ARB_map_buffer_range)
1043  goto invalid_pname;
1044  *params = bufObj->AccessFlags;
1045  return;
1046  case GL_BUFFER_MAP_OFFSET:
1047  if (!ctx->Extensions.ARB_map_buffer_range)
1048  goto invalid_pname;
1049  *params = (GLint) bufObj->Offset;
1050  return;
1051  case GL_BUFFER_MAP_LENGTH:
1052  if (!ctx->Extensions.ARB_map_buffer_range)
1053  goto invalid_pname;
1054  *params = (GLint) bufObj->Length;
1055  return;
1056  default:
1057  ; /* fall-through */
1058  }
1059 
1060 invalid_pname:
1061  _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname=%s)",
1063 }
1064 
1065 
1071 void GLAPIENTRY
1073 {
1074  GET_CURRENT_CONTEXT(ctx);
1075  struct gl_buffer_object *bufObj;
1077 
1078  bufObj = get_buffer(ctx, "glGetBufferParameteri64v", target);
1079  if (!bufObj)
1080  return;
1081 
1082  switch (pname) {
1083  case GL_BUFFER_SIZE_ARB:
1084  *params = bufObj->Size;
1085  return;
1086  case GL_BUFFER_USAGE_ARB:
1087  *params = bufObj->Usage;
1088  return;
1089  case GL_BUFFER_ACCESS_ARB:
1091  return;
1093  if (!ctx->Extensions.ARB_map_buffer_range)
1094  goto invalid_pname;
1095  *params = bufObj->AccessFlags;
1096  return;
1097  case GL_BUFFER_MAPPED_ARB:
1098  *params = _mesa_bufferobj_mapped(bufObj);
1099  return;
1100  case GL_BUFFER_MAP_OFFSET:
1101  if (!ctx->Extensions.ARB_map_buffer_range)
1102  goto invalid_pname;
1103  *params = bufObj->Offset;
1104  return;
1105  case GL_BUFFER_MAP_LENGTH:
1106  if (!ctx->Extensions.ARB_map_buffer_range)
1107  goto invalid_pname;
1108  *params = bufObj->Length;
1109  return;
1110  default:
1111  ; /* fall-through */
1112  }
1113 
1114 invalid_pname:
1115  _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname=%s)",
1117 }
1118 
1119 
1120 void GLAPIENTRY
1122 {
1123  GET_CURRENT_CONTEXT(ctx);
1124  struct gl_buffer_object * bufObj;
1126 
1128  _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
1129  return;
1130  }
1131 
1132  bufObj = get_buffer(ctx, "glGetBufferPointervARB", target);
1133  if (!bufObj)
1134  return;
1135 
1136  *params = bufObj->Pointer;
1137 }
1138 
1142 void * GLAPIENTRY
1145 {
1146  GET_CURRENT_CONTEXT(ctx);
1147  struct gl_buffer_object *bufObj;
1148  void *map;
1149 
1151 
1152  if (!ctx->Extensions.ARB_map_buffer_range) {
1154  "glMapBufferRange(extension not supported)");
1155  return NULL;
1156  }
1157 
1158  if (offset < 0) {
1160  "glMapBufferRange(offset = %ld)", (long)offset);
1161  return NULL;
1162  }
1163 
1164  if (length < 0) {
1166  "glMapBufferRange(length = %ld)", (long)length);
1167  return NULL;
1168  }
1169 
1170  if (access & ~(GL_MAP_READ_BIT |
1176  /* generate an error if any undefind bit is set */
1177  _mesa_error(ctx, GL_INVALID_VALUE, "glMapBufferRange(access)");
1178  return NULL;
1179  }
1180 
1181  if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) {
1183  "glMapBufferRange(access indicates neither read or write)");
1184  return NULL;
1185  }
1186 
1187  if ((access & GL_MAP_READ_BIT) &&
1192  "glMapBufferRange(invalid access flags)");
1193  return NULL;
1194  }
1195 
1197  ((access & GL_MAP_WRITE_BIT) == 0)) {
1199  "glMapBufferRange(invalid access flags)");
1200  return NULL;
1201  }
1202 
1203  bufObj = get_buffer(ctx, "glMapBufferRange", target);
1204  if (!bufObj)
1205  return NULL;
1206 
1207  if (offset + length > bufObj->Size) {
1209  "glMapBufferRange(offset + length > size)");
1210  return NULL;
1211  }
1212 
1213  if (_mesa_bufferobj_mapped(bufObj)) {
1215  "glMapBufferRange(buffer already mapped)");
1216  return NULL;
1217  }
1218 
1219  if (!bufObj->Size) {
1221  "glMapBufferRange(buffer size = 0)");
1222  return NULL;
1223  }
1224 
1225  /* Mapping zero bytes should return a non-null pointer. */
1226  if (!length) {
1227  static long dummy = 0;
1228  bufObj->Pointer = &dummy;
1229  bufObj->Length = length;
1230  bufObj->Offset = offset;
1231  bufObj->AccessFlags = access;
1232  return bufObj->Pointer;
1233  }
1234 
1235  ASSERT(ctx->Driver.MapBufferRange);
1236  map = ctx->Driver.MapBufferRange(ctx, offset, length, access, bufObj);
1237  if (!map) {
1238  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
1239  }
1240  else {
1241  /* The driver callback should have set all these fields.
1242  * This is important because other modules (like VBO) might call
1243  * the driver function directly.
1244  */
1245  ASSERT(bufObj->Pointer == map);
1246  ASSERT(bufObj->Length == length);
1247  ASSERT(bufObj->Offset == offset);
1248  ASSERT(bufObj->AccessFlags == access);
1249  }
1250 
1251  return map;
1252 }
1253 
1254 
1258 void GLAPIENTRY
1260 {
1261  GET_CURRENT_CONTEXT(ctx);
1262  struct gl_buffer_object *bufObj;
1264 
1265  if (!ctx->Extensions.ARB_map_buffer_range) {
1267  "glFlushMappedBufferRange(extension not supported)");
1268  return;
1269  }
1270 
1271  if (offset < 0) {
1273  "glFlushMappedBufferRange(offset = %ld)", (long)offset);
1274  return;
1275  }
1276 
1277  if (length < 0) {
1279  "glFlushMappedBufferRange(length = %ld)", (long)length);
1280  return;
1281  }
1282 
1283  bufObj = get_buffer(ctx, "glFlushMappedBufferRange", target);
1284  if (!bufObj)
1285  return;
1286 
1287  if (!_mesa_bufferobj_mapped(bufObj)) {
1288  /* buffer is not mapped */
1290  "glFlushMappedBufferRange(buffer is not mapped)");
1291  return;
1292  }
1293 
1294  if ((bufObj->AccessFlags & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) {
1296  "glFlushMappedBufferRange(GL_MAP_FLUSH_EXPLICIT_BIT not set)");
1297  return;
1298  }
1299 
1300  if (offset + length > bufObj->Length) {
1302  "glFlushMappedBufferRange(offset %ld + length %ld > mapped length %ld)",
1303  (long)offset, (long)length, (long)bufObj->Length);
1304  return;
1305  }
1306 
1307  ASSERT(bufObj->AccessFlags & GL_MAP_WRITE_BIT);
1308 
1309  if (ctx->Driver.FlushMappedBufferRange)
1310  ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj);
1311 }
1312 
void _mesa_update_default_objects_buffer_objects(struct gl_context *ctx)
Definition: bufferobj.c:541
static struct gl_buffer_object * get_buffer(struct gl_context *ctx, const char *func, GLenum target)
Definition: bufferobj.c:75
static struct gl_buffer_object ** get_buffer_target(struct gl_context *ctx, GLenum target)
Definition: bufferobj.c:55
GLsizeiptr Length
Definition: mtypes.h:1135
#define MALLOC_STRUCT(T)
Definition: imports.h:57
void * _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
Definition: imports.c:212
static void * _mesa_buffer_map_range(struct gl_context *ctx, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:414
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
GLint RefCount
Definition: mtypes.h:1125
void _mesa_init_buffer_object_functions(struct dd_function_table *driver)
Definition: bufferobj.c:589
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
void GLAPIENTRY _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
Definition: bufferobj.c:1018
#define GL_STREAM_READ_ARB
Definition: glext.h:1507
#define GL_BUFFER_MAP_OFFSET
Definition: glext.h:604
#define GL_MAP_READ_BIT
Definition: glext.h:1793
#define _glthread_INIT_MUTEX(name)
Definition: glheader.h:62
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define GL_FALSE
Definition: gl.h:173
static void _mesa_buffer_get_subdata(struct gl_context *ctx, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:397
#define free
Definition: debug_ros.c:5
const GLint * first
Definition: glext.h:5794
#define FLUSH_VERTICES(ctx, newstate)
Definition: context.h:204
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint GLenum GLfloat GLenum GLint GLenum GLsizei GLenum GLboolean GLenum GLdouble GLenum GLfloat GLenum GLenum GLfloat GLenum GLenum GLdouble GLenum GLenum GLint GLenum GLenum GLint GLenum map
Definition: glfuncs.h:124
GLintptr offset
Definition: glext.h:5920
GLboolean GLAPIENTRY _mesa_IsBufferARB(GLuint id)
Definition: bufferobj.c:742
#define GL_MAP_INVALIDATE_BUFFER_BIT
Definition: glext.h:1796
static void unbind(struct gl_context *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *obj)
Definition: bufferobj.c:574
GLsizeiptrARB Size
Definition: mtypes.h:1128
#define GET_CURRENT_CONTEXT(__ctx__)
Definition: glheader.h:69
static GLboolean _mesa_buffer_unmap(struct gl_context *ctx, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:454
#define GL_ARRAY_BUFFER_ARB
Definition: glext.h:1486
#define GL_ELEMENT_ARRAY_BUFFER_ARB
Definition: glext.h:1487
#define assert(x)
Definition: debug.h:53
void _mesa_debug(const struct gl_context *ctx, const char *fmtString,...)
Definition: imports.c:889
GLboolean GLAPIENTRY _mesa_UnmapBufferARB(GLenum target)
Definition: bufferobj.c:955
GLuint buffer
Definition: glext.h:5915
static void bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
Definition: bufferobj.c:483
void * _mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
Definition: hash.c:151
GLboolean Written
Definition: mtypes.h:1138
#define GL_READ_WRITE
Definition: glext.h:343
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
#define GL_READ_ONLY_ARB
Definition: glext.h:1500
const GLint const GLsizei GLsizei
Definition: dispatch.h:5271
unsigned int GLbitfield
Definition: gl.h:152
static void _mesa_delete_buffer_object(struct gl_context *ctx, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:198
GLuint n
Definition: s_context.h:57
#define ASSERT_OUTSIDE_BEGIN_END(ctx)
Definition: context.h:253
struct dd_function_table Driver
Definition: mtypes.h:1773
GLuint * ids
Definition: glext.h:5907
#define GL_READ_ONLY
Definition: glext.h:341
void *GLAPIENTRY _mesa_MapBufferARB(GLenum target, GLenum access)
Definition: bufferobj.c:869
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define GL_BUFFER_ACCESS_ARB
Definition: glext.h:1503
GLenum const GLfloat * params
Definition: glext.h:5645
void _mesa_warning(struct gl_context *ctx, const char *fmtString,...)
Definition: imports.c:775
unsigned char GLboolean
Definition: gl.h:151
#define GL_BUFFER_MAPPED_ARB
Definition: glext.h:1504
static PVOID ptr
Definition: dispmode.c:27
#define GL_READ_WRITE_ARB
Definition: glext.h:1502
#define GL_BUFFER_MAP_LENGTH
Definition: glext.h:603
#define GL_BUFFER_USAGE_ARB
Definition: glext.h:1485
GLintptr Offset
Definition: mtypes.h:1134
smooth NULL
Definition: ftsmooth.c:416
ptrdiff_t GLsizeiptr
Definition: glext.h:5499
#define GL_STATIC_COPY_ARB
Definition: glext.h:1511
#define GL_BUFFER_ACCESS_FLAGS
Definition: glext.h:602
GLubyte * Data
Definition: mtypes.h:1129
void _mesa_problem(const struct gl_context *ctx, const char *fmtString,...)
Definition: imports.c:798
#define GL_MAP_WRITE_BIT
Definition: glext.h:1794
void GLAPIENTRY _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
Definition: bufferobj.c:697
static void _mesa_buffer_subdata(struct gl_context *ctx, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:364
void GLAPIENTRY _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data)
Definition: bufferobj.c:824
void GLAPIENTRY _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
Definition: bufferobj.c:1259
void _mesa_init_buffer_objects(struct gl_context *ctx)
Definition: bufferobj.c:470
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
Definition: hash.c:171
struct gl_buffer_object * _mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer)
Definition: bufferobj.c:557
#define _glthread_UNLOCK_MUTEX(name)
Definition: glheader.h:65
GLsizeiptr size
Definition: glext.h:5919
static struct gl_buffer_object DummyBufferObject
Definition: bufferobj.c:44
if(!(yy_init))
Definition: macro.lex.yy.c:717
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
int MESA_VERBOSE
Definition: context.c:86
void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
Definition: hash.c:226
static GLboolean _mesa_is_bufferobj(const struct gl_buffer_object *obj)
Definition: bufferobj.h:54
#define for
Definition: utility.h:88
GLboolean DeletePending
Definition: mtypes.h:1137
Definition: _map.h:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void _mesa_initialize_buffer_object(struct gl_context *ctx, struct gl_buffer_object *obj, GLuint name, GLenum target)
Definition: bufferobj.c:285
#define GL_INVALID_VALUE
Definition: gl.h:695
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define GL_INVALID_OPERATION
Definition: gl.h:696
void _mesa_reference_buffer_object_(struct gl_context *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:222
#define GL_WRITE_ONLY
Definition: glext.h:342
#define GL_BUFFER_MAP_POINTER_ARB
Definition: glext.h:1505
int64_t GLint64
Definition: glext.h:5567
void GLAPIENTRY _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage)
Definition: bufferobj.c:757
void GLAPIENTRY _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
Definition: bufferobj.c:1072
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct @1598::@1599 driver
ptrdiff_t GLintptrARB
Definition: glext.h:5504
static GLenum simplified_access_mode(GLbitfield access)
Definition: bufferobj.c:106
#define GL_DYNAMIC_READ_ARB
Definition: glext.h:1513
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
GLenum Usage
Definition: mtypes.h:1127
static GLboolean _mesa_buffer_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *bufObj)
Definition: bufferobj.c:320
#define GL_STATIC_READ_ARB
Definition: glext.h:1510
#define GL_WRITE_ONLY_ARB
Definition: glext.h:1501
void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
Definition: bufferobj.c:1121
unsigned char GLubyte
Definition: gl.h:157
void *GLAPIENTRY _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
Definition: bufferobj.c:1143
const char * _mesa_lookup_enum_by_nr(int nr)
Definition: enums.c:6332
static struct gl_buffer_object * _mesa_new_buffer_object(struct gl_context *ctx, GLuint name, GLenum target)
Definition: bufferobj.c:180
#define GL_MAP_UNSYNCHRONIZED_BIT
Definition: glext.h:1798
unsigned int GLuint
Definition: gl.h:159
static GLenum default_access_mode(const struct gl_context *ctx)
Definition: bufferobj.c:94
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
unsigned char dummy
Definition: maze.c:118
#define GL_MAP_INVALIDATE_RANGE_BIT
Definition: glext.h:1795
#define GL_TRUE
Definition: gl.h:174
static void _mesa_reference_buffer_object(struct gl_context *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj)
Definition: bufferobj.h:84
struct gl_array_attrib Array
Definition: mtypes.h:1846
#define GL_DYNAMIC_DRAW_ARB
Definition: glext.h:1512
void GLAPIENTRY _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data)
Definition: bufferobj.c:849
#define GL_INVALID_ENUM
Definition: gl.h:694
void GLAPIENTRY _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
Definition: bufferobj.c:632
#define _NEW_BUFFER_OBJECT
Definition: mtypes.h:1612
_glthread_Mutex Mutex
Definition: mtypes.h:1124
#define GL_OUT_OF_MEMORY
Definition: gl.h:699
#define GL_DYNAMIC_COPY_ARB
Definition: glext.h:1514
ptrdiff_t GLsizeiptrARB
Definition: glext.h:5505
#define _glthread_DESTROY_MUTEX(name)
Definition: glheader.h:63
Definition: name.c:36
#define Elements(x)
Definition: compiler.h:496
#define _glthread_LOCK_MUTEX(name)
Definition: glheader.h:64
#define GL_MAP_FLUSH_EXPLICIT_BIT
Definition: glext.h:1797
GLvoid * Pointer
Definition: mtypes.h:1133
ptrdiff_t GLintptr
Definition: glext.h:5498
#define GL_STATIC_DRAW_ARB
Definition: glext.h:1509
struct gl_shared_state * Shared
Definition: mtypes.h:1755
#define GL_STREAM_COPY_ARB
Definition: glext.h:1508
GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
Definition: hash.c:442
GLbitfield AccessFlags
Definition: mtypes.h:1132
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
static GLboolean _mesa_bufferobj_mapped(const struct gl_buffer_object *obj)
Definition: bufferobj.h:43
void GLAPIENTRY _mesa_BindBufferARB(GLenum target, GLuint buffer)
Definition: bufferobj.c:612
#define GL_STREAM_DRAW_ARB
Definition: glext.h:1506
#define GLAPIENTRY
Definition: glu.h:44
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval)
Definition: context.h:239
#define GL_BUFFER_SIZE_ARB
Definition: glext.h:1484
static void _mesa_buffer_flush_mapped_range(struct gl_context *ctx, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj)
Definition: bufferobj.c:434
const GLint const GLsizei GLint
Definition: dispatch.h:5271
#define printf
Definition: config.h:203
static struct gl_buffer_object * buffer_object_subdata_range_good(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const char *caller)
Definition: bufferobj.c:136
void _mesa_error(struct gl_context *ctx, GLenum error, const char *fmtString,...)
Definition: imports.c:832
Definition: ps.c:97
GLuint const GLchar * name
Definition: glext.h:6031