1 | /* $Id: pack_shaders.c 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox OpenGL DRI driver functions
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "packer.h"
|
---|
20 | #include "cr_error.h"
|
---|
21 | #include "cr_string.h"
|
---|
22 |
|
---|
23 | void PACK_APIENTRY crPackBindAttribLocation(GLuint program, GLuint index, const char *name)
|
---|
24 | {
|
---|
25 | GET_PACKER_CONTEXT(pc);
|
---|
26 | unsigned char *data_ptr;
|
---|
27 | int cbName = crStrlen(name)+1;
|
---|
28 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+sizeof(index) + cbName*sizeof(*name);
|
---|
29 |
|
---|
30 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
31 | WRITE_DATA_AI(int, packet_length);
|
---|
32 | WRITE_DATA_AI(GLenum, CR_BINDATTRIBLOCATION_EXTEND_OPCODE);
|
---|
33 | WRITE_DATA_AI(GLuint, program);
|
---|
34 | WRITE_DATA_AI(GLuint, index);
|
---|
35 | crMemcpy(data_ptr, name, cbName*sizeof(*name));
|
---|
36 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
37 | }
|
---|
38 |
|
---|
39 | void PACK_APIENTRY crPackShaderSource(GLuint shader, GLsizei count, const char **string, const GLint *length)
|
---|
40 | {
|
---|
41 | GET_PACKER_CONTEXT(pc);
|
---|
42 | unsigned char *data_ptr;
|
---|
43 | GLint *pLocalLength;
|
---|
44 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(shader)+sizeof(count)+sizeof(GLint)+count*sizeof(*pLocalLength);
|
---|
45 | GLsizei i;
|
---|
46 |
|
---|
47 | if ((0==count) || (!string)) return;
|
---|
48 |
|
---|
49 | pLocalLength = crAlloc(count*sizeof(*length));
|
---|
50 | if (!pLocalLength) return;
|
---|
51 |
|
---|
52 | for (i=0; i<count; ++i)
|
---|
53 | {
|
---|
54 | pLocalLength[i] = (length && (length[i]>=0)) ? length[i] : crStrlen(string[i])+1;
|
---|
55 | packet_length += pLocalLength[i];
|
---|
56 | }
|
---|
57 |
|
---|
58 | if (length)
|
---|
59 | {
|
---|
60 | packet_length += count*sizeof(*length);
|
---|
61 | }
|
---|
62 |
|
---|
63 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
64 | WRITE_DATA_AI(int, packet_length);
|
---|
65 | WRITE_DATA_AI(GLenum, CR_SHADERSOURCE_EXTEND_OPCODE);
|
---|
66 | WRITE_DATA_AI(GLuint, shader);
|
---|
67 | WRITE_DATA_AI(GLsizei, count);
|
---|
68 | WRITE_DATA_AI(GLint, (GLint)(length ? 1:0));
|
---|
69 | crMemcpy(data_ptr, pLocalLength, count*sizeof(*pLocalLength));
|
---|
70 | data_ptr += count*sizeof(*pLocalLength);
|
---|
71 |
|
---|
72 | if (length)
|
---|
73 | {
|
---|
74 | crMemcpy(data_ptr, length, count*sizeof(*length));
|
---|
75 | data_ptr += count*sizeof(*length);
|
---|
76 | }
|
---|
77 |
|
---|
78 | for (i=0; i<count; ++i)
|
---|
79 | {
|
---|
80 | crMemcpy(data_ptr, string[i], pLocalLength[i]);
|
---|
81 | data_ptr += pLocalLength[i];
|
---|
82 | }
|
---|
83 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
84 |
|
---|
85 | crFree(pLocalLength);
|
---|
86 | }
|
---|
87 |
|
---|
88 | void PACK_APIENTRY crPackUniform1fv(GLint location, GLsizei count, const GLfloat *value)
|
---|
89 | {
|
---|
90 | GET_PACKER_CONTEXT(pc);
|
---|
91 | unsigned char *data_ptr;
|
---|
92 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value);
|
---|
93 |
|
---|
94 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
95 | WRITE_DATA_AI(int, packet_length);
|
---|
96 | WRITE_DATA_AI(GLenum, CR_UNIFORM1FV_EXTEND_OPCODE);
|
---|
97 | WRITE_DATA_AI(GLint, location);
|
---|
98 | WRITE_DATA_AI(GLsizei, count);
|
---|
99 | crMemcpy(data_ptr, value, count*sizeof(*value));
|
---|
100 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
101 | }
|
---|
102 |
|
---|
103 | void PACK_APIENTRY crPackUniform1iv(GLint location, GLsizei count, const GLint *value)
|
---|
104 | {
|
---|
105 | GET_PACKER_CONTEXT(pc);
|
---|
106 | unsigned char *data_ptr;
|
---|
107 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value);
|
---|
108 |
|
---|
109 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
110 | WRITE_DATA_AI(int, packet_length);
|
---|
111 | WRITE_DATA_AI(GLenum, CR_UNIFORM1IV_EXTEND_OPCODE);
|
---|
112 | WRITE_DATA_AI(GLint, location);
|
---|
113 | WRITE_DATA_AI(GLsizei, count);
|
---|
114 | crMemcpy(data_ptr, value, count*sizeof(*value));
|
---|
115 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
116 | }
|
---|
117 |
|
---|
118 | void PACK_APIENTRY crPackUniform2fv(GLint location, GLsizei count, const GLfloat *value)
|
---|
119 | {
|
---|
120 | GET_PACKER_CONTEXT(pc);
|
---|
121 | unsigned char *data_ptr;
|
---|
122 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value);
|
---|
123 |
|
---|
124 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
125 | WRITE_DATA_AI(int, packet_length);
|
---|
126 | WRITE_DATA_AI(GLenum, CR_UNIFORM2FV_EXTEND_OPCODE);
|
---|
127 | WRITE_DATA_AI(GLint, location);
|
---|
128 | WRITE_DATA_AI(GLsizei, count);
|
---|
129 | crMemcpy(data_ptr, value, 2*count*sizeof(*value));
|
---|
130 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
131 | }
|
---|
132 |
|
---|
133 | void PACK_APIENTRY crPackUniform2iv(GLint location, GLsizei count, const GLint *value)
|
---|
134 | {
|
---|
135 | GET_PACKER_CONTEXT(pc);
|
---|
136 | unsigned char *data_ptr;
|
---|
137 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value);
|
---|
138 |
|
---|
139 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
140 | WRITE_DATA_AI(int, packet_length);
|
---|
141 | WRITE_DATA_AI(GLenum, CR_UNIFORM2IV_EXTEND_OPCODE);
|
---|
142 | WRITE_DATA_AI(GLint, location);
|
---|
143 | WRITE_DATA_AI(GLsizei, count);
|
---|
144 | crMemcpy(data_ptr, value, 2*count*sizeof(*value));
|
---|
145 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
146 | }
|
---|
147 |
|
---|
148 | void PACK_APIENTRY crPackUniform3fv(GLint location, GLsizei count, const GLfloat *value)
|
---|
149 | {
|
---|
150 | GET_PACKER_CONTEXT(pc);
|
---|
151 | unsigned char *data_ptr;
|
---|
152 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value);
|
---|
153 |
|
---|
154 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
155 | WRITE_DATA_AI(int, packet_length);
|
---|
156 | WRITE_DATA_AI(GLenum, CR_UNIFORM3FV_EXTEND_OPCODE);
|
---|
157 | WRITE_DATA_AI(GLint, location);
|
---|
158 | WRITE_DATA_AI(GLsizei, count);
|
---|
159 | crMemcpy(data_ptr, value, 3*count*sizeof(*value));
|
---|
160 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
161 | }
|
---|
162 |
|
---|
163 | void PACK_APIENTRY crPackUniform3iv(GLint location, GLsizei count, const GLint *value)
|
---|
164 | {
|
---|
165 | GET_PACKER_CONTEXT(pc);
|
---|
166 | unsigned char *data_ptr;
|
---|
167 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value);
|
---|
168 |
|
---|
169 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
170 | WRITE_DATA_AI(int, packet_length);
|
---|
171 | WRITE_DATA_AI(GLenum, CR_UNIFORM3IV_EXTEND_OPCODE);
|
---|
172 | WRITE_DATA_AI(GLint, location);
|
---|
173 | WRITE_DATA_AI(GLsizei, count);
|
---|
174 | crMemcpy(data_ptr, value, 3*count*sizeof(*value));
|
---|
175 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
176 | }
|
---|
177 |
|
---|
178 | void PACK_APIENTRY crPackUniform4fv(GLint location, GLsizei count, const GLfloat *value)
|
---|
179 | {
|
---|
180 | GET_PACKER_CONTEXT(pc);
|
---|
181 | unsigned char *data_ptr;
|
---|
182 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value);
|
---|
183 |
|
---|
184 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
185 | WRITE_DATA_AI(int, packet_length);
|
---|
186 | WRITE_DATA_AI(GLenum, CR_UNIFORM4FV_EXTEND_OPCODE);
|
---|
187 | WRITE_DATA_AI(GLint, location);
|
---|
188 | WRITE_DATA_AI(GLsizei, count);
|
---|
189 | crMemcpy(data_ptr, value, 4*count*sizeof(*value));
|
---|
190 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
191 | }
|
---|
192 |
|
---|
193 | void PACK_APIENTRY crPackUniform4iv(GLint location, GLsizei count, const GLint *value)
|
---|
194 | {
|
---|
195 | GET_PACKER_CONTEXT(pc);
|
---|
196 | unsigned char *data_ptr;
|
---|
197 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value);
|
---|
198 |
|
---|
199 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
200 | WRITE_DATA_AI(int, packet_length);
|
---|
201 | WRITE_DATA_AI(GLenum, CR_UNIFORM4IV_EXTEND_OPCODE);
|
---|
202 | WRITE_DATA_AI(GLint, location);
|
---|
203 | WRITE_DATA_AI(GLsizei, count);
|
---|
204 | crMemcpy(data_ptr, value, 4*count*sizeof(*value));
|
---|
205 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
206 | }
|
---|
207 |
|
---|
208 | void PACK_APIENTRY crPackUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
209 | {
|
---|
210 | GET_PACKER_CONTEXT(pc);
|
---|
211 | unsigned char *data_ptr;
|
---|
212 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 2*2*count*sizeof(*value);
|
---|
213 |
|
---|
214 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
215 | WRITE_DATA_AI(int, packet_length);
|
---|
216 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2FV_EXTEND_OPCODE);
|
---|
217 | WRITE_DATA_AI(GLint, location);
|
---|
218 | WRITE_DATA_AI(GLsizei, count);
|
---|
219 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
220 | crMemcpy(data_ptr, value, 2*2*count*sizeof(*value));
|
---|
221 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
222 | }
|
---|
223 |
|
---|
224 | void PACK_APIENTRY crPackUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
225 | {
|
---|
226 | GET_PACKER_CONTEXT(pc);
|
---|
227 | unsigned char *data_ptr;
|
---|
228 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 3*3*count*sizeof(*value);
|
---|
229 |
|
---|
230 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
231 | WRITE_DATA_AI(int, packet_length);
|
---|
232 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3FV_EXTEND_OPCODE);
|
---|
233 | WRITE_DATA_AI(GLint, location);
|
---|
234 | WRITE_DATA_AI(GLsizei, count);
|
---|
235 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
236 | crMemcpy(data_ptr, value, 3*3*count*sizeof(*value));
|
---|
237 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
238 | }
|
---|
239 |
|
---|
240 | void PACK_APIENTRY crPackUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
241 | {
|
---|
242 | GET_PACKER_CONTEXT(pc);
|
---|
243 | unsigned char *data_ptr;
|
---|
244 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 4*4*count*sizeof(*value);
|
---|
245 |
|
---|
246 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
247 | WRITE_DATA_AI(int, packet_length);
|
---|
248 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4FV_EXTEND_OPCODE);
|
---|
249 | WRITE_DATA_AI(GLint, location);
|
---|
250 | WRITE_DATA_AI(GLsizei, count);
|
---|
251 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
252 | crMemcpy(data_ptr, value, 4*4*count*sizeof(*value));
|
---|
253 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
254 | }
|
---|
255 |
|
---|
256 | void PACK_APIENTRY crPackUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
257 | {
|
---|
258 | GET_PACKER_CONTEXT(pc);
|
---|
259 | unsigned char *data_ptr;
|
---|
260 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
|
---|
261 | + 2*3*count*sizeof(*value);
|
---|
262 |
|
---|
263 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
264 | WRITE_DATA_AI(int, packet_length);
|
---|
265 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2X3FV_EXTEND_OPCODE);
|
---|
266 | WRITE_DATA_AI(GLint, location);
|
---|
267 | WRITE_DATA_AI(GLsizei, count);
|
---|
268 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
269 | crMemcpy(data_ptr, value, 2*3*count*sizeof(*value));
|
---|
270 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
271 | }
|
---|
272 |
|
---|
273 | void PACK_APIENTRY crPackUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
274 | {
|
---|
275 | GET_PACKER_CONTEXT(pc);
|
---|
276 | unsigned char *data_ptr;
|
---|
277 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
|
---|
278 | + 3*2*count*sizeof(*value);
|
---|
279 |
|
---|
280 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
281 | WRITE_DATA_AI(int, packet_length);
|
---|
282 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3X2FV_EXTEND_OPCODE);
|
---|
283 | WRITE_DATA_AI(GLint, location);
|
---|
284 | WRITE_DATA_AI(GLsizei, count);
|
---|
285 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
286 | crMemcpy(data_ptr, value, 3*2*count*sizeof(*value));
|
---|
287 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
288 | }
|
---|
289 |
|
---|
290 | void PACK_APIENTRY crPackUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
291 | {
|
---|
292 | GET_PACKER_CONTEXT(pc);
|
---|
293 | unsigned char *data_ptr;
|
---|
294 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
|
---|
295 | + 2*4*count*sizeof(*value);
|
---|
296 |
|
---|
297 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
298 | WRITE_DATA_AI(int, packet_length);
|
---|
299 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2X4FV_EXTEND_OPCODE);
|
---|
300 | WRITE_DATA_AI(GLint, location);
|
---|
301 | WRITE_DATA_AI(GLsizei, count);
|
---|
302 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
303 | crMemcpy(data_ptr, value, 2*4*count*sizeof(*value));
|
---|
304 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
305 | }
|
---|
306 |
|
---|
307 | void PACK_APIENTRY crPackUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
308 | {
|
---|
309 | GET_PACKER_CONTEXT(pc);
|
---|
310 | unsigned char *data_ptr;
|
---|
311 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
|
---|
312 | + 4*2*count*sizeof(*value);
|
---|
313 |
|
---|
314 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
315 | WRITE_DATA_AI(int, packet_length);
|
---|
316 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4X2FV_EXTEND_OPCODE);
|
---|
317 | WRITE_DATA_AI(GLint, location);
|
---|
318 | WRITE_DATA_AI(GLsizei, count);
|
---|
319 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
320 | crMemcpy(data_ptr, value, 4*2*count*sizeof(*value));
|
---|
321 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
322 | }
|
---|
323 |
|
---|
324 | void PACK_APIENTRY crPackUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
325 | {
|
---|
326 | GET_PACKER_CONTEXT(pc);
|
---|
327 | unsigned char *data_ptr;
|
---|
328 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
|
---|
329 | + 3*4*count*sizeof(*value);
|
---|
330 |
|
---|
331 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
332 | WRITE_DATA_AI(int, packet_length);
|
---|
333 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3X4FV_EXTEND_OPCODE);
|
---|
334 | WRITE_DATA_AI(GLint, location);
|
---|
335 | WRITE_DATA_AI(GLsizei, count);
|
---|
336 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
337 | crMemcpy(data_ptr, value, 3*4*count*sizeof(*value));
|
---|
338 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
339 | }
|
---|
340 |
|
---|
341 | void PACK_APIENTRY crPackUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
342 | {
|
---|
343 | GET_PACKER_CONTEXT(pc);
|
---|
344 | unsigned char *data_ptr;
|
---|
345 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
|
---|
346 | + 4*3*count*sizeof(*value);
|
---|
347 |
|
---|
348 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
349 | WRITE_DATA_AI(int, packet_length);
|
---|
350 | WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4X3FV_EXTEND_OPCODE);
|
---|
351 | WRITE_DATA_AI(GLint, location);
|
---|
352 | WRITE_DATA_AI(GLsizei, count);
|
---|
353 | WRITE_DATA_AI(GLboolean, transpose);
|
---|
354 | crMemcpy(data_ptr, value, 4*3*count*sizeof(*value));
|
---|
355 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
356 | }
|
---|
357 |
|
---|
358 | void PACK_APIENTRY crPackDrawBuffers(GLsizei n, const GLenum *bufs)
|
---|
359 | {
|
---|
360 | GET_PACKER_CONTEXT(pc);
|
---|
361 | unsigned char *data_ptr;
|
---|
362 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(n) + n*sizeof(*bufs);
|
---|
363 |
|
---|
364 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
365 | WRITE_DATA_AI(int, packet_length);
|
---|
366 | WRITE_DATA_AI(GLenum, CR_DRAWBUFFERS_EXTEND_OPCODE);
|
---|
367 | WRITE_DATA_AI(GLsizei, n);
|
---|
368 | crMemcpy(data_ptr, bufs, n*sizeof(*bufs));
|
---|
369 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
370 | }
|
---|
371 |
|
---|
372 | /*@todo next 8 functions are bit hacky,
|
---|
373 | * we expect packspu to pass a single structure with all output parameters via first output pointer.
|
---|
374 | * it'd be better to add CRMessageMultiReadback one day.
|
---|
375 | */
|
---|
376 | void PACK_APIENTRY crPackGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
|
---|
377 | {
|
---|
378 | GET_PACKER_CONTEXT(pc);
|
---|
379 | unsigned char *data_ptr;
|
---|
380 | (void) pc;
|
---|
381 | (void) size;
|
---|
382 | (void) type;
|
---|
383 | (void) name;
|
---|
384 | GET_BUFFERED_POINTER(pc, 36);
|
---|
385 | WRITE_DATA(0, GLint, 36);
|
---|
386 | WRITE_DATA(4, GLenum, CR_GETACTIVEATTRIB_EXTEND_OPCODE);
|
---|
387 | WRITE_DATA(8, GLuint, program);
|
---|
388 | WRITE_DATA(12, GLuint, index);
|
---|
389 | WRITE_DATA(16, GLsizei, bufSize);
|
---|
390 | WRITE_NETWORK_POINTER(20, (void *) length);
|
---|
391 | WRITE_NETWORK_POINTER(28, (void *) writeback);
|
---|
392 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
393 | }
|
---|
394 |
|
---|
395 | void PACK_APIENTRY crPackGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
|
---|
396 | {
|
---|
397 | GET_PACKER_CONTEXT(pc);
|
---|
398 | unsigned char *data_ptr;
|
---|
399 | (void) pc;
|
---|
400 | (void) size;
|
---|
401 | (void) type;
|
---|
402 | (void) name;
|
---|
403 | GET_BUFFERED_POINTER(pc, 36);
|
---|
404 | WRITE_DATA(0, GLint, 36);
|
---|
405 | WRITE_DATA(4, GLenum, CR_GETACTIVEUNIFORM_EXTEND_OPCODE);
|
---|
406 | WRITE_DATA(8, GLuint, program);
|
---|
407 | WRITE_DATA(12, GLuint, index);
|
---|
408 | WRITE_DATA(16, GLsizei, bufSize);
|
---|
409 | WRITE_NETWORK_POINTER(20, (void *) length);
|
---|
410 | WRITE_NETWORK_POINTER(28, (void *) writeback);
|
---|
411 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
412 | }
|
---|
413 |
|
---|
414 | void PACK_APIENTRY crPackGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders, int * writeback)
|
---|
415 | {
|
---|
416 | GET_PACKER_CONTEXT(pc);
|
---|
417 | unsigned char *data_ptr;
|
---|
418 | (void) pc;
|
---|
419 | (void) shaders;
|
---|
420 | GET_BUFFERED_POINTER(pc, 32);
|
---|
421 | WRITE_DATA(0, GLint, 32);
|
---|
422 | WRITE_DATA(4, GLenum, CR_GETATTACHEDSHADERS_EXTEND_OPCODE);
|
---|
423 | WRITE_DATA(8, GLuint, program);
|
---|
424 | WRITE_DATA(12, GLsizei, maxCount);
|
---|
425 | WRITE_NETWORK_POINTER(16, (void *) count);
|
---|
426 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
427 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
428 | }
|
---|
429 |
|
---|
430 | void PACK_APIENTRY crPackGetAttachedObjectsARB(GLhandleARB containerObj, GLsizei maxCount, GLsizei * count, GLhandleARB * obj, int * writeback)
|
---|
431 | {
|
---|
432 | GET_PACKER_CONTEXT(pc);
|
---|
433 | unsigned char *data_ptr;
|
---|
434 | (void) pc;
|
---|
435 | GET_BUFFERED_POINTER(pc, 32);
|
---|
436 | WRITE_DATA(0, GLint, 32);
|
---|
437 | WRITE_DATA(4, GLenum, CR_GETATTACHEDOBJECTSARB_EXTEND_OPCODE);
|
---|
438 | WRITE_DATA(8, GLhandleARB, containerObj);
|
---|
439 | WRITE_DATA(12, GLsizei, maxCount);
|
---|
440 | WRITE_NETWORK_POINTER(16, (void *) count);
|
---|
441 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
442 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
443 | }
|
---|
444 |
|
---|
445 | void PACK_APIENTRY crPackGetInfoLogARB(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog, int * writeback)
|
---|
446 | {
|
---|
447 | GET_PACKER_CONTEXT(pc);
|
---|
448 | unsigned char *data_ptr;
|
---|
449 | (void) pc;
|
---|
450 | GET_BUFFERED_POINTER(pc, 32);
|
---|
451 | WRITE_DATA(0, GLint, 32);
|
---|
452 | WRITE_DATA(4, GLenum, CR_GETINFOLOGARB_EXTEND_OPCODE);
|
---|
453 | WRITE_DATA(8, GLhandleARB, obj);
|
---|
454 | WRITE_DATA(12, GLsizei, maxLength);
|
---|
455 | WRITE_NETWORK_POINTER(16, (void *) length);
|
---|
456 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
457 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
458 | }
|
---|
459 |
|
---|
460 | void PACK_APIENTRY crPackGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
|
---|
461 | {
|
---|
462 | GET_PACKER_CONTEXT(pc);
|
---|
463 | unsigned char *data_ptr;
|
---|
464 | (void) pc;
|
---|
465 | (void) infoLog;
|
---|
466 | GET_BUFFERED_POINTER(pc, 32);
|
---|
467 | WRITE_DATA(0, GLint, 32);
|
---|
468 | WRITE_DATA(4, GLenum, CR_GETPROGRAMINFOLOG_EXTEND_OPCODE);
|
---|
469 | WRITE_DATA(8, GLuint, program);
|
---|
470 | WRITE_DATA(12, GLsizei, bufSize);
|
---|
471 | WRITE_NETWORK_POINTER(16, (void *) length);
|
---|
472 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
473 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
474 | }
|
---|
475 |
|
---|
476 | void PACK_APIENTRY crPackGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
|
---|
477 | {
|
---|
478 | GET_PACKER_CONTEXT(pc);
|
---|
479 | unsigned char *data_ptr;
|
---|
480 | (void) pc;
|
---|
481 | (void) infoLog;
|
---|
482 | GET_BUFFERED_POINTER(pc, 32);
|
---|
483 | WRITE_DATA(0, GLint, 32);
|
---|
484 | WRITE_DATA(4, GLenum, CR_GETSHADERINFOLOG_EXTEND_OPCODE);
|
---|
485 | WRITE_DATA(8, GLuint, shader);
|
---|
486 | WRITE_DATA(12, GLsizei, bufSize);
|
---|
487 | WRITE_NETWORK_POINTER(16, (void *) length);
|
---|
488 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
489 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
490 | }
|
---|
491 |
|
---|
492 | void PACK_APIENTRY crPackGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, char * source, int * writeback)
|
---|
493 | {
|
---|
494 | GET_PACKER_CONTEXT(pc);
|
---|
495 | unsigned char *data_ptr;
|
---|
496 | (void) pc;
|
---|
497 | (void) source;
|
---|
498 | GET_BUFFERED_POINTER(pc, 32);
|
---|
499 | WRITE_DATA(0, GLint, 32);
|
---|
500 | WRITE_DATA(4, GLenum, CR_GETSHADERSOURCE_EXTEND_OPCODE);
|
---|
501 | WRITE_DATA(8, GLuint, shader);
|
---|
502 | WRITE_DATA(12, GLsizei, bufSize);
|
---|
503 | WRITE_NETWORK_POINTER(16, (void *) length);
|
---|
504 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
505 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
506 | }
|
---|
507 |
|
---|
508 | void PACK_APIENTRY crPackGetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
|
---|
509 | {
|
---|
510 | GET_PACKER_CONTEXT(pc);
|
---|
511 | unsigned char *data_ptr;
|
---|
512 | (void) pData;
|
---|
513 | GET_BUFFERED_POINTER(pc, 32);
|
---|
514 | WRITE_DATA(0, GLint, 32);
|
---|
515 | WRITE_DATA(4, GLenum, CR_GETUNIFORMSLOCATIONS_EXTEND_OPCODE);
|
---|
516 | WRITE_DATA(8, GLuint, program);
|
---|
517 | WRITE_DATA(12, GLsizei, maxcbData);
|
---|
518 | WRITE_NETWORK_POINTER(16, (void *) cbData);
|
---|
519 | WRITE_NETWORK_POINTER(24, (void *) writeback);
|
---|
520 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
521 | }
|
---|
522 |
|
---|
523 | void PACK_APIENTRY crPackGetAttribLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
|
---|
524 | {
|
---|
525 | GET_PACKER_CONTEXT(pc);
|
---|
526 | unsigned char *data_ptr;
|
---|
527 | int cbName = crStrlen(name)+1;
|
---|
528 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+cbName*sizeof(*name)+16;
|
---|
529 |
|
---|
530 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
531 | WRITE_DATA_AI(int, packet_length);
|
---|
532 | WRITE_DATA_AI(GLenum, CR_GETATTRIBLOCATION_EXTEND_OPCODE);
|
---|
533 | WRITE_DATA_AI(GLuint, program);
|
---|
534 | crMemcpy(data_ptr, name, cbName*sizeof(*name));
|
---|
535 | data_ptr += cbName*sizeof(*name);
|
---|
536 | WRITE_NETWORK_POINTER(0, (void *) return_value);
|
---|
537 | WRITE_NETWORK_POINTER(8, (void *) writeback);
|
---|
538 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
539 | }
|
---|
540 |
|
---|
541 | void PACK_APIENTRY crPackGetUniformLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
|
---|
542 | {
|
---|
543 | GET_PACKER_CONTEXT(pc);
|
---|
544 | unsigned char *data_ptr;
|
---|
545 | int cbName = crStrlen(name)+1;
|
---|
546 | int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+cbName*sizeof(*name)+16;
|
---|
547 |
|
---|
548 | GET_BUFFERED_POINTER(pc, packet_length);
|
---|
549 | WRITE_DATA_AI(int, packet_length);
|
---|
550 | WRITE_DATA_AI(GLenum, CR_GETUNIFORMLOCATION_EXTEND_OPCODE);
|
---|
551 | WRITE_DATA_AI(GLuint, program);
|
---|
552 | crMemcpy(data_ptr, name, cbName*sizeof(*name));
|
---|
553 | data_ptr += cbName*sizeof(*name);
|
---|
554 | WRITE_NETWORK_POINTER(0, (void *) return_value);
|
---|
555 | WRITE_NETWORK_POINTER(8, (void *) writeback);
|
---|
556 | WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
|
---|
557 | }
|
---|
558 |
|
---|
559 | void PACK_APIENTRY crPackBindAttribLocationSWAP(GLuint program, GLuint index, const char *name)
|
---|
560 | {
|
---|
561 | GET_PACKER_CONTEXT(pc);
|
---|
562 | (void)program;
|
---|
563 | (void)index;
|
---|
564 | (void)name;
|
---|
565 | crError ("No swap version");
|
---|
566 | (void) pc;
|
---|
567 | }
|
---|
568 |
|
---|
569 | void PACK_APIENTRY crPackShaderSourceSWAP(GLuint shader, GLsizei count, const char **string, const GLint *length)
|
---|
570 | {
|
---|
571 | GET_PACKER_CONTEXT(pc);
|
---|
572 | (void)shader;
|
---|
573 | (void)count;
|
---|
574 | (void)string;
|
---|
575 | (void)length;
|
---|
576 | crError ("No swap version");
|
---|
577 | (void) pc;
|
---|
578 | }
|
---|
579 |
|
---|
580 | void PACK_APIENTRY crPackUniform1fvSWAP(GLint location, GLsizei count, const GLfloat *value)
|
---|
581 | {
|
---|
582 | GET_PACKER_CONTEXT(pc);
|
---|
583 | (void)location;
|
---|
584 | (void)count;
|
---|
585 | (void)value;
|
---|
586 | crError ("No swap version");
|
---|
587 | (void) pc;
|
---|
588 | }
|
---|
589 |
|
---|
590 |
|
---|
591 | void PACK_APIENTRY crPackUniform1ivSWAP(GLint location, GLsizei count, const GLint *value)
|
---|
592 | {
|
---|
593 | GET_PACKER_CONTEXT(pc);
|
---|
594 | (void)location;
|
---|
595 | (void)count;
|
---|
596 | (void)value;
|
---|
597 | crError ("No swap version");
|
---|
598 | (void) pc;
|
---|
599 | }
|
---|
600 |
|
---|
601 | void PACK_APIENTRY crPackUniform2fvSWAP(GLint location, GLsizei count, const GLfloat *value)
|
---|
602 | {
|
---|
603 | GET_PACKER_CONTEXT(pc);
|
---|
604 | (void)location;
|
---|
605 | (void)count;
|
---|
606 | (void)value;
|
---|
607 | crError ("No swap version");
|
---|
608 | (void) pc;
|
---|
609 | }
|
---|
610 |
|
---|
611 | void PACK_APIENTRY crPackUniform2ivSWAP(GLint location, GLsizei count, const GLint * value)
|
---|
612 | {
|
---|
613 | GET_PACKER_CONTEXT(pc);
|
---|
614 | (void)location;
|
---|
615 | (void)count;
|
---|
616 | (void)value;
|
---|
617 | crError ("No swap version");
|
---|
618 | (void) pc;
|
---|
619 | }
|
---|
620 |
|
---|
621 | void PACK_APIENTRY crPackUniform3fvSWAP(GLint location, GLsizei count, const GLfloat *value)
|
---|
622 | {
|
---|
623 | GET_PACKER_CONTEXT(pc);
|
---|
624 | (void)location;
|
---|
625 | (void)count;
|
---|
626 | (void)value;
|
---|
627 | crError ("No swap version");
|
---|
628 | (void) pc;
|
---|
629 | }
|
---|
630 |
|
---|
631 | void PACK_APIENTRY crPackUniform3ivSWAP(GLint location, GLsizei count, const GLint *value)
|
---|
632 | {
|
---|
633 | GET_PACKER_CONTEXT(pc);
|
---|
634 | (void)location;
|
---|
635 | (void)count;
|
---|
636 | (void)value;
|
---|
637 | crError ("No swap version");
|
---|
638 | (void) pc;
|
---|
639 | }
|
---|
640 |
|
---|
641 | void PACK_APIENTRY crPackUniform4fvSWAP(GLint location, GLsizei count, const GLfloat *value)
|
---|
642 | {
|
---|
643 | GET_PACKER_CONTEXT(pc);
|
---|
644 | (void)location;
|
---|
645 | (void)count;
|
---|
646 | (void)value;
|
---|
647 | crError ("No swap version");
|
---|
648 | (void) pc;
|
---|
649 | }
|
---|
650 |
|
---|
651 | void PACK_APIENTRY crPackUniform4ivSWAP(GLint location, GLsizei count, const GLint *value)
|
---|
652 | {
|
---|
653 | GET_PACKER_CONTEXT(pc);
|
---|
654 | (void)location;
|
---|
655 | (void)count;
|
---|
656 | (void)value;
|
---|
657 | crError ("No swap version");
|
---|
658 | (void) pc;
|
---|
659 | }
|
---|
660 |
|
---|
661 | void PACK_APIENTRY crPackUniformMatrix2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
662 | {
|
---|
663 | GET_PACKER_CONTEXT(pc);
|
---|
664 | (void)location;
|
---|
665 | (void)count;
|
---|
666 | (void)transpose;
|
---|
667 | (void)value;
|
---|
668 | crError ("No swap version");
|
---|
669 | (void) pc;
|
---|
670 | }
|
---|
671 |
|
---|
672 | void PACK_APIENTRY crPackUniformMatrix3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
673 | {
|
---|
674 | GET_PACKER_CONTEXT(pc);
|
---|
675 | (void)location;
|
---|
676 | (void)count;
|
---|
677 | (void)transpose;
|
---|
678 | (void)value;
|
---|
679 | crError ("No swap version");
|
---|
680 | (void) pc;
|
---|
681 | }
|
---|
682 |
|
---|
683 | void PACK_APIENTRY crPackUniformMatrix4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
684 | {
|
---|
685 | GET_PACKER_CONTEXT(pc);
|
---|
686 | (void)location;
|
---|
687 | (void)count;
|
---|
688 | (void)transpose;
|
---|
689 | (void)value;
|
---|
690 | crError ("No swap version");
|
---|
691 | (void) pc;
|
---|
692 | }
|
---|
693 |
|
---|
694 | void PACK_APIENTRY crPackUniformMatrix2x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
695 | {
|
---|
696 | GET_PACKER_CONTEXT(pc);
|
---|
697 | (void)location;
|
---|
698 | (void)count;
|
---|
699 | (void)transpose;
|
---|
700 | (void)value;
|
---|
701 | crError ("No swap version");
|
---|
702 | (void) pc;
|
---|
703 | }
|
---|
704 |
|
---|
705 | void PACK_APIENTRY crPackUniformMatrix3x2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
706 | {
|
---|
707 | GET_PACKER_CONTEXT(pc);
|
---|
708 | (void)location;
|
---|
709 | (void)count;
|
---|
710 | (void)transpose;
|
---|
711 | (void)value;
|
---|
712 | crError ("No swap version");
|
---|
713 | (void) pc;
|
---|
714 | }
|
---|
715 |
|
---|
716 | void PACK_APIENTRY crPackUniformMatrix2x4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
717 | {
|
---|
718 | GET_PACKER_CONTEXT(pc);
|
---|
719 | (void)location;
|
---|
720 | (void)count;
|
---|
721 | (void)transpose;
|
---|
722 | (void)value;
|
---|
723 | crError ("No swap version");
|
---|
724 | (void) pc;
|
---|
725 | }
|
---|
726 |
|
---|
727 | void PACK_APIENTRY crPackUniformMatrix4x2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
728 | {
|
---|
729 | GET_PACKER_CONTEXT(pc);
|
---|
730 | (void)location;
|
---|
731 | (void)count;
|
---|
732 | (void)transpose;
|
---|
733 | (void)value;
|
---|
734 | crError ("No swap version");
|
---|
735 | (void) pc;
|
---|
736 | }
|
---|
737 |
|
---|
738 | void PACK_APIENTRY crPackUniformMatrix3x4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
739 | {
|
---|
740 | GET_PACKER_CONTEXT(pc);
|
---|
741 | (void)location;
|
---|
742 | (void)count;
|
---|
743 | (void)transpose;
|
---|
744 | (void)value;
|
---|
745 | crError ("No swap version");
|
---|
746 | (void) pc;
|
---|
747 | }
|
---|
748 |
|
---|
749 | void PACK_APIENTRY crPackUniformMatrix4x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
|
---|
750 | {
|
---|
751 | GET_PACKER_CONTEXT(pc);
|
---|
752 | (void)location;
|
---|
753 | (void)count;
|
---|
754 | (void)transpose;
|
---|
755 | (void)value;
|
---|
756 | crError ("No swap version");
|
---|
757 | (void) pc;
|
---|
758 | }
|
---|
759 |
|
---|
760 | void PACK_APIENTRY crPackDrawBuffersSWAP(GLsizei n, const GLenum *bufs)
|
---|
761 | {
|
---|
762 | GET_PACKER_CONTEXT(pc);
|
---|
763 | (void)n;
|
---|
764 | (void)bufs;
|
---|
765 | crError ("No swap version");
|
---|
766 | (void) pc;
|
---|
767 | }
|
---|
768 |
|
---|
769 | void PACK_APIENTRY crPackGetAttribLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback)
|
---|
770 | {
|
---|
771 | GET_PACKER_CONTEXT(pc);
|
---|
772 | (void)program;
|
---|
773 | (void)name;
|
---|
774 | (void)return_value;
|
---|
775 | (void)writeback;
|
---|
776 | crError ("No swap version");
|
---|
777 | (void) pc;
|
---|
778 | }
|
---|
779 |
|
---|
780 | void PACK_APIENTRY crPackGetUniformLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback)
|
---|
781 | {
|
---|
782 | GET_PACKER_CONTEXT(pc);
|
---|
783 | (void)program;
|
---|
784 | (void)name;
|
---|
785 | (void)return_value;
|
---|
786 | (void)writeback;
|
---|
787 | crError ("No swap version");
|
---|
788 | (void) pc;
|
---|
789 | }
|
---|