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 "packer.h"
|
---|
8 | #include "cr_error.h"
|
---|
9 | #include "cr_string.h"
|
---|
10 | #include "cr_version.h"
|
---|
11 |
|
---|
12 |
|
---|
13 | void PACK_APIENTRY
|
---|
14 | crPackMapBufferARB( GLenum target, GLenum access,
|
---|
15 | void * return_value, int * writeback )
|
---|
16 | {
|
---|
17 | (void)writeback;
|
---|
18 | (void)return_value;
|
---|
19 | (void)target;
|
---|
20 | (void)access;
|
---|
21 | crWarning("Can't pack MapBufferARB command!");
|
---|
22 | }
|
---|
23 |
|
---|
24 |
|
---|
25 | void PACK_APIENTRY
|
---|
26 | crPackUnmapBufferARB( GLenum target, GLboolean* return_value, int * writeback )
|
---|
27 | {
|
---|
28 | (void)target;
|
---|
29 | (void)return_value;
|
---|
30 | (void)writeback;
|
---|
31 | crWarning("Can't pack UnmapBufferARB command!");
|
---|
32 | }
|
---|
33 |
|
---|
34 |
|
---|
35 | void PACK_APIENTRY
|
---|
36 | crPackBufferDataARB( GLenum target, GLsizeiptrARB size,
|
---|
37 | const GLvoid * data, GLenum usage )
|
---|
38 | {
|
---|
39 | unsigned char *data_ptr;
|
---|
40 | int packet_length;
|
---|
41 |
|
---|
42 | packet_length = sizeof(GLenum)
|
---|
43 | + sizeof(target) + sizeof(size) + sizeof(usage) + size;
|
---|
44 |
|
---|
45 | data_ptr = (unsigned char *) crPackAlloc( packet_length );
|
---|
46 |
|
---|
47 | WRITE_DATA( 0, GLenum, CR_BUFFERDATAARB_EXTEND_OPCODE );
|
---|
48 | WRITE_DATA( 4, GLenum, target );
|
---|
49 | WRITE_DATA( 8, GLsizeiptrARB, size ); /* XXX or 8 bytes? */
|
---|
50 | WRITE_DATA( 12, GLenum, usage );
|
---|
51 | if (data)
|
---|
52 | crMemcpy( data_ptr + 16, data, size );
|
---|
53 |
|
---|
54 | crHugePacket( CR_EXTEND_OPCODE, data_ptr );
|
---|
55 | crPackFree( data_ptr );
|
---|
56 | }
|
---|
57 |
|
---|
58 |
|
---|
59 | void PACK_APIENTRY
|
---|
60 | crPackBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size,
|
---|
61 | const GLvoid * data )
|
---|
62 | {
|
---|
63 | unsigned char *data_ptr;
|
---|
64 | int packet_length;
|
---|
65 |
|
---|
66 | if (!data)
|
---|
67 | return;
|
---|
68 |
|
---|
69 | packet_length = sizeof(GLenum)
|
---|
70 | + sizeof(target) + sizeof(offset) + sizeof(size) + size;
|
---|
71 |
|
---|
72 | data_ptr = (unsigned char *) crPackAlloc( packet_length );
|
---|
73 | WRITE_DATA( 0, GLenum, CR_BUFFERSUBDATAARB_EXTEND_OPCODE );
|
---|
74 | WRITE_DATA( 4, GLenum, target );
|
---|
75 | WRITE_DATA( 8, GLintptrARB, offset ); /* XXX or 8 bytes? */
|
---|
76 | WRITE_DATA( 12, GLsizeiptrARB, size ); /* XXX or 8 bytes? */
|
---|
77 | crMemcpy( data_ptr + 16, data, size );
|
---|
78 |
|
---|
79 | crHugePacket( CR_EXTEND_OPCODE, data_ptr );
|
---|
80 | crPackFree( data_ptr );
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | void PACK_APIENTRY
|
---|
85 | crPackDeleteBuffersARB(GLsizei n, const GLuint * buffers)
|
---|
86 | {
|
---|
87 | unsigned char *data_ptr;
|
---|
88 | int packet_length = sizeof(GLenum) + sizeof(n) + n * sizeof(*buffers);
|
---|
89 |
|
---|
90 | if (!buffers)
|
---|
91 | return;
|
---|
92 |
|
---|
93 | data_ptr = (unsigned char *) crPackAlloc(packet_length);
|
---|
94 | WRITE_DATA( 0, GLenum, CR_DELETEBUFFERSARB_EXTEND_OPCODE );
|
---|
95 | WRITE_DATA( 4, GLsizei, n );
|
---|
96 | crMemcpy( data_ptr + 8, buffers, n * sizeof(*buffers) );
|
---|
97 | crHugePacket( CR_EXTEND_OPCODE, data_ptr );
|
---|
98 | crPackFree( data_ptr );
|
---|
99 | }
|
---|