VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c@ 44824

Last change on this file since 44824 was 39265, checked in by vboxsync, 13 years ago

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

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 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 "cr_error.h"
8#include "cr_mem.h"
9#include "packer.h"
10#include <stdio.h>
11
12#ifdef CHROMIUM_THREADSAFE
13CRtsd _PackerTSD;
14int cr_packer_globals; /* dummy - for the sake of packer.def */
15#else
16int _PackerTSD; /* dummy - for the sake of packer.def */ /* drm1 */
17DLLDATA(CRPackContext) cr_packer_globals;
18#endif
19
20CRPackContext *crPackNewContext( int swapping )
21{
22#ifdef CHROMIUM_THREADSAFE
23 CRPackContext *pc = crCalloc(sizeof(CRPackContext));
24 if (!pc)
25 return NULL;
26 crInitMutex(&pc->mutex);
27#else
28 GET_PACKER_CONTEXT(pc);
29 crMemZero( pc, sizeof(CRPackContext));
30#endif
31 pc->enmBeginEndState = CRPackBeginEndStateNone;
32 pc->swapping = swapping;
33 pc->Flush = NULL;
34 pc->SendHuge = NULL;
35 pc->updateBBOX = 0;
36 return pc;
37}
38
39void crPackDeleteContext(CRPackContext *pc)
40{
41#ifdef CHROMIUM_THREADSAFE
42 crFreeMutex(&pc->mutex);
43 crFree(pc);
44#endif
45}
46
47/* Set packing context for the calling thread */
48void crPackSetContext( CRPackContext *pc )
49{
50#ifdef CHROMIUM_THREADSAFE
51 crSetTSD( &_PackerTSD, pc );
52#else
53 CRASSERT( pc == &cr_packer_globals );
54 (void)pc;
55#endif
56}
57
58
59/* Return packing context for the calling thread */
60CRPackContext *crPackGetContext( void )
61{
62#ifdef CHROMIUM_THREADSAFE
63 return (CRPackContext *) crGetTSD( &_PackerTSD );
64#else
65 return &cr_packer_globals;
66#endif
67}
68
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