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 | CR_GET_PACKER_CONTEXT(pc);
|
---|
13 | unsigned char *data_ptr;
|
---|
14 | (void) pc;
|
---|
15 |
|
---|
16 | CR_CMDBLOCK_BEGIN( pc, CRPACKBLOCKSTATE_OP_BEGIN );
|
---|
17 | #ifndef VBOX
|
---|
18 | if (pc->buffer.canBarf)
|
---|
19 | {
|
---|
20 | if (!pc->buffer.holds_BeginEnd)
|
---|
21 | pc->Flush( pc->flush_arg );
|
---|
22 | pc->buffer.in_BeginEnd = 1;
|
---|
23 | pc->buffer.holds_BeginEnd = 1;
|
---|
24 | }
|
---|
25 | #endif
|
---|
26 | CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, 4, GL_FALSE);
|
---|
27 | pc->current.begin_data = data_ptr;
|
---|
28 | pc->current.begin_op = pc->buffer.opcode_current;
|
---|
29 | pc->current.attribsUsedMask = 0;
|
---|
30 | WRITE_DATA( 0, GLenum, mode );
|
---|
31 | WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
|
---|
32 | CR_UNLOCK_PACKER_CONTEXT(pc);
|
---|
33 | }
|
---|
34 |
|
---|
35 | void PACK_APIENTRY crPackBeginSWAP( GLenum mode )
|
---|
36 | {
|
---|
37 | CR_GET_PACKER_CONTEXT(pc);
|
---|
38 | unsigned char *data_ptr;
|
---|
39 | (void) pc;
|
---|
40 | #ifndef VBOX
|
---|
41 | if (pc->buffer.canBarf)
|
---|
42 | {
|
---|
43 | if (!pc->buffer.holds_BeginEnd)
|
---|
44 | pc->Flush( pc->flush_arg );
|
---|
45 | pc->buffer.in_BeginEnd = 1;
|
---|
46 | pc->buffer.holds_BeginEnd = 1;
|
---|
47 | }
|
---|
48 | #endif
|
---|
49 | CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, 4, GL_FALSE);
|
---|
50 | pc->current.begin_data = data_ptr;
|
---|
51 | pc->current.begin_op = pc->buffer.opcode_current;
|
---|
52 | pc->current.attribsUsedMask = 0;
|
---|
53 | WRITE_DATA( 0, GLenum, SWAP32(mode) );
|
---|
54 | WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
|
---|
55 | CR_UNLOCK_PACKER_CONTEXT(pc);
|
---|
56 | }
|
---|
57 |
|
---|
58 | void PACK_APIENTRY crPackEnd( void )
|
---|
59 | {
|
---|
60 | CR_GET_PACKER_CONTEXT(pc);
|
---|
61 | unsigned char *data_ptr;
|
---|
62 | (void) pc;
|
---|
63 | CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
|
---|
64 | WRITE_OPCODE( pc, CR_END_OPCODE );
|
---|
65 | pc->buffer.in_BeginEnd = 0;
|
---|
66 | CR_CMDBLOCK_END( pc, CRPACKBLOCKSTATE_OP_BEGIN );
|
---|
67 | CR_UNLOCK_PACKER_CONTEXT(pc);
|
---|
68 | }
|
---|
69 |
|
---|
70 | void PACK_APIENTRY crPackEndSWAP( void )
|
---|
71 | {
|
---|
72 | CR_GET_PACKER_CONTEXT(pc);
|
---|
73 | unsigned char *data_ptr;
|
---|
74 | (void) pc;
|
---|
75 | CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
|
---|
76 | WRITE_OPCODE( pc, CR_END_OPCODE );
|
---|
77 | pc->buffer.in_BeginEnd = 0;
|
---|
78 | CR_CMDBLOCK_END( pc, CRPACKBLOCKSTATE_OP_BEGIN );
|
---|
79 | CR_UNLOCK_PACKER_CONTEXT(pc);
|
---|
80 | }
|
---|
81 |
|
---|