VirtualBox

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

最後變更 在這個檔案從50213是 39265,由 vboxsync 提交於 13 年 前

crOpenGL: flush on glEnd if some begin-end data was sent to host already - fix Win8+WinSAT halt

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.7 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#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 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 CR_GET_BUFFERED_POINTER( pc, 4 );
23 CRASSERT(pc->enmBeginEndState == CRPackBeginEndStateNone);
24 pc->enmBeginEndState = CRPackBeginEndStateStarted;
25 pc->current.begin_data = data_ptr;
26 pc->current.begin_op = pc->buffer.opcode_current;
27 pc->current.attribsUsedMask = 0;
28 WRITE_DATA( 0, GLenum, mode );
29 WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
30 CR_UNLOCK_PACKER_CONTEXT(pc);
31}
32
33void PACK_APIENTRY crPackBeginSWAP( GLenum mode )
34{
35 CR_GET_PACKER_CONTEXT(pc);
36 unsigned char *data_ptr;
37 (void) pc;
38 if (pc->buffer.canBarf)
39 {
40 if (!pc->buffer.holds_BeginEnd)
41 pc->Flush( pc->flush_arg );
42 pc->buffer.in_BeginEnd = 1;
43 pc->buffer.holds_BeginEnd = 1;
44 }
45 CR_GET_BUFFERED_POINTER( pc, 4 );
46 CRASSERT(pc->enmBeginEndState == CRPackBeginEndStateNone);
47 pc->enmBeginEndState = CRPackBeginEndStateStarted;
48 pc->current.begin_data = data_ptr;
49 pc->current.begin_op = pc->buffer.opcode_current;
50 pc->current.attribsUsedMask = 0;
51 WRITE_DATA( 0, GLenum, SWAP32(mode) );
52 WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
53 CR_UNLOCK_PACKER_CONTEXT(pc);
54}
55
56void PACK_APIENTRY crPackEnd( void )
57{
58 CR_GET_PACKER_CONTEXT(pc);
59 unsigned char *data_ptr;
60 (void) pc;
61 CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
62 WRITE_OPCODE( pc, CR_END_OPCODE );
63 pc->buffer.in_BeginEnd = 0;
64 CRASSERT(pc->enmBeginEndState == CRPackBeginEndStateStarted
65 || pc->enmBeginEndState == CRPackBeginEndStateFlushDone);
66 if (pc->enmBeginEndState == CRPackBeginEndStateFlushDone)
67 {
68 pc->Flush( pc->flush_arg );
69 }
70 pc->enmBeginEndState = CRPackBeginEndStateNone;
71 CR_UNLOCK_PACKER_CONTEXT(pc);
72}
73
74void PACK_APIENTRY crPackEndSWAP( void )
75{
76 CR_GET_PACKER_CONTEXT(pc);
77 unsigned char *data_ptr;
78 (void) pc;
79 CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
80 WRITE_OPCODE( pc, CR_END_OPCODE );
81 pc->buffer.in_BeginEnd = 0;
82 CRASSERT(pc->enmBeginEndState == CRPackBeginEndStateStarted
83 || pc->enmBeginEndState == CRPackBeginEndStateFlushDone);
84 if (pc->enmBeginEndState == CRPackBeginEndStateFlushDone)
85 {
86 pc->Flush( pc->flush_arg );
87 }
88 CR_UNLOCK_PACKER_CONTEXT(pc);
89}
90
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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