summaryrefslogtreecommitdiff
path: root/src/VBox/GuestHost/OpenGL/include/state/cr_buffer.h
blob: 7a57aae9c4ad5644e3a7a9b2d2e1fe1b7fa6673f (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
/* Copyright (c) 2001, Stanford University
 * All rights reserved.
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#ifndef CR_STATE_BUFFER_H
#define CR_STATE_BUFFER_H

#include "state/cr_statetypes.h"

#include <iprt/cdefs.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
	CRbitvalue	dirty[CR_MAX_BITARRAY];
	CRbitvalue	enable[CR_MAX_BITARRAY];
	CRbitvalue	alphaFunc[CR_MAX_BITARRAY];
	CRbitvalue	depthFunc[CR_MAX_BITARRAY];
	CRbitvalue	blendFunc[CR_MAX_BITARRAY];
	CRbitvalue	logicOp[CR_MAX_BITARRAY];
	CRbitvalue	indexLogicOp[CR_MAX_BITARRAY];
	CRbitvalue	drawBuffer[CR_MAX_BITARRAY];
	CRbitvalue	readBuffer[CR_MAX_BITARRAY];
	CRbitvalue	indexMask[CR_MAX_BITARRAY];
	CRbitvalue	colorWriteMask[CR_MAX_BITARRAY];
	CRbitvalue	clearColor[CR_MAX_BITARRAY];
	CRbitvalue	clearIndex[CR_MAX_BITARRAY];
	CRbitvalue	clearDepth[CR_MAX_BITARRAY];
	CRbitvalue	clearAccum[CR_MAX_BITARRAY];
	CRbitvalue	depthMask[CR_MAX_BITARRAY];
#ifdef CR_EXT_blend_color
	CRbitvalue	blendColor[CR_MAX_BITARRAY];
#endif
#if defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract) || defined(CR_EXT_blend_logic_op)
	CRbitvalue	blendEquation[CR_MAX_BITARRAY];
#endif
#if defined(CR_EXT_blend_func_separate)
	CRbitvalue	blendFuncSeparate[CR_MAX_BITARRAY];
#endif
} CRBufferBits;

typedef struct {
	GLboolean	depthTest;
	GLboolean	blend;
	GLboolean	alphaTest;
	GLboolean	logicOp;
	GLboolean	indexLogicOp;
	GLboolean	dither;
	GLboolean	depthMask;

	GLenum		alphaTestFunc;
	GLfloat		alphaTestRef;
	GLenum		depthFunc;
	GLenum		blendSrcRGB;
	GLenum		blendDstRGB;
	GLenum		blendSrcA;
	GLenum		blendDstA;
	GLenum		logicOpMode;
	GLenum		drawBuffer;
	GLenum		readBuffer;
	GLint		indexWriteMask;
	GLcolorb	colorWriteMask;
	GLcolorf	colorClearValue;
	GLfloat 	indexClearValue;
	GLdefault	depthClearValue;
	GLcolorf	accumClearValue;
#ifdef CR_EXT_blend_color
	GLcolorf	blendColor;
#endif
#if defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract)
	GLenum		blendEquation;
#endif

    GLint       width, height;
    GLint       storedWidth, storedHeight;
    GLvoid      *pFrontImg;
    GLvoid      *pBackImg;
} CRBufferState;

DECLEXPORT(void) crStateBufferInit(CRContext *ctx);

DECLEXPORT(void) crStateBufferDiff(CRBufferBits *bb, CRbitvalue *bitID,
                                   CRContext *fromCtx, CRContext *toCtx);
DECLEXPORT(void) crStateBufferSwitch(CRBufferBits *bb, CRbitvalue *bitID, 
                                     CRContext *fromCtx, CRContext *toCtx);

#ifdef __cplusplus
}
#endif

#endif /* CR_STATE_BUFFER_H */