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