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_GLSTATE_H
|
---|
8 | #define CR_GLSTATE_H
|
---|
9 |
|
---|
10 | /* Forward declaration since some of the state/cr_*.h files need the CRContext type */
|
---|
11 | struct CRContext;
|
---|
12 | typedef struct CRContext CRContext;
|
---|
13 |
|
---|
14 | #include "cr_version.h"
|
---|
15 |
|
---|
16 | #include "state/cr_buffer.h"
|
---|
17 | #include "state/cr_bufferobject.h"
|
---|
18 | #include "state/cr_client.h"
|
---|
19 | #include "state/cr_current.h"
|
---|
20 | #include "state/cr_evaluators.h"
|
---|
21 | #include "state/cr_feedback.h"
|
---|
22 | #include "state/cr_fog.h"
|
---|
23 | #include "state/cr_hint.h"
|
---|
24 | #include "state/cr_lighting.h"
|
---|
25 | #include "state/cr_limits.h"
|
---|
26 | #include "state/cr_line.h"
|
---|
27 | #include "state/cr_lists.h"
|
---|
28 | #include "state/cr_multisample.h"
|
---|
29 | #include "state/cr_occlude.h"
|
---|
30 | #include "state/cr_pixel.h"
|
---|
31 | #include "state/cr_point.h"
|
---|
32 | #include "state/cr_polygon.h"
|
---|
33 | #include "state/cr_program.h"
|
---|
34 | #include "state/cr_regcombiner.h"
|
---|
35 | #include "state/cr_stencil.h"
|
---|
36 | #include "state/cr_texture.h"
|
---|
37 | #include "state/cr_transform.h"
|
---|
38 | #include "state/cr_viewport.h"
|
---|
39 |
|
---|
40 | #include "state/cr_attrib.h"
|
---|
41 |
|
---|
42 | #include "state/cr_statefuncs.h"
|
---|
43 | #include "state/cr_stateerror.h"
|
---|
44 |
|
---|
45 | #include "spu_dispatch_table.h"
|
---|
46 |
|
---|
47 | #include <iprt/cdefs.h>
|
---|
48 |
|
---|
49 | #ifndef IN_GUEST
|
---|
50 | #include <VBox/ssm.h>
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #define CR_MAX_EXTENTS 256
|
---|
54 |
|
---|
55 | #ifdef __cplusplus
|
---|
56 | extern "C" {
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Bit vectors describing GL state
|
---|
61 | */
|
---|
62 | typedef struct {
|
---|
63 | CRAttribBits attrib;
|
---|
64 | CRBufferBits buffer;
|
---|
65 | #ifdef CR_ARB_vertex_buffer_object
|
---|
66 | CRBufferObjectBits bufferobject;
|
---|
67 | #endif
|
---|
68 | CRClientBits client;
|
---|
69 | CRCurrentBits current;
|
---|
70 | CREvaluatorBits eval;
|
---|
71 | CRFeedbackBits feedback;
|
---|
72 | CRFogBits fog;
|
---|
73 | CRHintBits hint;
|
---|
74 | CRLightingBits lighting;
|
---|
75 | CRLineBits line;
|
---|
76 | CRListsBits lists;
|
---|
77 | CRMultisampleBits multisample;
|
---|
78 | #if CR_ARB_occlusion_query
|
---|
79 | CROcclusionBits occlusion;
|
---|
80 | #endif
|
---|
81 | CRPixelBits pixel;
|
---|
82 | CRPointBits point;
|
---|
83 | CRPolygonBits polygon;
|
---|
84 | CRProgramBits program;
|
---|
85 | CRRegCombinerBits regcombiner;
|
---|
86 | CRSelectionBits selection;
|
---|
87 | CRStencilBits stencil;
|
---|
88 | CRTextureBits texture;
|
---|
89 | CRTransformBits transform;
|
---|
90 | CRViewportBits viewport;
|
---|
91 | } CRStateBits;
|
---|
92 |
|
---|
93 | typedef void (*CRStateFlushFunc)( void *arg );
|
---|
94 |
|
---|
95 |
|
---|
96 | typedef struct _CRSharedState {
|
---|
97 | CRHashTable *textureTable; /* all texture objects */
|
---|
98 | CRHashTable *dlistTable; /* all display lists */
|
---|
99 | GLint refCount;
|
---|
100 | } CRSharedState;
|
---|
101 |
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * Chromium version of the state variables in OpenGL
|
---|
105 | */
|
---|
106 | struct CRContext {
|
---|
107 | int id;
|
---|
108 | CRbitvalue bitid[CR_MAX_BITARRAY];
|
---|
109 | CRbitvalue neg_bitid[CR_MAX_BITARRAY];
|
---|
110 |
|
---|
111 | CRSharedState *shared;
|
---|
112 |
|
---|
113 | GLenum renderMode;
|
---|
114 |
|
---|
115 | GLenum error;
|
---|
116 |
|
---|
117 | CRStateFlushFunc flush_func;
|
---|
118 | void *flush_arg;
|
---|
119 |
|
---|
120 | CRAttribState attrib;
|
---|
121 | CRBufferState buffer;
|
---|
122 | #ifdef CR_ARB_vertex_buffer_object
|
---|
123 | CRBufferObjectState bufferobject;
|
---|
124 | #endif
|
---|
125 | CRClientState client;
|
---|
126 | CRCurrentState current;
|
---|
127 | CREvaluatorState eval;
|
---|
128 | CRExtensionState extensions;
|
---|
129 | CRFeedbackState feedback;
|
---|
130 | CRFogState fog;
|
---|
131 | CRHintState hint;
|
---|
132 | CRLightingState lighting;
|
---|
133 | CRLimitsState limits;
|
---|
134 | CRLineState line;
|
---|
135 | CRListsState lists;
|
---|
136 | CRMultisampleState multisample;
|
---|
137 | #if CR_ARB_occlusion_query
|
---|
138 | CROcclusionState occlusion;
|
---|
139 | #endif
|
---|
140 | CRPixelState pixel;
|
---|
141 | CRPointState point;
|
---|
142 | CRPolygonState polygon;
|
---|
143 | CRProgramState program;
|
---|
144 | CRRegCombinerState regcombiner;
|
---|
145 | CRSelectionState selection;
|
---|
146 | CRStencilState stencil;
|
---|
147 | CRTextureState texture;
|
---|
148 | CRTransformState transform;
|
---|
149 | CRViewportState viewport;
|
---|
150 |
|
---|
151 | /** For buffering vertices for selection/feedback */
|
---|
152 | /*@{*/
|
---|
153 | GLuint vCount;
|
---|
154 | CRVertex vBuffer[4];
|
---|
155 | GLboolean lineReset;
|
---|
156 | GLboolean lineLoop;
|
---|
157 | /*@}*/
|
---|
158 | };
|
---|
159 |
|
---|
160 |
|
---|
161 | DECLEXPORT(void) crStateInit(void);
|
---|
162 | DECLEXPORT(CRContext *) crStateCreateContext(const CRLimitsState *limits, GLint visBits, CRContext *share);
|
---|
163 | DECLEXPORT(CRContext *) crStateCreateContextEx(const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID);
|
---|
164 | DECLEXPORT(void) crStateMakeCurrent(CRContext *ctx);
|
---|
165 | DECLEXPORT(void) crStateSetCurrent(CRContext *ctx);
|
---|
166 | DECLEXPORT(CRContext *) crStateGetCurrent(void);
|
---|
167 | DECLEXPORT(void) crStateDestroyContext(CRContext *ctx);
|
---|
168 |
|
---|
169 | DECLEXPORT(void) crStateFlushFunc( CRStateFlushFunc ff );
|
---|
170 | DECLEXPORT(void) crStateFlushArg( void *arg );
|
---|
171 | DECLEXPORT(void) crStateDiffAPI( SPUDispatchTable *api );
|
---|
172 | DECLEXPORT(void) crStateUpdateColorBits( void );
|
---|
173 |
|
---|
174 | DECLEXPORT(void) crStateSetCurrentPointers( CRContext *ctx, CRCurrentStatePointers *current );
|
---|
175 | DECLEXPORT(void) crStateResetCurrentPointers( CRCurrentStatePointers *current );
|
---|
176 |
|
---|
177 | DECLEXPORT(void) crStateSetExtensionString( CRContext *ctx, const GLubyte *extensions );
|
---|
178 |
|
---|
179 | DECLEXPORT(void) crStateDiffContext( CRContext *from, CRContext *to );
|
---|
180 | DECLEXPORT(void) crStateSwitchContext( CRContext *from, CRContext *to );
|
---|
181 |
|
---|
182 | #ifndef IN_GUEST
|
---|
183 | DECLEXPORT(int32_t) crStateSaveContext(CRContext *pContext, PSSMHANDLE pSSM);
|
---|
184 | DECLEXPORT(int32_t) crStateLoadContext(CRContext *pContext, PSSMHANDLE pSSM);
|
---|
185 | #endif
|
---|
186 |
|
---|
187 |
|
---|
188 | /* XXX move these! */
|
---|
189 |
|
---|
190 | DECLEXPORT(void) STATE_APIENTRY
|
---|
191 | crStateChromiumParameteriCR( GLenum target, GLint value );
|
---|
192 |
|
---|
193 | DECLEXPORT(void) STATE_APIENTRY
|
---|
194 | crStateChromiumParameterfCR( GLenum target, GLfloat value );
|
---|
195 |
|
---|
196 | DECLEXPORT(void) STATE_APIENTRY
|
---|
197 | crStateChromiumParametervCR( GLenum target, GLenum type, GLsizei count, const GLvoid *values );
|
---|
198 |
|
---|
199 | DECLEXPORT(void) STATE_APIENTRY
|
---|
200 | crStateGetChromiumParametervCR( GLenum target, GLuint index, GLenum type,
|
---|
201 | GLsizei count, GLvoid *values );
|
---|
202 |
|
---|
203 | DECLEXPORT(void) STATE_APIENTRY
|
---|
204 | crStateReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
|
---|
205 | GLenum format, GLenum type, GLvoid *pixels );
|
---|
206 |
|
---|
207 | #ifdef __cplusplus
|
---|
208 | }
|
---|
209 | #endif
|
---|
210 |
|
---|
211 | #endif /* CR_GLSTATE_H */
|
---|