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 |
|
---|
23 | typedef struct thread_info_t ThreadInfo;
|
---|
24 | typedef struct context_info_t ContextInfo;
|
---|
25 |
|
---|
26 | struct 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 |
|
---|
41 | struct context_info_t {
|
---|
42 | CRContext *clientState; /* used to store client-side GL state */
|
---|
43 | GLint serverCtx; /* context ID returned by server */
|
---|
44 | GLubyte glVersion[100]; /* GL_VERSION string */
|
---|
45 | GLubyte pszRealVendor[100];
|
---|
46 | GLubyte pszRealVersion[100];
|
---|
47 | GLubyte pszRealRenderer[100];
|
---|
48 | };
|
---|
49 |
|
---|
50 | typedef struct {
|
---|
51 | int id;
|
---|
52 | int swap;
|
---|
53 |
|
---|
54 | /* config options */
|
---|
55 | int emit_GATHER_POST_SWAPBUFFERS;
|
---|
56 | int swapbuffer_sync;
|
---|
57 |
|
---|
58 | int ReadPixels;
|
---|
59 |
|
---|
60 | char *name;
|
---|
61 | int buffer_size;
|
---|
62 |
|
---|
63 | int numThreads; /*number of used threads in the next array, doesn't need to be cont*/
|
---|
64 | ThreadInfo thread[MAX_THREADS];
|
---|
65 | int idxThreadInUse; /*index of any used thread*/
|
---|
66 |
|
---|
67 | int numContexts;
|
---|
68 | ContextInfo context[CR_MAX_CONTEXTS];
|
---|
69 | } PackSPU;
|
---|
70 |
|
---|
71 | extern PackSPU pack_spu;
|
---|
72 |
|
---|
73 | #ifdef CHROMIUM_THREADSAFE
|
---|
74 | extern CRmutex _PackMutex;
|
---|
75 | extern CRtsd _PackTSD;
|
---|
76 | #define GET_THREAD(T) ThreadInfo *T = crGetTSD(&_PackTSD)
|
---|
77 | #else
|
---|
78 | #define GET_THREAD(T) ThreadInfo *T = &(pack_spu.thread[0])
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #define GET_CONTEXT(C) \
|
---|
82 | GET_THREAD(thread); \
|
---|
83 | ContextInfo *C = thread->currentContext
|
---|
84 |
|
---|
85 | extern void packspuCreateFunctions( void );
|
---|
86 | extern void packspuSetVBoxConfiguration( const SPU *child_spu );
|
---|
87 | extern void packspuConnectToServer( CRNetServer *server );
|
---|
88 | extern void packspuFlush( void *arg );
|
---|
89 | extern void packspuHuge( CROpcode opcode, void *buf );
|
---|
90 |
|
---|
91 | extern GLboolean packspuSyncOnFlushes();
|
---|
92 |
|
---|
93 | extern ThreadInfo *packspuNewThread( unsigned long id );
|
---|
94 |
|
---|
95 |
|
---|
96 | #endif /* CR_PACKSPU_H */
|
---|