VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_beginend.c@ 63942

Last change on this file since 63942 was 52451, checked in by vboxsync, 10 years ago

crOpenGL: command blocks flushing

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
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
10void PACK_APIENTRY crPackBegin( GLenum mode )
11{
12 CR_GET_PACKER_CONTEXT(pc);
13 unsigned char *data_ptr;
14 (void) pc;
15
16 if (CR_CMDBLOCK_IS_STARTED(pc, CRPACKBLOCKSTATE_OP_BEGIN))
17 {
18 WARN(("recursive begin?"));
19 return;
20 }
21
22 CR_CMDBLOCK_BEGIN( pc, CRPACKBLOCKSTATE_OP_BEGIN );
23#ifndef VBOX
24 if (pc->buffer.canBarf)
25 {
26 if (!pc->buffer.holds_BeginEnd)
27 pc->Flush( pc->flush_arg );
28 pc->buffer.in_BeginEnd = 1;
29 pc->buffer.holds_BeginEnd = 1;
30 }
31#endif
32 CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, 4, GL_FALSE);
33 pc->current.begin_data = data_ptr;
34 pc->current.begin_op = pc->buffer.opcode_current;
35 pc->current.attribsUsedMask = 0;
36 WRITE_DATA( 0, GLenum, mode );
37 WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
38 CR_UNLOCK_PACKER_CONTEXT(pc);
39}
40
41void PACK_APIENTRY crPackBeginSWAP( GLenum mode )
42{
43 CR_GET_PACKER_CONTEXT(pc);
44 unsigned char *data_ptr;
45 (void) pc;
46#ifndef VBOX
47 if (pc->buffer.canBarf)
48 {
49 if (!pc->buffer.holds_BeginEnd)
50 pc->Flush( pc->flush_arg );
51 pc->buffer.in_BeginEnd = 1;
52 pc->buffer.holds_BeginEnd = 1;
53 }
54#endif
55 CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, 4, GL_FALSE);
56 pc->current.begin_data = data_ptr;
57 pc->current.begin_op = pc->buffer.opcode_current;
58 pc->current.attribsUsedMask = 0;
59 WRITE_DATA( 0, GLenum, SWAP32(mode) );
60 WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
61 CR_UNLOCK_PACKER_CONTEXT(pc);
62}
63
64void PACK_APIENTRY crPackEnd( void )
65{
66 CR_GET_PACKER_CONTEXT(pc);
67 unsigned char *data_ptr;
68 (void) pc;
69 CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
70 WRITE_OPCODE( pc, CR_END_OPCODE );
71 pc->buffer.in_BeginEnd = 0;
72 CR_CMDBLOCK_END( pc, CRPACKBLOCKSTATE_OP_BEGIN );
73 CR_UNLOCK_PACKER_CONTEXT(pc);
74}
75
76void PACK_APIENTRY crPackEndSWAP( void )
77{
78 CR_GET_PACKER_CONTEXT(pc);
79 unsigned char *data_ptr;
80 (void) pc;
81 CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
82 WRITE_OPCODE( pc, CR_END_OPCODE );
83 pc->buffer.in_BeginEnd = 0;
84 CR_CMDBLOCK_END( pc, CRPACKBLOCKSTATE_OP_BEGIN );
85 CR_UNLOCK_PACKER_CONTEXT(pc);
86}
Note: See TracBrowser for help on using the repository browser.

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