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