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_protocol.h"
|
---|
9 |
|
---|
10 | void PACK_APIENTRY crPackBegin( GLenum mode )
|
---|
11 | {
|
---|
12 | GET_PACKER_CONTEXT(pc);
|
---|
13 | unsigned char *data_ptr;
|
---|
14 | (void) pc;
|
---|
15 | if (pc->buffer.canBarf)
|
---|
16 | {
|
---|
17 | if (!pc->buffer.holds_BeginEnd)
|
---|
18 | pc->Flush( pc->flush_arg );
|
---|
19 | pc->buffer.in_BeginEnd = 1;
|
---|
20 | pc->buffer.holds_BeginEnd = 1;
|
---|
21 | }
|
---|
22 | GET_BUFFERED_POINTER( pc, 4 );
|
---|
23 | pc->current.begin_data = data_ptr;
|
---|
24 | pc->current.begin_op = pc->buffer.opcode_current;
|
---|
25 | pc->current.attribsUsedMask = 0;
|
---|
26 | WRITE_DATA( 0, GLenum, mode );
|
---|
27 | WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
|
---|
28 | }
|
---|
29 |
|
---|
30 | void PACK_APIENTRY crPackBeginSWAP( GLenum mode )
|
---|
31 | {
|
---|
32 | GET_PACKER_CONTEXT(pc);
|
---|
33 | unsigned char *data_ptr;
|
---|
34 | (void) pc;
|
---|
35 | if (pc->buffer.canBarf)
|
---|
36 | {
|
---|
37 | if (!pc->buffer.holds_BeginEnd)
|
---|
38 | pc->Flush( pc->flush_arg );
|
---|
39 | pc->buffer.in_BeginEnd = 1;
|
---|
40 | pc->buffer.holds_BeginEnd = 1;
|
---|
41 | }
|
---|
42 | GET_BUFFERED_POINTER( pc, 4 );
|
---|
43 | pc->current.begin_data = data_ptr;
|
---|
44 | pc->current.begin_op = pc->buffer.opcode_current;
|
---|
45 | pc->current.attribsUsedMask = 0;
|
---|
46 | WRITE_DATA( 0, GLenum, SWAP32(mode) );
|
---|
47 | WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
|
---|
48 | }
|
---|
49 |
|
---|
50 | void PACK_APIENTRY crPackEnd( void )
|
---|
51 | {
|
---|
52 | GET_PACKER_CONTEXT(pc);
|
---|
53 | unsigned char *data_ptr;
|
---|
54 | (void) pc;
|
---|
55 | GET_BUFFERED_POINTER_NO_ARGS( pc );
|
---|
56 | WRITE_OPCODE( pc, CR_END_OPCODE );
|
---|
57 | pc->buffer.in_BeginEnd = 0;
|
---|
58 | }
|
---|
59 |
|
---|
60 | void PACK_APIENTRY crPackEndSWAP( void )
|
---|
61 | {
|
---|
62 | GET_PACKER_CONTEXT(pc);
|
---|
63 | unsigned char *data_ptr;
|
---|
64 | (void) pc;
|
---|
65 | GET_BUFFERED_POINTER_NO_ARGS( pc );
|
---|
66 | WRITE_OPCODE( pc, CR_END_OPCODE );
|
---|
67 | pc->buffer.in_BeginEnd = 0;
|
---|
68 | }
|
---|
69 |
|
---|