VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/state/cr_attrib.h@ 50613

Last change on this file since 50613 was 44326, checked in by vboxsync, 12 years ago

crOpenGL: 1. stencil state fixes, 2. missing gets

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.4 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_STATE_ATTRIB_H
8#define CR_STATE_ATTRIB_H
9
10#include "state/cr_limits.h"
11#include "state/cr_statetypes.h"
12
13#include <iprt/cdefs.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19typedef struct {
20 CRbitvalue dirty[CR_MAX_BITARRAY];
21} CRAttribBits;
22
23typedef struct {
24 GLcolorf accumClearValue;
25} CRAccumBufferStack;
26
27typedef struct {
28 GLboolean blend;
29 GLboolean alphaTest;
30 GLboolean logicOp;
31 GLboolean indexLogicOp;
32 GLboolean dither;
33
34 GLenum alphaTestFunc;
35 GLfloat alphaTestRef;
36 GLenum blendSrcRGB;
37 GLenum blendDstRGB;
38 GLenum blendSrcA;
39 GLenum blendDstA;
40 GLcolorf blendColor;
41 GLenum blendEquation;
42 GLenum logicOpMode;
43 GLenum drawBuffer;
44 GLint indexWriteMask;
45 GLcolorb colorWriteMask;
46 GLcolorf colorClearValue;
47 GLfloat indexClearValue;
48} CRColorBufferStack;
49
50typedef struct {
51 GLboolean rasterValid;
52 GLfloat attrib[CR_MAX_VERTEX_ATTRIBS][4];
53 GLfloat rasterAttrib[CR_MAX_VERTEX_ATTRIBS][4];
54 GLboolean edgeFlag;
55 GLfloat colorIndex;
56} CRCurrentStack;
57
58typedef struct {
59 GLboolean depthTest;
60 GLboolean depthMask;
61 GLenum depthFunc;
62 GLdefault depthClearValue;
63} CRDepthBufferStack;
64
65typedef struct {
66 GLboolean alphaTest;
67 GLboolean autoNormal;
68 GLboolean blend;
69 GLboolean *clip;
70 GLboolean colorMaterial;
71 GLboolean cullFace;
72 GLboolean depthTest;
73 GLboolean dither;
74 GLboolean fog;
75 GLboolean *light;
76 GLboolean lighting;
77 GLboolean lineSmooth;
78 GLboolean lineStipple;
79 GLboolean logicOp;
80 GLboolean indexLogicOp;
81 GLboolean map1[GLEVAL_TOT];
82 GLboolean map2[GLEVAL_TOT];
83 GLboolean normalize;
84 GLboolean pointSmooth;
85#ifdef CR_ARB_point_sprite
86 GLboolean pointSprite;
87 GLboolean coordReplacement[CR_MAX_TEXTURE_UNITS];
88#endif
89 GLboolean polygonOffsetLine;
90 GLboolean polygonOffsetFill;
91 GLboolean polygonOffsetPoint;
92 GLboolean polygonSmooth;
93 GLboolean polygonStipple;
94#ifdef CR_OPENGL_VERSION_1_2
95 GLboolean rescaleNormals;
96#endif
97 GLboolean scissorTest;
98 GLboolean stencilTest;
99 GLboolean texture1D[CR_MAX_TEXTURE_UNITS];
100 GLboolean texture2D[CR_MAX_TEXTURE_UNITS];
101 GLboolean texture3D[CR_MAX_TEXTURE_UNITS];
102#ifdef CR_ARB_texture_cube_map
103 GLboolean textureCubeMap[CR_MAX_TEXTURE_UNITS];
104#endif
105#ifdef CR_NV_texture_rectangle
106 GLboolean textureRect[CR_MAX_TEXTURE_UNITS];
107#endif
108 GLboolean textureGenS[CR_MAX_TEXTURE_UNITS];
109 GLboolean textureGenT[CR_MAX_TEXTURE_UNITS];
110 GLboolean textureGenR[CR_MAX_TEXTURE_UNITS];
111 GLboolean textureGenQ[CR_MAX_TEXTURE_UNITS];
112} CREnableStack;
113
114typedef struct {
115 GLboolean enable1D[GLEVAL_TOT];
116 GLboolean enable2D[GLEVAL_TOT];
117 GLboolean autoNormal;
118 CREvaluator1D eval1D[GLEVAL_TOT];
119 CREvaluator2D eval2D[GLEVAL_TOT];
120 GLint un1D;
121 GLfloat u11D, u21D;
122 GLint un2D;
123 GLint vn2D;
124 GLfloat u12D, u22D;
125 GLfloat v12D, v22D;
126} CREvalStack;
127
128typedef struct {
129 GLboolean lighting;
130 GLboolean colorMaterial;
131 GLenum shadeModel;
132 GLenum colorMaterialMode;
133 GLenum colorMaterialFace;
134 GLcolorf ambient[2];
135 GLcolorf diffuse[2];
136 GLcolorf specular[2];
137 GLcolorf emission[2];
138 GLfloat shininess[2];
139 GLint indexes[2][3];
140 GLcolorf lightModelAmbient;
141 GLboolean lightModelLocalViewer;
142 GLboolean lightModelTwoSide;
143#if defined(CR_EXT_separate_specular_color) || defined(CR_OPENGL_VERSION_1_2)
144 GLenum lightModelColorControlEXT;
145#endif
146 CRLight *light;
147} CRLightingStack;
148
149typedef struct {
150 GLcolorf color;
151 GLint index;
152 GLfloat density;
153 GLfloat start;
154 GLfloat end;
155 GLint mode;
156 GLboolean enable;
157} CRFogStack;
158
159typedef struct {
160 GLenum perspectiveCorrection;
161 GLenum pointSmooth;
162 GLenum lineSmooth;
163 GLenum polygonSmooth;
164 GLenum fog;
165#ifdef CR_EXT_clip_volume_hint
166 GLenum clipVolumeClipping;
167#endif
168#ifdef CR_ARB_texture_compression
169 GLenum textureCompression;
170#endif
171#ifdef CR_SGIS_generate_mipmap
172 GLenum generateMipmap;
173#endif
174} CRHintStack;
175
176typedef struct {
177 GLboolean lineSmooth;
178 GLboolean lineStipple;
179 GLfloat width;
180 GLushort pattern;
181 GLint repeat;
182} CRLineStack;
183
184typedef struct {
185 GLuint base;
186} CRListStack;
187
188typedef struct {
189 GLboolean mapColor;
190 GLboolean mapStencil;
191 GLint indexShift;
192 GLint indexOffset;
193 GLcolorf scale;
194 GLfloat depthScale;
195 GLcolorf bias;
196 GLfloat depthBias;
197 GLfloat xZoom;
198 GLfloat yZoom;
199 GLenum readBuffer;
200} CRPixelModeStack;
201
202typedef struct {
203 GLboolean pointSmooth;
204 GLfloat pointSize;
205#if CR_ARB_point_sprite
206 GLboolean pointSprite;
207 GLboolean coordReplacement[CR_MAX_TEXTURE_UNITS];
208#endif
209} CRPointStack;
210
211typedef struct {
212 GLboolean polygonSmooth;
213 GLboolean polygonOffsetFill;
214 GLboolean polygonOffsetLine;
215 GLboolean polygonOffsetPoint;
216 GLboolean polygonStipple;
217 GLboolean cullFace;
218 GLfloat offsetFactor;
219 GLfloat offsetUnits;
220 GLenum cullFaceMode;
221 GLenum frontFace;
222 GLenum frontMode;
223 GLenum backMode;
224} CRPolygonStack;
225
226typedef struct {
227 GLint pattern[32];
228} CRPolygonStippleStack;
229
230typedef struct {
231 GLboolean scissorTest;
232 GLint scissorX;
233 GLint scissorY;
234 GLsizei scissorW;
235 GLsizei scissorH;
236} CRScissorStack;
237
238typedef struct {
239 GLboolean stencilTest;
240 GLenum func;
241 GLint mask;
242 GLint ref;
243 GLenum fail;
244 GLenum passDepthFail;
245 GLenum passDepthPass;
246 GLint clearValue;
247 GLint writeMask;
248} CRStencilBufferStack_v_33;
249
250typedef struct {
251 /* true if stencil test is enabled */
252 GLboolean stencilTest;
253 /* true if GL_EXT_stencil_two_side is enabled (glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)) */
254 GLboolean stencilTwoSideEXT;
255 /* GL_FRONT or GL_BACK */
256 GLenum activeStencilFace;
257 GLint clearValue;
258 GLint writeMask;
259 CRStencilBufferState buffers[CRSTATE_STENCIL_BUFFER_COUNT];
260} CRStencilBufferStack;
261
262typedef struct {
263#if 111
264 GLuint curTextureUnit;
265 CRTextureUnit unit[CR_MAX_TEXTURE_UNITS];
266
267#else
268 GLboolean enabled1D[CR_MAX_TEXTURE_UNITS];
269 GLboolean enabled2D[CR_MAX_TEXTURE_UNITS];
270 GLboolean enabled3D[CR_MAX_TEXTURE_UNITS];
271# ifdef CR_ARB_texture_cube_map
272 GLboolean enabledCubeMap[CR_MAX_TEXTURE_UNITS];
273# endif
274 CRTextureObj *current1D[CR_MAX_TEXTURE_UNITS];
275 CRTextureObj *current2D[CR_MAX_TEXTURE_UNITS];
276 CRTextureObj *current3D[CR_MAX_TEXTURE_UNITS];
277# ifdef CR_ARB_texture_cube_map
278 CRTextureObj *currentCubeMap[CR_MAX_TEXTURE_UNITS];
279# endif
280 GLcolorf borderColor[4]; /* 4 = 1D, 2D, 3D and cube map textures */
281 GLenum minFilter[4];
282 GLenum magFilter[4];
283 GLenum wrapS[4];
284 GLenum wrapT[4];
285# ifdef CR_OPENGL_VERSION_1_2
286 GLenum wrapR[4];
287 GLfloat priority[4];
288 GLfloat minLod[4];
289 GLfloat maxLod[4];
290 GLint baseLevel[4];
291 GLint maxLevel[4];
292# endif
293
294 GLuint curTextureUnit;
295 GLenum envMode[CR_MAX_TEXTURE_UNITS];
296 GLcolorf envColor[CR_MAX_TEXTURE_UNITS];
297
298 GLtexcoordb textureGen[CR_MAX_TEXTURE_UNITS];
299 GLvectorf objSCoeff[CR_MAX_TEXTURE_UNITS];
300 GLvectorf objTCoeff[CR_MAX_TEXTURE_UNITS];
301 GLvectorf objRCoeff[CR_MAX_TEXTURE_UNITS];
302 GLvectorf objQCoeff[CR_MAX_TEXTURE_UNITS];
303 GLvectorf eyeSCoeff[CR_MAX_TEXTURE_UNITS];
304 GLvectorf eyeTCoeff[CR_MAX_TEXTURE_UNITS];
305 GLvectorf eyeRCoeff[CR_MAX_TEXTURE_UNITS];
306 GLvectorf eyeQCoeff[CR_MAX_TEXTURE_UNITS];
307 GLtexcoorde gen[CR_MAX_TEXTURE_UNITS];
308#endif
309} CRTextureStack;
310
311typedef struct {
312 GLenum matrixMode;
313 GLvectord *clipPlane;
314 GLboolean *clip;
315 GLboolean normalize;
316#ifdef CR_OPENGL_VERSION_1_2
317 GLboolean rescaleNormals;
318#endif
319} CRTransformStack;
320
321typedef struct {
322 GLint viewportX;
323 GLint viewportY;
324 GLint viewportW;
325 GLint viewportH;
326 GLclampd nearClip;
327 GLclampd farClip;
328} CRViewportStack;
329
330typedef struct {
331 GLint attribStackDepth;
332 CRbitvalue pushMaskStack[CR_MAX_ATTRIB_STACK_DEPTH];
333
334 GLint accumBufferStackDepth;
335 CRAccumBufferStack accumBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
336
337 GLint colorBufferStackDepth;
338 CRColorBufferStack colorBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
339
340 GLint currentStackDepth;
341 CRCurrentStack currentStack[CR_MAX_ATTRIB_STACK_DEPTH];
342
343 GLint depthBufferStackDepth;
344 CRDepthBufferStack depthBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
345
346 GLint enableStackDepth;
347 CREnableStack enableStack[CR_MAX_ATTRIB_STACK_DEPTH];
348
349 GLint evalStackDepth;
350 CREvalStack evalStack[CR_MAX_ATTRIB_STACK_DEPTH];
351
352 GLint fogStackDepth;
353 CRFogStack fogStack[CR_MAX_ATTRIB_STACK_DEPTH];
354
355 GLint hintStackDepth;
356 CRHintStack hintStack[CR_MAX_ATTRIB_STACK_DEPTH];
357
358 GLint lightingStackDepth;
359 CRLightingStack lightingStack[CR_MAX_ATTRIB_STACK_DEPTH];
360
361 GLint lineStackDepth;
362 CRLineStack lineStack[CR_MAX_ATTRIB_STACK_DEPTH];
363
364 GLint listStackDepth;
365 CRListStack listStack[CR_MAX_ATTRIB_STACK_DEPTH];
366
367 GLint pixelModeStackDepth;
368 CRPixelModeStack pixelModeStack[CR_MAX_ATTRIB_STACK_DEPTH];
369
370 GLint pointStackDepth;
371 CRPointStack pointStack[CR_MAX_ATTRIB_STACK_DEPTH];
372
373 GLint polygonStackDepth;
374 CRPolygonStack polygonStack[CR_MAX_ATTRIB_STACK_DEPTH];
375
376 GLint polygonStippleStackDepth;
377 CRPolygonStippleStack polygonStippleStack[CR_MAX_ATTRIB_STACK_DEPTH];
378
379 GLint scissorStackDepth;
380 CRScissorStack scissorStack[CR_MAX_ATTRIB_STACK_DEPTH];
381
382 GLint stencilBufferStackDepth;
383 CRStencilBufferStack stencilBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
384
385 GLint textureStackDepth;
386 CRTextureStack textureStack[CR_MAX_ATTRIB_STACK_DEPTH];
387
388 GLint transformStackDepth;
389 CRTransformStack transformStack[CR_MAX_ATTRIB_STACK_DEPTH];
390
391 GLint viewportStackDepth;
392 CRViewportStack viewportStack[CR_MAX_ATTRIB_STACK_DEPTH];
393} CRAttribState;
394
395DECLEXPORT(void) crStateAttribInit(CRAttribState *a);
396
397/* No diff! */
398DECLEXPORT(void) crStateAttribSwitch(CRAttribBits *bb, CRbitvalue *bitID,
399 CRContext *fromCtx, CRContext *toCtx);
400
401#ifdef __cplusplus
402}
403#endif
404
405#endif /* CR_STATE_ATTRIB_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