1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "chromium.h"
|
---|
8 | #include "cr_error.h"
|
---|
9 | #include "cr_mem.h"
|
---|
10 | #include "server_dispatch.h"
|
---|
11 | #include "server.h"
|
---|
12 | #include "cr_unpack.h"
|
---|
13 |
|
---|
14 | void * SERVER_DISPATCH_APIENTRY
|
---|
15 | crServerDispatchMapBufferARB( GLenum target, GLenum access )
|
---|
16 | {
|
---|
17 | return NULL;
|
---|
18 | }
|
---|
19 |
|
---|
20 | GLboolean SERVER_DISPATCH_APIENTRY
|
---|
21 | crServerDispatchUnmapBufferARB( GLenum target )
|
---|
22 | {
|
---|
23 | return GL_FALSE;
|
---|
24 | }
|
---|
25 |
|
---|
26 | void SERVER_DISPATCH_APIENTRY
|
---|
27 | crServerDispatchGenBuffersARB(GLsizei n, GLuint *buffers)
|
---|
28 | {
|
---|
29 | GLuint *local_buffers;
|
---|
30 | (void) buffers;
|
---|
31 |
|
---|
32 | if (n <= 0 || n >= INT32_MAX / sizeof(GLuint))
|
---|
33 | {
|
---|
34 | crError("crServerDispatchGenBuffersARB: parameter 'n' is out of range");
|
---|
35 | return;
|
---|
36 | }
|
---|
37 |
|
---|
38 | local_buffers = (GLuint *)crCalloc(n * sizeof(*local_buffers));
|
---|
39 |
|
---|
40 | if (!local_buffers)
|
---|
41 | {
|
---|
42 | crError("crServerDispatchGenBuffersARB: out of memory");
|
---|
43 | return;
|
---|
44 | }
|
---|
45 |
|
---|
46 | crStateGenBuffersARB(n, local_buffers);
|
---|
47 |
|
---|
48 | crServerReturnValue( local_buffers, n * sizeof(*local_buffers) );
|
---|
49 | crFree( local_buffers );
|
---|
50 | }
|
---|
51 |
|
---|
52 | void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteBuffersARB( GLsizei n, const GLuint * buffer )
|
---|
53 | {
|
---|
54 | if (n <= 0 || n >= INT32_MAX / sizeof(GLuint) || !DATA_POINTER_CHECK(n * sizeof(GLuint)))
|
---|
55 | {
|
---|
56 | crError("glDeleteBuffersARB: parameter 'n' is out of range");
|
---|
57 | return;
|
---|
58 | }
|
---|
59 |
|
---|
60 | crStateDeleteBuffersARB( n, buffer );
|
---|
61 | }
|
---|
62 |
|
---|
63 | void SERVER_DISPATCH_APIENTRY
|
---|
64 | crServerDispatchGetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
|
---|
65 | {
|
---|
66 | crError( "glGetBufferPointervARB isn't *ever* allowed to be on the wire!" );
|
---|
67 | (void) target;
|
---|
68 | (void) pname;
|
---|
69 | (void) params;
|
---|
70 | }
|
---|
71 |
|
---|
72 | void SERVER_DISPATCH_APIENTRY
|
---|
73 | crServerDispatchGetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data)
|
---|
74 | {
|
---|
75 | void *b;
|
---|
76 |
|
---|
77 | if (size <= 0 || size >= INT32_MAX / 2)
|
---|
78 | {
|
---|
79 | crError("crServerDispatchGetBufferSubDataARB: size is out of range");
|
---|
80 | return;
|
---|
81 | }
|
---|
82 |
|
---|
83 | b = crCalloc(size);
|
---|
84 |
|
---|
85 | if (b) {
|
---|
86 | cr_server.head_spu->dispatch_table.GetBufferSubDataARB( target, offset, size, b );
|
---|
87 |
|
---|
88 | crServerReturnValue( b, size );
|
---|
89 | crFree( b );
|
---|
90 | }
|
---|
91 | else {
|
---|
92 | crError("Out of memory in crServerDispatchGetBufferSubDataARB");
|
---|
93 | }
|
---|
94 | }
|
---|
95 |
|
---|
96 | void SERVER_DISPATCH_APIENTRY
|
---|
97 | crServerDispatchBindBufferARB(GLenum target, GLuint buffer)
|
---|
98 | {
|
---|
99 | crStateBindBufferARB(target, buffer);
|
---|
100 | cr_server.head_spu->dispatch_table.BindBufferARB(target, crStateGetBufferHWID(buffer));
|
---|
101 | }
|
---|
102 |
|
---|
103 | GLboolean SERVER_DISPATCH_APIENTRY
|
---|
104 | crServerDispatchIsBufferARB(GLuint buffer)
|
---|
105 | {
|
---|
106 | /* since GenBuffersARB issued to host ogl only on bind + some other ops, the host drivers may not know about them
|
---|
107 | * so use state data*/
|
---|
108 | GLboolean retval = crStateIsBufferARB(buffer);
|
---|
109 | crServerReturnValue( &retval, sizeof(retval) );
|
---|
110 | return retval; /* WILL PROBABLY BE IGNORED */
|
---|
111 | }
|
---|