-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathglDeleteBuffersARB.c
45 lines (34 loc) · 936 Bytes
/
glDeleteBuffersARB.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "pspgl_internal.h"
#include "pspgl_buffers.h"
void glDeleteBuffersARB (GLsizei n, const GLuint *buffers)
{
int i;
struct hashtable *hash = &pspgl_curctx->shared->buffers;
if (unlikely(n < 0))
goto out_error;
for(i = 0; i < n; i++) {
GLuint id = buffers[i];
struct pspgl_bufferobj *bufp;
if (id == 0)
continue;
bufp = __pspgl_hash_remove(hash, id);
if (bufp) {
int t;
struct pspgl_bufferobj **boundp;
static const GLenum targets[] = {
GL_ARRAY_BUFFER_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB
};
for(t = 0; t < sizeof(targets)/sizeof(*targets); t++) {
boundp = __pspgl_bufferobj_for_target(targets[t]);
if (boundp != NULL && *boundp == bufp)
glBindBufferARB(targets[t], 0);
}
__pspgl_bufferobj_free(bufp);
}
}
return;
out_error:
GLERROR(GL_INVALID_VALUE);
}
void glDeleteBuffers (GLsizei n, const GLuint *buffers)
__attribute__((alias("glDeleteBuffersARB")));