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