VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_program.c@ 59454

最後變更 在這個檔案從59454是 52451,由 vboxsync 提交於 10 年 前

crOpenGL: command blocks flushing

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 18.0 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/*
8 * Packer functions for GL_NV_vertex_program extension.
9 * XXX: Quite a few of these functions are unfinished.
10 */
11
12
13#include "packer.h"
14#include "cr_error.h"
15
16
17void PACK_APIENTRY crPackProgramParameters4dvNV (GLenum target, GLuint index, GLuint num, const GLdouble * params)
18{
19 CR_GET_PACKER_CONTEXT(pc);
20 unsigned char *data_ptr;
21 int packet_length = sizeof(int) + sizeof(target) + sizeof(index) + sizeof(num) + num * 4 * sizeof(GLdouble);
22
23 CR_GET_BUFFERED_POINTER(pc, packet_length);
24 WRITE_DATA(0, int, packet_length);
25 WRITE_DATA(sizeof(int) + 0, GLenum, target);
26 WRITE_DATA(sizeof(int) + 4, GLuint, index);
27 WRITE_DATA(sizeof(int) + 8, GLuint, num);
28 crMemcpy(data_ptr + sizeof(int) + 12, params, num * 4 * sizeof(GLdouble));
29
30 WRITE_OPCODE(pc, CR_PROGRAMPARAMETERS4DVNV_EXTEND_OPCODE);
31 CR_UNLOCK_PACKER_CONTEXT(pc);
32}
33
34
35void PACK_APIENTRY crPackProgramParameters4fvNV (GLenum target, GLuint index, GLuint num, const GLfloat * params)
36{
37 CR_GET_PACKER_CONTEXT(pc);
38 unsigned char *data_ptr;
39 int packet_length = sizeof(int) + sizeof(target) + sizeof(index) + sizeof(num) + num * 4 * sizeof(GLfloat);
40
41 CR_GET_BUFFERED_POINTER(pc, packet_length);
42 WRITE_DATA(0, int, packet_length);
43 WRITE_DATA(sizeof(int) + 0, GLenum, target);
44 WRITE_DATA(sizeof(int) + 4, GLuint, index);
45 WRITE_DATA(sizeof(int) + 8, GLuint, num);
46 crMemcpy(data_ptr + sizeof(int) + 12, params, num * 4 * sizeof(GLfloat));
47
48 WRITE_OPCODE(pc, CR_PROGRAMPARAMETERS4FVNV_EXTEND_OPCODE);
49 CR_UNLOCK_PACKER_CONTEXT(pc);
50}
51
52
53void PACK_APIENTRY crPackVertexAttribs1dvNV( GLuint index, GLsizei n, const GLdouble *v )
54{
55 GLint i;
56 /* reverse order so we hit index 0 last (provoking glVertex) */
57 for (i = n - 1; i >= 0; i--)
58 crPackVertexAttrib1dvARB(index + i, v + i);
59}
60
61
62void PACK_APIENTRY crPackVertexAttribs1fvNV( GLuint index, GLsizei n, const GLfloat *v )
63{
64 GLint i;
65 /* reverse order so we hit index 0 last (provoking glVertex) */
66 for (i = n - 1; i >= 0; i--)
67 crPackVertexAttrib1fvARB(index + i, v + i);
68}
69
70
71void PACK_APIENTRY crPackVertexAttribs1svNV( GLuint index, GLsizei n, const GLshort *v )
72{
73 GLint i;
74 /* reverse order so we hit index 0 last (provoking glVertex) */
75 for (i = n - 1; i >= 0; i--)
76 crPackVertexAttrib1svARB(index + i, v + i);
77}
78
79
80void PACK_APIENTRY crPackVertexAttribs2dvNV( GLuint index, GLsizei n, const GLdouble *v )
81{
82 GLint i;
83 /* reverse order so we hit index 0 last (provoking glVertex) */
84 for (i = n - 1; i >= 0; i--)
85 crPackVertexAttrib2dvARB(index + i, v + 2 * i);
86}
87
88void PACK_APIENTRY crPackVertexAttribs2fvNV( GLuint index, GLsizei n, const GLfloat *v )
89{
90 GLint i;
91 /* reverse order so we hit index 0 last (provoking glVertex) */
92 for (i = n - 1; i >= 0; i--)
93 crPackVertexAttrib2fvARB(index + i, v + 2 * i);
94}
95
96void PACK_APIENTRY crPackVertexAttribs2svNV( GLuint index, GLsizei n, const GLshort *v )
97{
98 GLint i;
99 /* reverse order so we hit index 0 last (provoking glVertex) */
100 for (i = n - 1; i >= 0; i--)
101 crPackVertexAttrib2svARB(index + i, v + 2 * i);
102}
103
104void PACK_APIENTRY crPackVertexAttribs3dvNV( GLuint index, GLsizei n, const GLdouble *v )
105{
106 GLint i;
107 /* reverse order so we hit index 0 last (provoking glVertex) */
108 for (i = n - 1; i >= 0; i--)
109 crPackVertexAttrib3dvARB(index + i, v + 3 * i);
110}
111
112void PACK_APIENTRY crPackVertexAttribs3fvNV( GLuint index, GLsizei n, const GLfloat *v )
113{
114 GLint i;
115 /* reverse order so we hit index 0 last (provoking glVertex) */
116 for (i = n - 1; i >= 0; i--)
117 crPackVertexAttrib3fvARB(index + i, v + 3 * i);
118}
119
120void PACK_APIENTRY crPackVertexAttribs3svNV( GLuint index, GLsizei n, const GLshort *v )
121{
122 GLint i;
123 /* reverse order so we hit index 0 last (provoking glVertex) */
124 for (i = n - 1; i >= 0; i--)
125 crPackVertexAttrib3svARB(index + i, v + 3 * i);
126}
127
128void PACK_APIENTRY crPackVertexAttribs4dvNV( GLuint index, GLsizei n, const GLdouble *v )
129{
130 GLint i;
131 /* reverse order so we hit index 0 last (provoking glVertex) */
132 for (i = n - 1; i >= 0; i--)
133 crPackVertexAttrib4dvARB(index + i, v + 4 * i);
134}
135
136void PACK_APIENTRY crPackVertexAttribs4fvNV( GLuint index, GLsizei n, const GLfloat *v )
137{
138 GLint i;
139 /* reverse order so we hit index 0 last (provoking glVertex) */
140 for (i = n - 1; i >= 0; i--)
141 crPackVertexAttrib4fvARB(index + i, v + 4 * i);
142}
143
144void PACK_APIENTRY crPackVertexAttribs4svNV( GLuint index, GLsizei n, const GLshort *v )
145{
146 GLint i;
147 /* reverse order so we hit index 0 last (provoking glVertex) */
148 for (i = n - 1; i >= 0; i--)
149 crPackVertexAttrib4svARB(index + i, v + 4 * i);
150}
151
152void PACK_APIENTRY crPackVertexAttribs4ubvNV( GLuint index, GLsizei n, const GLubyte *v )
153{
154 GLint i;
155 /* reverse order so we hit index 0 last (provoking glVertex) */
156 for (i = n - 1; i >= 0; i--)
157 crPackVertexAttrib4ubvARB(index + i, v + 4 * i);
158}
159
160
161void PACK_APIENTRY crPackExecuteProgramNV( GLenum target, GLuint id, const GLfloat *params )
162{
163 const int packet_length = 32;
164 unsigned char *data_ptr;
165 CR_GET_PACKER_CONTEXT(pc);
166
167 CR_GET_BUFFERED_POINTER(pc, packet_length);
168 WRITE_DATA(0, int, packet_length);
169 WRITE_DATA(4, GLenum, CR_EXECUTEPROGRAMNV_EXTEND_OPCODE);
170 WRITE_DATA(8, GLenum, target);
171 WRITE_DATA(12, GLuint, id);
172 WRITE_DATA(16, GLfloat, params[0] );
173 WRITE_DATA(20, GLfloat, params[1] );
174 WRITE_DATA(24, GLfloat, params[2] );
175 WRITE_DATA(28, GLfloat, params[3] );
176 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
177 CR_UNLOCK_PACKER_CONTEXT(pc);
178}
179
180void PACK_APIENTRY crPackLoadProgramNV( GLenum target, GLuint id, GLsizei len, const GLubyte *program )
181{
182 const int packet_length = 20 + len;
183 unsigned char *data_ptr;
184 CR_GET_PACKER_CONTEXT(pc);
185
186 CR_GET_BUFFERED_POINTER(pc, packet_length);
187 WRITE_DATA(0, int, packet_length);
188 WRITE_DATA(4, GLenum, CR_LOADPROGRAMNV_EXTEND_OPCODE);
189 WRITE_DATA(8, GLenum, target);
190 WRITE_DATA(12, GLuint, id);
191 WRITE_DATA(16, GLsizei, len );
192 crMemcpy( (void *) (data_ptr + 20), program, len );
193 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
194 CR_UNLOCK_PACKER_CONTEXT(pc);
195}
196
197void PACK_APIENTRY crPackRequestResidentProgramsNV( GLsizei n, const GLuint *ids )
198{
199 CR_GET_PACKER_CONTEXT(pc);
200 (void) pc;
201 (void) n;
202 (void) ids;
203 /* We're no-op'ing this function for now. */
204}
205
206
207void PACK_APIENTRY crPackProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
208{
209 CR_GET_PACKER_CONTEXT(pc);
210 unsigned char *data_ptr;
211 int packet_length = 32 + len;
212
213 CR_GET_BUFFERED_POINTER(pc, packet_length);
214 WRITE_DATA(0, GLint, packet_length);
215 WRITE_DATA(4, GLenum, CR_PROGRAMNAMEDPARAMETER4FNV_EXTEND_OPCODE);
216 WRITE_DATA(8, GLuint, id);
217 WRITE_DATA(12, GLsizei, len);
218 WRITE_DATA(16, GLfloat, x);
219 WRITE_DATA(20, GLfloat, y);
220 WRITE_DATA(24, GLfloat, z);
221 WRITE_DATA(28, GLfloat, w);
222 crMemcpy( (void *) (data_ptr + 32), name, len );
223 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
224 CR_UNLOCK_PACKER_CONTEXT(pc);
225}
226
227void PACK_APIENTRY crPackProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
228{
229 CR_GET_PACKER_CONTEXT(pc);
230 unsigned char *data_ptr;
231 int packet_length = 48 + len;
232
233 CR_GET_BUFFERED_POINTER(pc, packet_length);
234 WRITE_DATA(0, GLint, packet_length);
235 WRITE_DATA(4, GLenum, CR_PROGRAMNAMEDPARAMETER4DNV_EXTEND_OPCODE);
236 WRITE_DATA(8, GLenum, id);
237 WRITE_DATA(12, GLuint, len);
238 WRITE_DOUBLE(16, x);
239 WRITE_DOUBLE(24, y);
240 WRITE_DOUBLE(32, z);
241 WRITE_DOUBLE(40, w);
242 crMemcpy( (void *) (data_ptr + 48), name, len );
243
244 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
245 CR_UNLOCK_PACKER_CONTEXT(pc);
246}
247
248void PACK_APIENTRY crPackProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v)
249{
250 crPackProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
251}
252
253void PACK_APIENTRY crPackProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v)
254{
255 crPackProgramNamedParameter4dNV(id, len, name, v[0], v[1], v[2], v[3]);
256}
257
258
259void PACK_APIENTRY
260crPackAreProgramsResidentNV(GLsizei n, const GLuint * programs,
261 GLboolean *residences, GLboolean *return_val,
262 int *writeback)
263{
264 CR_GET_PACKER_CONTEXT(pc);
265 unsigned char *data_ptr;
266 int packet_length;
267
268 (void) return_val; /* Caller must compute this from residences!!! */
269
270 packet_length = sizeof(int) + /* packet length */
271 sizeof(GLenum) + /* extend opcode */
272 sizeof(n) + /* num programs */
273 n * sizeof(*programs) + /* programs */
274 8 + 8;
275
276 CR_GET_BUFFERED_POINTER(pc, packet_length);
277 WRITE_DATA(0, int, packet_length);
278 WRITE_DATA(4, GLenum, CR_AREPROGRAMSRESIDENTNV_EXTEND_OPCODE);
279 WRITE_DATA(8, GLsizei, n);
280 crMemcpy(data_ptr + 12, programs, n * sizeof(*programs));
281 WRITE_NETWORK_POINTER(12 + n * sizeof(*programs), (void *) residences);
282 WRITE_NETWORK_POINTER(20 + n * sizeof(*programs), (void *) writeback);
283 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
284 CR_CMDBLOCK_CHECK_FLUSH(pc);
285 CR_UNLOCK_PACKER_CONTEXT(pc);
286}
287
288
289void PACK_APIENTRY crPackGetProgramNamedParameterfvNV( GLuint id, GLsizei len, const GLubyte *name, GLfloat *params, int *writeback )
290{
291 int packet_length = 32 + len;
292 CR_GET_PACKER_CONTEXT(pc);
293 unsigned char *data_ptr;
294 CR_GET_BUFFERED_POINTER( pc, packet_length );
295 WRITE_DATA( 0, GLint, packet_length );
296 WRITE_DATA( 4, GLenum, CR_GETPROGRAMNAMEDPARAMETERFVNV_EXTEND_OPCODE );
297 WRITE_DATA( 8, GLuint, id );
298 WRITE_DATA( 12, GLsizei, len );
299 crMemcpy(data_ptr + 16, name, len);
300 WRITE_NETWORK_POINTER( 16 + len, (void *) params );
301 WRITE_NETWORK_POINTER( 16 + len + 8, (void *) writeback );
302 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
303 CR_CMDBLOCK_CHECK_FLUSH(pc);
304 CR_UNLOCK_PACKER_CONTEXT(pc);
305}
306
307void PACK_APIENTRY crPackGetProgramNamedParameterdvNV( GLuint id, GLsizei len, const GLubyte *name, GLdouble *params, int *writeback )
308{
309 int packet_length = 32 + len;
310 CR_GET_PACKER_CONTEXT(pc);
311 unsigned char *data_ptr;
312 CR_GET_BUFFERED_POINTER( pc, packet_length );
313 WRITE_DATA( 0, GLint, packet_length );
314 WRITE_DATA( 4, GLenum, CR_GETPROGRAMNAMEDPARAMETERDVNV_EXTEND_OPCODE );
315 WRITE_DATA( 8, GLuint, id );
316 WRITE_DATA( 12, GLsizei, len );
317 crMemcpy(data_ptr + 16, name, len);
318 WRITE_NETWORK_POINTER( 16 + len, (void *) params );
319 WRITE_NETWORK_POINTER( 16 + len + 8, (void *) writeback );
320 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
321 CR_CMDBLOCK_CHECK_FLUSH(pc);
322 CR_UNLOCK_PACKER_CONTEXT(pc);
323}
324
325
326void PACK_APIENTRY crPackDeleteProgramsARB( GLsizei n, const GLuint *ids )
327{
328 unsigned char *data_ptr;
329 int packet_length = sizeof(GLenum) + sizeof(n) + n * sizeof(*ids);
330
331 if (!ids)
332 return;
333
334 data_ptr = (unsigned char *) crPackAlloc(packet_length);
335 WRITE_DATA( 0, GLenum, CR_DELETEPROGRAMSARB_EXTEND_OPCODE );
336 WRITE_DATA( 4, GLsizei, n );
337 crMemcpy( data_ptr + 8, ids, n * sizeof(*ids) );
338 crHugePacket( CR_EXTEND_OPCODE, data_ptr );
339 crPackFree( data_ptr );
340}
341
342
343void PACK_APIENTRY crPackProgramStringARB( GLenum target, GLenum format, GLsizei len, const void *string )
344{
345 const int packet_length = 20 + len;
346 unsigned char *data_ptr;
347 CR_GET_PACKER_CONTEXT(pc);
348
349 CR_GET_BUFFERED_POINTER(pc, packet_length);
350 WRITE_DATA(0, int, packet_length);
351 WRITE_DATA(4, GLenum, CR_PROGRAMSTRINGARB_EXTEND_OPCODE);
352 WRITE_DATA(8, GLenum, target);
353 WRITE_DATA(12, GLuint, format);
354 WRITE_DATA(16, GLsizei, len );
355 crMemcpy( (void *) (data_ptr + 20), string, len );
356 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
357 CR_UNLOCK_PACKER_CONTEXT(pc);
358}
359
360
361/*
362 * Can't easily auto-generate these functions since there aren't
363 * non-vector versions.
364 */
365
366void PACK_APIENTRY crPackVertexAttrib4NbvARB( GLuint index, const GLbyte *v )
367{
368 CR_GET_PACKER_CONTEXT(pc);
369 unsigned char *data_ptr;
370 CR_GET_BUFFERED_POINTER( pc, 8 );
371 pc->current.c.vertexAttrib.b4[index] = data_ptr + 4;
372 pc->current.attribsUsedMask |= (1 << index);
373 WRITE_DATA( 0, GLuint, index );
374 WRITE_DATA( 4, GLbyte, v[0] );
375 WRITE_DATA( 5, GLbyte, v[1] );
376 WRITE_DATA( 6, GLbyte, v[2] );
377 WRITE_DATA( 7, GLbyte, v[3] );
378 WRITE_OPCODE( pc, CR_VERTEXATTRIB4NBVARB_OPCODE );
379 CR_UNLOCK_PACKER_CONTEXT(pc);
380}
381
382void PACK_APIENTRY crPackVertexAttrib4NivARB( GLuint index, const GLint *v )
383{
384 CR_GET_PACKER_CONTEXT(pc);
385 unsigned char *data_ptr;
386 CR_GET_BUFFERED_POINTER( pc, 20 );
387 pc->current.c.vertexAttrib.i4[index] = data_ptr + 4;
388 pc->current.attribsUsedMask |= (1 << index);
389 WRITE_DATA( 0, GLuint, index );
390 WRITE_DATA( 4, GLint, v[0] );
391 WRITE_DATA( 8, GLint, v[1] );
392 WRITE_DATA( 12, GLint, v[2] );
393 WRITE_DATA( 16, GLint, v[3] );
394 WRITE_OPCODE( pc, CR_VERTEXATTRIB4NIVARB_OPCODE );
395 CR_UNLOCK_PACKER_CONTEXT(pc);
396}
397
398void PACK_APIENTRY crPackVertexAttrib4NsvARB( GLuint index, const GLshort *v )
399{
400 CR_GET_PACKER_CONTEXT(pc);
401 unsigned char *data_ptr;
402 CR_GET_BUFFERED_POINTER( pc, 12 );
403 pc->current.c.vertexAttrib.s4[index] = data_ptr + 4;
404 pc->current.attribsUsedMask |= (1 << index);
405 WRITE_DATA( 0, GLuint, index );
406 WRITE_DATA( 4, GLshort, v[0] );
407 WRITE_DATA( 6, GLshort, v[1] );
408 WRITE_DATA( 8, GLshort, v[2] );
409 WRITE_DATA( 10, GLshort, v[3] );
410 WRITE_OPCODE( pc, CR_VERTEXATTRIB4NSVARB_OPCODE );
411 CR_UNLOCK_PACKER_CONTEXT(pc);
412}
413
414void PACK_APIENTRY crPackVertexAttrib4NubvARB(GLuint index, const GLubyte * v)
415{
416 CR_GET_PACKER_CONTEXT(pc);
417 unsigned char *data_ptr;
418 CR_GET_BUFFERED_POINTER( pc, 8 );
419 pc->current.c.vertexAttrib.ub4[index] = data_ptr + 4;
420 pc->current.attribsUsedMask |= (1 << index);
421 WRITE_DATA( 0, GLuint, index );
422 WRITE_DATA( 4, GLubyte, v[0] );
423 WRITE_DATA( 5, GLubyte, v[1] );
424 WRITE_DATA( 6, GLubyte, v[2] );
425 WRITE_DATA( 7, GLubyte, v[3] );
426 WRITE_OPCODE( pc, CR_VERTEXATTRIB4NUBVARB_OPCODE );
427 CR_UNLOCK_PACKER_CONTEXT(pc);
428}
429
430void PACK_APIENTRY crPackVertexAttrib4NuivARB(GLuint index, const GLuint * v)
431{
432 CR_GET_PACKER_CONTEXT(pc);
433 unsigned char *data_ptr;
434 CR_GET_BUFFERED_POINTER( pc, 20 );
435 pc->current.c.vertexAttrib.ui4[index] = data_ptr + 4;
436 pc->current.attribsUsedMask |= (1 << index);
437 WRITE_DATA( 0, GLuint, index );
438 WRITE_DATA( 4, GLuint, v[0] );
439 WRITE_DATA( 8, GLuint, v[1] );
440 WRITE_DATA( 12, GLuint, v[2] );
441 WRITE_DATA( 16, GLuint, v[3] );
442 WRITE_OPCODE( pc, CR_VERTEXATTRIB4NUIVARB_OPCODE );
443 CR_UNLOCK_PACKER_CONTEXT(pc);
444}
445
446void PACK_APIENTRY crPackVertexAttrib4NusvARB(GLuint index, const GLushort * v)
447{
448 CR_GET_PACKER_CONTEXT(pc);
449 unsigned char *data_ptr;
450 CR_GET_BUFFERED_POINTER( pc, 12 );
451 pc->current.c.vertexAttrib.s4[index] = data_ptr + 4;
452 pc->current.attribsUsedMask |= (1 << index);
453 WRITE_DATA( 0, GLuint, index );
454 WRITE_DATA( 4, GLushort, v[0] );
455 WRITE_DATA( 6, GLushort, v[1] );
456 WRITE_DATA( 8, GLushort, v[2] );
457 WRITE_DATA( 10, GLushort, v[3] );
458 WRITE_OPCODE( pc, CR_VERTEXATTRIB4NUSVARB_OPCODE );
459 CR_UNLOCK_PACKER_CONTEXT(pc);
460}
461
462void PACK_APIENTRY crPackVertexAttrib4bvARB(GLuint index, const GLbyte * v)
463{
464 CR_GET_PACKER_CONTEXT(pc);
465 unsigned char *data_ptr;
466 CR_GET_BUFFERED_POINTER( pc, 8 );
467 pc->current.c.vertexAttrib.b4[index] = data_ptr + 4;
468 pc->current.attribsUsedMask |= (1 << index);
469 WRITE_DATA( 0, GLuint, index );
470 WRITE_DATA( 4, GLbyte, v[0] );
471 WRITE_DATA( 5, GLbyte, v[1] );
472 WRITE_DATA( 6, GLbyte, v[2] );
473 WRITE_DATA( 7, GLbyte, v[3] );
474 WRITE_OPCODE( pc, CR_VERTEXATTRIB4BVARB_OPCODE );
475 CR_UNLOCK_PACKER_CONTEXT(pc);
476}
477
478void PACK_APIENTRY crPackVertexAttrib4ivARB(GLuint index, const GLint * v)
479{
480 CR_GET_PACKER_CONTEXT(pc);
481 unsigned char *data_ptr;
482 CR_GET_BUFFERED_POINTER( pc, 20 );
483 pc->current.c.vertexAttrib.i4[index] = data_ptr + 4;
484 pc->current.attribsUsedMask |= (1 << index);
485 WRITE_DATA( 0, GLuint, index );
486 WRITE_DATA( 4, GLint, v[0] );
487 WRITE_DATA( 8, GLint, v[1] );
488 WRITE_DATA( 12, GLint, v[2] );
489 WRITE_DATA( 16, GLint, v[3] );
490 WRITE_OPCODE( pc, CR_VERTEXATTRIB4IVARB_OPCODE );
491 CR_UNLOCK_PACKER_CONTEXT(pc);
492}
493
494void PACK_APIENTRY crPackVertexAttrib4uivARB(GLuint index, const GLuint * v)
495{
496 CR_GET_PACKER_CONTEXT(pc);
497 unsigned char *data_ptr;
498 CR_GET_BUFFERED_POINTER( pc, 20 );
499 pc->current.c.vertexAttrib.ui4[index] = data_ptr + 4;
500 pc->current.attribsUsedMask |= (1 << index);
501 WRITE_DATA( 0, GLuint, index );
502 WRITE_DATA( 4, GLuint, v[0] );
503 WRITE_DATA( 8, GLuint, v[1] );
504 WRITE_DATA( 12, GLuint, v[2] );
505 WRITE_DATA( 16, GLuint, v[3] );
506 WRITE_OPCODE( pc, CR_VERTEXATTRIB4UIVARB_OPCODE );
507 CR_UNLOCK_PACKER_CONTEXT(pc);
508}
509
510void PACK_APIENTRY crPackVertexAttrib4usvARB(GLuint index, const GLushort * v)
511{
512 CR_GET_PACKER_CONTEXT(pc);
513 unsigned char *data_ptr;
514 CR_GET_BUFFERED_POINTER( pc, 12 );
515 pc->current.c.vertexAttrib.s4[index] = data_ptr + 4;
516 pc->current.attribsUsedMask |= (1 << index);
517 WRITE_DATA( 0, GLuint, index );
518 WRITE_DATA( 4, GLushort, v[0] );
519 WRITE_DATA( 6, GLushort, v[1] );
520 WRITE_DATA( 8, GLushort, v[2] );
521 WRITE_DATA( 10, GLushort, v[3] );
522 WRITE_OPCODE( pc, CR_VERTEXATTRIB4USVARB_OPCODE );
523 CR_UNLOCK_PACKER_CONTEXT(pc);
524}
525
526
527void PACK_APIENTRY crPackVertexAttrib4ubvARB(GLuint index, const GLubyte * v)
528{
529 CR_GET_PACKER_CONTEXT(pc);
530 unsigned char *data_ptr;
531 CR_GET_BUFFERED_POINTER( pc, 8 );
532 pc->current.c.vertexAttrib.ub4[index] = data_ptr + 4;
533 pc->current.attribsUsedMask |= (1 << index);
534 WRITE_DATA( 0, GLuint, index );
535 WRITE_DATA( 4, GLubyte, v[0] );
536 WRITE_DATA( 5, GLubyte, v[1] );
537 WRITE_DATA( 6, GLubyte, v[2] );
538 WRITE_DATA( 7, GLubyte, v[3] );
539 WRITE_OPCODE( pc, CR_VERTEXATTRIB4UBVARB_OPCODE );
540 CR_UNLOCK_PACKER_CONTEXT(pc);
541}
542
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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