-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathglBufferSubDataARB.c
46 lines (32 loc) · 945 Bytes
/
glBufferSubDataARB.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 <string.h>
#include "pspgl_internal.h"
#include "pspgl_buffers.h"
void glBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size,
const GLvoid *data)
{
struct pspgl_bufferobj *buf, **bufp;
void *p;
GLenum error;
bufp = __pspgl_bufferobj_for_target(target);
if (bufp == NULL)
return;
buf = *bufp;
error = GL_INVALID_OPERATION;
if (unlikely(buf == NULL) || unlikely(buf->mapped))
goto out_error;
error = GL_INVALID_VALUE;
if (size < 0 ||
buf->data == NULL ||
size+offset > buf->data->size)
goto out_error;
__pspgl_buffer_dlist_sync(buf->data);
p = __pspgl_buffer_map(buf->data, GL_WRITE_ONLY_ARB);
memcpy(p + offset, data, size);
__pspgl_buffer_unmap(buf->data, GL_WRITE_ONLY_ARB);
return;
out_error:
GLERROR(error);
}
void glBufferSubData(GLenum target, GLintptrARB offset, GLsizeiptrARB size,
const GLvoid *data)
__attribute__((alias("glBufferSubDataARB")));