VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_program.c@ 71903

最後變更 在這個檔案從71903是 71903,由 vboxsync 提交於 7 年 前

3D: bugref:9096, Chromium code cleanup

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 9.8 KB
 
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
14void 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
27void 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
40void 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
66void 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
92void 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
102void 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
112void 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
124void 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
132void 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
145void 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
159void 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
173void 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
187void 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
201void 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
215void 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
225void 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
235void 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
244void crUnpackExtendGetProgramStringARB(void)
245{
246}
247
248void 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
260void 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
272void 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
279void 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
287void 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
295void 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
303void 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
311void 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
319void 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
327void 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
335void 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
343void 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
351void 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
359void 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}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette