summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/include/state/cr_current.h
blob: d4a0570855a9575a20180c09ff98caa05c75d7a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* Copyright (c) 2001, Stanford University
 * All rights reserved.
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#ifndef CR_STATE_CURRENT_H
#define CR_STATE_CURRENT_H

#include "state/cr_currentpointers.h"

#include <iprt/cdefs.h>

#ifdef __cplusplus
extern "C" {
#endif


#define VERT_ATTRIB_POS      0
#define VERT_ATTRIB_WEIGHT   1
#define VERT_ATTRIB_NORMAL   2
#define VERT_ATTRIB_COLOR0   3
#define VERT_ATTRIB_COLOR1   4
#define VERT_ATTRIB_FOG      5
#define VERT_ATTRIB_SIX      6
#define VERT_ATTRIB_SEVEN    7
#define VERT_ATTRIB_TEX0     8
#define VERT_ATTRIB_TEX1     9
#define VERT_ATTRIB_TEX2     10
#define VERT_ATTRIB_TEX3     11
#define VERT_ATTRIB_TEX4     12
#define VERT_ATTRIB_TEX5     13
#define VERT_ATTRIB_TEX6     14
#define VERT_ATTRIB_TEX7     15
#define VERT_ATTRIB_MAX      16


typedef struct {
	CRbitvalue  dirty[CR_MAX_BITARRAY];
	/* Regardless of NV_vertex_program, we use this array */
	CRbitvalue  vertexAttrib[CR_MAX_VERTEX_ATTRIBS][CR_MAX_BITARRAY];
	CRbitvalue  edgeFlag[CR_MAX_BITARRAY];
	CRbitvalue  colorIndex[CR_MAX_BITARRAY];
	CRbitvalue  rasterPos[CR_MAX_BITARRAY];
} CRCurrentBits;


typedef struct {
	/* Pre-transform values */
	/* Regardless of NV_vertex_program, we use this array */
	GLfloat   attrib[CR_MAX_VERTEX_ATTRIBS][4];
	GLboolean edgeFlag;
	GLfloat   colorIndex;
	/* Post-transform values */
	GLvectorf	eyePos;
	GLvectorf	clipPos;
	GLvectorf	winPos;
} CRVertex;


typedef struct {
	/* Regardless of NV_vertex_program, we use this array */
	GLfloat  vertexAttrib[CR_MAX_VERTEX_ATTRIBS][4];
	GLfloat  vertexAttribPre[CR_MAX_VERTEX_ATTRIBS][4];

	CRCurrentStatePointers   *current;

	GLboolean    rasterValid;
	GLfloat      rasterAttrib[CR_MAX_VERTEX_ATTRIBS][4];
	GLfloat      rasterAttribPre[CR_MAX_VERTEX_ATTRIBS][4];

	GLdouble     rasterIndex;
	GLboolean    edgeFlag;
	GLboolean    edgeFlagPre;
	GLfloat      colorIndex;
	GLfloat      colorIndexPre;

	/* XXX this isn't really "current" state - move someday */
	GLuint       attribsUsedMask;  /* for ARB_vertex_program */
	GLboolean    inBeginEnd;
	GLenum       mode;
	GLuint       beginEndMax;
	GLuint       beginEndNum;
	GLuint       flushOnEnd;

} CRCurrentState;

DECLEXPORT(void) crStateCurrentInit( CRContext *ctx );

DECLEXPORT(void) crStateCurrentRecover( void );

DECLEXPORT(void) crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers  *current);

DECLEXPORT(void) crStateCurrentDiff(CRCurrentBits *bb, CRbitvalue *bitID,
                                    CRContext *fromCtx, CRContext *toCtx);
DECLEXPORT(void) crStateCurrentSwitch(CRCurrentBits *bb, CRbitvalue *bitID,
                                    CRContext *fromCtx, CRContext *toCtx);

DECLEXPORT(void) crStateRasterPosUpdate(GLfloat x, GLfloat y, GLfloat z, GLfloat w);

DECLEXPORT(GLuint) crStateNeedDummyZeroVertexArray(CRContext *g, CRCurrentStatePointers  *current, GLfloat *pZva);

#ifdef __cplusplus
}
#endif

#endif /* CR_STATE_CURRENT_H */