VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h@ 48999

Last change on this file since 48999 was 46059, checked in by vboxsync, 12 years ago

crOpenGL fix some leaking on connection cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.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#ifndef CR_PACKSPU_H
8#define CR_PACKSPU_H
9
10#ifdef WINDOWS
11#define PACKSPU_APIENTRY __stdcall
12#else
13#define PACKSPU_APIENTRY
14#endif
15
16#include "cr_glstate.h"
17#include "cr_netserver.h"
18#include "cr_pack.h"
19#include "cr_spu.h"
20#include "cr_threads.h"
21#include "state/cr_client.h"
22
23typedef struct thread_info_t ThreadInfo;
24typedef struct context_info_t ContextInfo;
25
26struct thread_info_t {
27 unsigned long id;
28 CRNetServer netServer;
29 CRPackBuffer buffer;
30 CRPackBuffer normBuffer;
31 CRPackBuffer BeginEndBuffer;
32 GLenum BeginEndMode;
33 int BeginEndState;
34 ContextInfo *currentContext;
35 CRPackContext *packer;
36 int writeback;
37 GLboolean bInjectThread;
38 GLboolean inUse;
39};
40
41struct context_info_t {
42 CRContext *clientState; /* used to store client-side GL state */
43 GLint serverCtx; /* context ID returned by server */
44 GLboolean fAutoFlush;
45 ThreadInfo *currentThread;
46 GLubyte glVersion[100]; /* GL_VERSION string */
47 GLubyte pszRealVendor[100];
48 GLubyte pszRealVersion[100];
49 GLubyte pszRealRenderer[100];
50};
51
52typedef struct {
53 int id;
54 int swap;
55
56 /* config options */
57 int emit_GATHER_POST_SWAPBUFFERS;
58 int swapbuffer_sync;
59
60 int ReadPixels;
61
62 char *name;
63 int buffer_size;
64
65 int numThreads; /*number of used threads in the next array, doesn't need to be cont*/
66 ThreadInfo thread[MAX_THREADS];
67 int idxThreadInUse; /*index of any used thread*/
68
69#if defined(WINDOWS) && defined(VBOX_WITH_WDDM)
70 bool bRunningUnderWDDM;
71#endif
72
73 int numContexts;
74 ContextInfo context[CR_MAX_CONTEXTS];
75} PackSPU;
76
77extern PackSPU pack_spu;
78
79#define THREAD_OFFSET_MAGIC 2000
80
81#ifdef CHROMIUM_THREADSAFE
82extern CRmutex _PackMutex;
83extern CRtsd _PackTSD;
84#define GET_THREAD_VAL() (crGetTSD(&_PackTSD))
85#define GET_THREAD_IDX(_id) ((_id) - THREAD_OFFSET_MAGIC)
86#define GET_THREAD_VAL_ID(_id) (&(pack_spu.thread[GET_THREAD_IDX(_id)]))
87#else
88#define GET_THREAD_VAL() (&(pack_spu.thread[0]))
89#endif
90#define GET_THREAD(T) ThreadInfo *T = GET_THREAD_VAL()
91#define GET_THREAD_ID(T, _id) ThreadInfo *T = GET_THREAD_VAL_ID(_id)
92
93
94
95#define GET_CONTEXT(C) \
96 GET_THREAD(thread); \
97 ContextInfo *C = thread->currentContext
98
99#define CRPACKSPU_WRITEBACK_WAIT(_thread, _writeback) CR_WRITEBACK_WAIT((_thread)->netServer.conn, _writeback)
100#if defined(WINDOWS) && defined(VBOX_WITH_WDDM) && defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
101# define CRPACKSPU_IS_WDDM_CRHGSMI() (pack_spu.bRunningUnderWDDM)
102#else
103# define CRPACKSPU_IS_WDDM_CRHGSMI() (GL_FALSE)
104#endif
105
106extern void packspuCreateFunctions( void );
107extern void packspuSetVBoxConfiguration( const SPU *child_spu );
108extern void packspuConnectToServer( CRNetServer *server
109#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
110 , struct VBOXUHGSMI *pHgsmi
111#endif
112 );
113extern void packspuFlush( void *arg );
114extern void packspuHuge( CROpcode opcode, void *buf );
115
116extern GLboolean packspuSyncOnFlushes();
117
118extern ThreadInfo *packspuNewThread(
119#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
120 struct VBOXUHGSMI *pHgsmi
121#endif
122 );
123
124extern ThreadInfo *packspuNewCtxThread( struct VBOXUHGSMI *pHgsmi );
125
126#endif /* CR_PACKSPU_H */
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