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