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 "unpacker.h"
|
---|
8 | #include "cr_error.h"
|
---|
9 | #include "cr_protocol.h"
|
---|
10 | #include "cr_mem.h"
|
---|
11 | #include "cr_version.h"
|
---|
12 |
|
---|
13 |
|
---|
14 | void crUnpackExtendProgramParameter4dvNV(void)
|
---|
15 | {
|
---|
16 | GLenum target = READ_DATA(8, GLenum);
|
---|
17 | GLuint index = READ_DATA(12, GLuint);
|
---|
18 | GLdouble params[4];
|
---|
19 | params[0] = READ_DOUBLE(16);
|
---|
20 | params[1] = READ_DOUBLE(24);
|
---|
21 | params[2] = READ_DOUBLE(32);
|
---|
22 | params[3] = READ_DOUBLE(40);
|
---|
23 | cr_unpackDispatch.ProgramParameter4dvNV(target, index, params);
|
---|
24 | }
|
---|
25 |
|
---|
26 |
|
---|
27 | void crUnpackExtendProgramParameter4fvNV(void)
|
---|
28 | {
|
---|
29 | GLenum target = READ_DATA(8, GLenum);
|
---|
30 | GLuint index = READ_DATA(12, GLuint);
|
---|
31 | GLfloat params[4];
|
---|
32 | params[0] = READ_DATA(16, GLfloat);
|
---|
33 | params[1] = READ_DATA(20, GLfloat);
|
---|
34 | params[2] = READ_DATA(24, GLfloat);
|
---|
35 | params[3] = READ_DATA(28, GLfloat);
|
---|
36 | cr_unpackDispatch.ProgramParameter4fvNV(target, index, params);
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
40 | void crUnpackExtendProgramParameters4dvNV(void)
|
---|
41 | {
|
---|
42 | GLenum target = READ_DATA(8, GLenum);
|
---|
43 | GLuint index = READ_DATA(12, GLuint);
|
---|
44 | GLuint num = READ_DATA(16, GLuint);
|
---|
45 | GLdouble *params;
|
---|
46 |
|
---|
47 | if (num >= UINT32_MAX / (4 * sizeof(GLdouble)))
|
---|
48 | {
|
---|
49 | crError("crUnpackExtendProgramParameters4dvNV: parameter 'num' is out of range");
|
---|
50 | return;
|
---|
51 | }
|
---|
52 |
|
---|
53 | params = (GLdouble *)crAlloc(num * 4 * sizeof(GLdouble));
|
---|
54 |
|
---|
55 | if (params) {
|
---|
56 | GLuint i;
|
---|
57 | for (i = 0; i < 4 * num; i++) {
|
---|
58 | params[i] = READ_DATA(20 + i * sizeof(GLdouble), GLdouble);
|
---|
59 | }
|
---|
60 | cr_unpackDispatch.ProgramParameters4dvNV(target, index, num, params);
|
---|
61 | crFree(params);
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 |
|
---|
66 | void crUnpackExtendProgramParameters4fvNV(void)
|
---|
67 | {
|
---|
68 | GLenum target = READ_DATA(8, GLenum);
|
---|
69 | GLuint index = READ_DATA(12, GLuint);
|
---|
70 | GLuint num = READ_DATA(16, GLuint);
|
---|
71 | GLfloat *params;
|
---|
72 |
|
---|
73 | if (num >= UINT32_MAX / (4 * sizeof(GLfloat)))
|
---|
74 | {
|
---|
75 | crError("crUnpackExtendProgramParameters4fvNV: parameter 'num' is out of range");
|
---|
76 | return;
|
---|
77 | }
|
---|
78 |
|
---|
79 | params = (GLfloat *)crAlloc(num * 4 * sizeof(GLfloat));
|
---|
80 |
|
---|
81 | if (params) {
|
---|
82 | GLuint i;
|
---|
83 | for (i = 0; i < 4 * num; i++) {
|
---|
84 | params[i] = READ_DATA(20 + i * sizeof(GLfloat), GLfloat);
|
---|
85 | }
|
---|
86 | cr_unpackDispatch.ProgramParameters4fvNV(target, index, num, params);
|
---|
87 | crFree(params);
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 |
|
---|
92 | void crUnpackExtendAreProgramsResidentNV(void)
|
---|
93 | {
|
---|
94 | GLsizei n = READ_DATA(8, GLsizei);
|
---|
95 | const GLuint *programs = DATA_POINTER(12, const GLuint);
|
---|
96 | SET_RETURN_PTR(12 + n * sizeof(GLuint));
|
---|
97 | SET_WRITEBACK_PTR(20 + n * sizeof(GLuint));
|
---|
98 | (void) cr_unpackDispatch.AreProgramsResidentNV(n, programs, NULL);
|
---|
99 | }
|
---|
100 |
|
---|
101 |
|
---|
102 | void crUnpackExtendLoadProgramNV(void)
|
---|
103 | {
|
---|
104 | GLenum target = READ_DATA(8, GLenum);
|
---|
105 | GLuint id = READ_DATA(12, GLuint);
|
---|
106 | GLsizei len = READ_DATA(16, GLsizei);
|
---|
107 | GLvoid *program = DATA_POINTER(20, GLvoid);
|
---|
108 | cr_unpackDispatch.LoadProgramNV(target, id, len, program);
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | void crUnpackExtendExecuteProgramNV(void)
|
---|
113 | {
|
---|
114 | GLenum target = READ_DATA(8, GLenum);
|
---|
115 | GLuint id = READ_DATA(12, GLuint);
|
---|
116 | GLfloat params[4];
|
---|
117 | params[0] = READ_DATA(16, GLfloat);
|
---|
118 | params[1] = READ_DATA(20, GLfloat);
|
---|
119 | params[2] = READ_DATA(24, GLfloat);
|
---|
120 | params[3] = READ_DATA(28, GLfloat);
|
---|
121 | cr_unpackDispatch.ExecuteProgramNV(target, id, params);
|
---|
122 | }
|
---|
123 |
|
---|
124 | void crUnpackExtendRequestResidentProgramsNV(void)
|
---|
125 | {
|
---|
126 | GLsizei n = READ_DATA(8, GLsizei);
|
---|
127 | crError("RequestResidentProgramsNV needs to be special cased!");
|
---|
128 | cr_unpackDispatch.RequestResidentProgramsNV(n, NULL);
|
---|
129 | }
|
---|
130 |
|
---|
131 |
|
---|
132 | void crUnpackExtendProgramLocalParameter4fvARB(void)
|
---|
133 | {
|
---|
134 | GLenum target = READ_DATA(8, GLenum);
|
---|
135 | GLuint index = READ_DATA(12, GLuint);
|
---|
136 | GLfloat params[4];
|
---|
137 | params[0] = READ_DATA(16, GLfloat);
|
---|
138 | params[1] = READ_DATA(20, GLfloat);
|
---|
139 | params[2] = READ_DATA(24, GLfloat);
|
---|
140 | params[3] = READ_DATA(28, GLfloat);
|
---|
141 | cr_unpackDispatch.ProgramLocalParameter4fvARB(target, index, params);
|
---|
142 | }
|
---|
143 |
|
---|
144 |
|
---|
145 | void crUnpackExtendProgramLocalParameter4dvARB(void)
|
---|
146 | {
|
---|
147 | GLenum target = READ_DATA(8, GLenum);
|
---|
148 | GLuint index = READ_DATA(12, GLuint);
|
---|
149 | GLdouble params[4];
|
---|
150 | params[0] = READ_DOUBLE(16);
|
---|
151 | params[1] = READ_DOUBLE(24);
|
---|
152 | params[2] = READ_DOUBLE(32);
|
---|
153 | params[3] = READ_DOUBLE(40);
|
---|
154 | cr_unpackDispatch.ProgramLocalParameter4dvARB(target, index, params);
|
---|
155 | }
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 | void crUnpackExtendProgramNamedParameter4dvNV(void)
|
---|
160 | {
|
---|
161 | GLuint id = READ_DATA(8, GLuint);
|
---|
162 | GLsizei len = READ_DATA(12, GLsizei);
|
---|
163 | GLdouble params[4];
|
---|
164 | GLubyte *name = crAlloc(len);
|
---|
165 | params[0] = READ_DOUBLE(16);
|
---|
166 | params[1] = READ_DOUBLE(24);
|
---|
167 | params[2] = READ_DOUBLE(32);
|
---|
168 | params[3] = READ_DOUBLE(40);
|
---|
169 | crMemcpy(name, DATA_POINTER(48, GLubyte), len);
|
---|
170 | cr_unpackDispatch.ProgramNamedParameter4dvNV(id, len, name, params);
|
---|
171 | }
|
---|
172 |
|
---|
173 | void crUnpackExtendProgramNamedParameter4dNV(void)
|
---|
174 | {
|
---|
175 | GLuint id = READ_DATA(8, GLuint);
|
---|
176 | GLsizei len = READ_DATA(12, GLsizei);
|
---|
177 | GLdouble params[4];
|
---|
178 | GLubyte *name = crAlloc (len);
|
---|
179 | params[0] = READ_DOUBLE(16);
|
---|
180 | params[1] = READ_DOUBLE(24);
|
---|
181 | params[2] = READ_DOUBLE(32);
|
---|
182 | params[3] = READ_DOUBLE(40);
|
---|
183 | crMemcpy(name, DATA_POINTER(48, GLubyte), len);
|
---|
184 | cr_unpackDispatch.ProgramNamedParameter4dNV(id, len, name, params[0], params[1], params[2], params[3]);
|
---|
185 | }
|
---|
186 |
|
---|
187 | void crUnpackExtendProgramNamedParameter4fNV(void)
|
---|
188 | {
|
---|
189 | GLenum id = READ_DATA(8, GLuint);
|
---|
190 | GLsizei len = READ_DATA(12, GLsizei);
|
---|
191 | GLfloat params[4];
|
---|
192 | GLubyte *name = crAlloc(len);
|
---|
193 | params[0] = READ_DATA(16, GLfloat);
|
---|
194 | params[1] = READ_DATA(20, GLfloat);
|
---|
195 | params[2] = READ_DATA(24, GLfloat);
|
---|
196 | params[3] = READ_DATA(28, GLfloat);
|
---|
197 | crMemcpy(name, DATA_POINTER(32, GLubyte), len);
|
---|
198 | cr_unpackDispatch.ProgramNamedParameter4fNV(id, len, name, params[0], params[1], params[2], params[3]);
|
---|
199 | }
|
---|
200 |
|
---|
201 | void crUnpackExtendProgramNamedParameter4fvNV(void)
|
---|
202 | {
|
---|
203 | GLenum id = READ_DATA(8, GLuint);
|
---|
204 | GLsizei len = READ_DATA(12, GLsizei);
|
---|
205 | GLfloat params[4];
|
---|
206 | GLubyte *name = crAlloc(len);
|
---|
207 | params[0] = READ_DATA(16, GLfloat);
|
---|
208 | params[1] = READ_DATA(20, GLfloat);
|
---|
209 | params[2] = READ_DATA(24, GLfloat);
|
---|
210 | params[3] = READ_DATA(28, GLfloat);
|
---|
211 | crMemcpy(name, DATA_POINTER(32, GLubyte), len);
|
---|
212 | cr_unpackDispatch.ProgramNamedParameter4fvNV(id, len, name, params);
|
---|
213 | }
|
---|
214 |
|
---|
215 | void crUnpackExtendGetProgramNamedParameterdvNV(void)
|
---|
216 | {
|
---|
217 | GLuint id = READ_DATA(8, GLuint);
|
---|
218 | GLsizei len = READ_DATA(12, GLsizei);
|
---|
219 | const GLubyte *name = DATA_POINTER(16, GLubyte);
|
---|
220 | SET_RETURN_PTR(16+len);
|
---|
221 | SET_WRITEBACK_PTR(16+len+8);
|
---|
222 | cr_unpackDispatch.GetProgramNamedParameterdvNV(id, len, name, NULL);
|
---|
223 | }
|
---|
224 |
|
---|
225 | void crUnpackExtendGetProgramNamedParameterfvNV(void)
|
---|
226 | {
|
---|
227 | GLuint id = READ_DATA(8, GLuint);
|
---|
228 | GLsizei len = READ_DATA(12, GLsizei);
|
---|
229 | const GLubyte *name = DATA_POINTER(16, GLubyte);
|
---|
230 | SET_RETURN_PTR(16+len);
|
---|
231 | SET_WRITEBACK_PTR(16+len+8);
|
---|
232 | cr_unpackDispatch.GetProgramNamedParameterfvNV(id, len, name, NULL);
|
---|
233 | }
|
---|
234 |
|
---|
235 | void crUnpackExtendProgramStringARB(void)
|
---|
236 | {
|
---|
237 | GLenum target = READ_DATA(8, GLenum);
|
---|
238 | GLenum format = READ_DATA(12, GLuint);
|
---|
239 | GLsizei len = READ_DATA(16, GLsizei);
|
---|
240 | GLvoid *program = DATA_POINTER(20, GLvoid);
|
---|
241 | cr_unpackDispatch.ProgramStringARB(target, format, len, program);
|
---|
242 | }
|
---|
243 |
|
---|
244 | void crUnpackExtendGetProgramStringARB(void)
|
---|
245 | {
|
---|
246 | }
|
---|
247 |
|
---|
248 | void crUnpackExtendProgramEnvParameter4dvARB(void)
|
---|
249 | {
|
---|
250 | GLenum target = READ_DATA(8, GLenum);
|
---|
251 | GLuint index = READ_DATA(12, GLuint);
|
---|
252 | GLdouble params[4];
|
---|
253 | params[0] = READ_DOUBLE(16);
|
---|
254 | params[1] = READ_DOUBLE(24);
|
---|
255 | params[2] = READ_DOUBLE(32);
|
---|
256 | params[3] = READ_DOUBLE(40);
|
---|
257 | cr_unpackDispatch.ProgramEnvParameter4dvARB(target, index, params);
|
---|
258 | }
|
---|
259 |
|
---|
260 | void crUnpackExtendProgramEnvParameter4fvARB(void)
|
---|
261 | {
|
---|
262 | GLenum target = READ_DATA(8, GLenum);
|
---|
263 | GLuint index = READ_DATA(12, GLuint);
|
---|
264 | GLfloat params[4];
|
---|
265 | params[0] = READ_DATA(16, GLfloat);
|
---|
266 | params[1] = READ_DATA(20, GLfloat);
|
---|
267 | params[2] = READ_DATA(24, GLfloat);
|
---|
268 | params[3] = READ_DATA(28, GLfloat);
|
---|
269 | cr_unpackDispatch.ProgramEnvParameter4fvARB(target, index, params);
|
---|
270 | }
|
---|
271 |
|
---|
272 | void crUnpackExtendDeleteProgramsARB(void)
|
---|
273 | {
|
---|
274 | GLsizei n = READ_DATA(8, GLsizei);
|
---|
275 | const GLuint *programs = DATA_POINTER(12, GLuint);
|
---|
276 | cr_unpackDispatch.DeleteProgramsARB(n, programs);
|
---|
277 | }
|
---|
278 |
|
---|
279 | void crUnpackVertexAttrib4NbvARB(void)
|
---|
280 | {
|
---|
281 | GLuint index = READ_DATA(0, GLuint);
|
---|
282 | const GLbyte *v = DATA_POINTER(4, const GLbyte);
|
---|
283 | cr_unpackDispatch.VertexAttrib4NbvARB(index, v);
|
---|
284 | INCR_DATA_PTR(8);
|
---|
285 | }
|
---|
286 |
|
---|
287 | void crUnpackVertexAttrib4NivARB(void)
|
---|
288 | {
|
---|
289 | GLuint index = READ_DATA(0, GLuint);
|
---|
290 | const GLint *v = DATA_POINTER(4, const GLint);
|
---|
291 | cr_unpackDispatch.VertexAttrib4NivARB(index, v);
|
---|
292 | INCR_DATA_PTR(20);
|
---|
293 | }
|
---|
294 |
|
---|
295 | void crUnpackVertexAttrib4NsvARB(void)
|
---|
296 | {
|
---|
297 | GLuint index = READ_DATA(0, GLuint);
|
---|
298 | const GLshort *v = DATA_POINTER(4, const GLshort);
|
---|
299 | cr_unpackDispatch.VertexAttrib4NsvARB(index, v);
|
---|
300 | INCR_DATA_PTR(12);
|
---|
301 | }
|
---|
302 |
|
---|
303 | void crUnpackVertexAttrib4NubvARB(void)
|
---|
304 | {
|
---|
305 | GLuint index = READ_DATA(0, GLuint);
|
---|
306 | const GLubyte *v = DATA_POINTER(4, const GLubyte);
|
---|
307 | cr_unpackDispatch.VertexAttrib4NubvARB(index, v);
|
---|
308 | INCR_DATA_PTR(8);
|
---|
309 | }
|
---|
310 |
|
---|
311 | void crUnpackVertexAttrib4NuivARB(void)
|
---|
312 | {
|
---|
313 | GLuint index = READ_DATA(0, GLuint);
|
---|
314 | const GLuint *v = DATA_POINTER(4, const GLuint);
|
---|
315 | cr_unpackDispatch.VertexAttrib4NuivARB(index, v);
|
---|
316 | INCR_DATA_PTR(20);
|
---|
317 | }
|
---|
318 |
|
---|
319 | void crUnpackVertexAttrib4NusvARB(void)
|
---|
320 | {
|
---|
321 | GLuint index = READ_DATA(0, GLuint);
|
---|
322 | const GLushort *v = DATA_POINTER(4, const GLushort);
|
---|
323 | cr_unpackDispatch.VertexAttrib4NusvARB(index, v);
|
---|
324 | INCR_DATA_PTR(12);
|
---|
325 | }
|
---|
326 |
|
---|
327 | void crUnpackVertexAttrib4bvARB(void)
|
---|
328 | {
|
---|
329 | GLuint index = READ_DATA(0, GLuint);
|
---|
330 | const GLbyte *v = DATA_POINTER(4, const GLbyte);
|
---|
331 | cr_unpackDispatch.VertexAttrib4bvARB(index, v);
|
---|
332 | INCR_DATA_PTR(8);
|
---|
333 | }
|
---|
334 |
|
---|
335 | void crUnpackVertexAttrib4ivARB(void)
|
---|
336 | {
|
---|
337 | GLuint index = READ_DATA(0, GLuint);
|
---|
338 | const GLint *v = DATA_POINTER(4, const GLint);
|
---|
339 | cr_unpackDispatch.VertexAttrib4ivARB(index, v);
|
---|
340 | INCR_DATA_PTR(20);
|
---|
341 | }
|
---|
342 |
|
---|
343 | void crUnpackVertexAttrib4ubvARB(void)
|
---|
344 | {
|
---|
345 | GLuint index = READ_DATA(0, GLuint);
|
---|
346 | const GLubyte *v = DATA_POINTER(4, const GLubyte);
|
---|
347 | cr_unpackDispatch.VertexAttrib4ubvARB(index, v);
|
---|
348 | INCR_DATA_PTR(8);
|
---|
349 | }
|
---|
350 |
|
---|
351 | void crUnpackVertexAttrib4uivARB(void)
|
---|
352 | {
|
---|
353 | GLuint index = READ_DATA(0, GLuint);
|
---|
354 | const GLuint *v = DATA_POINTER(4, const GLuint);
|
---|
355 | cr_unpackDispatch.VertexAttrib4uivARB(index, v);
|
---|
356 | INCR_DATA_PTR(20);
|
---|
357 | }
|
---|
358 |
|
---|
359 | void crUnpackVertexAttrib4usvARB(void)
|
---|
360 | {
|
---|
361 | GLuint index = READ_DATA(0, GLuint);
|
---|
362 | const GLushort *v = DATA_POINTER(4, const GLushort);
|
---|
363 | cr_unpackDispatch.VertexAttrib4usvARB(index, v);
|
---|
364 | INCR_DATA_PTR(12);
|
---|
365 | }
|
---|