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 STATE_H
|
---|
8 | #define STATE_H
|
---|
9 |
|
---|
10 | #include "cr_glstate.h"
|
---|
11 |
|
---|
12 | #define CRSTATE_CHECKERR_RET(expr, result, message, ret) \
|
---|
13 | if (expr) { \
|
---|
14 | crStateError(pState, __LINE__, __FILE__, result, message); \
|
---|
15 | return ret; \
|
---|
16 | }
|
---|
17 |
|
---|
18 | #define CRSTATE_NO_RETURN
|
---|
19 |
|
---|
20 | #define CRSTATE_CHECKERR(expr, result, message) CRSTATE_CHECKERR_RET(expr, result, message, CRSTATE_NO_RETURN)
|
---|
21 |
|
---|
22 | typedef struct _crCheckIDHWID {
|
---|
23 | GLuint id, hwid;
|
---|
24 | PCRStateTracker pState;
|
---|
25 | } crCheckIDHWID_t;
|
---|
26 |
|
---|
27 | #define GetCurrentBits(a_pState) (a_pState)->pCurrentBits
|
---|
28 |
|
---|
29 | #include <cr_threads.h>
|
---|
30 |
|
---|
31 | #define GetCurrentContext(a_pState) VBoxTlsRefGetCurrent(CRContext, &((a_pState)->contextTSD))
|
---|
32 |
|
---|
33 | /* NOTE: below SetCurrentContext stuff is supposed to be used only internally!!
|
---|
34 | * it is placed here only to simplify things since some code besides state_init.c
|
---|
35 | * (i.e. state_glsl.c) is using it */
|
---|
36 | #define SetCurrentContext(a_pState, _ctx) VBoxTlsRefSetCurrent(CRContext, &((a_pState)->contextTSD), _ctx)
|
---|
37 |
|
---|
38 | extern void crStateTextureInitTextureObj (CRContext *ctx, CRTextureObj *tobj, GLuint name, GLenum target);
|
---|
39 | extern void crStateTextureInitTextureFormat( CRTextureLevel *tl, GLenum internalFormat );
|
---|
40 |
|
---|
41 | /* Normally these functions would have been in cr_bufferobject.h but
|
---|
42 | * that led to a number of issues.
|
---|
43 | */
|
---|
44 | void crStateBufferObjectInit(CRContext *ctx);
|
---|
45 |
|
---|
46 | void crStateBufferObjectDestroy (CRContext *ctx);
|
---|
47 |
|
---|
48 | void crStateBufferObjectDiff(CRBufferObjectBits *bb, CRbitvalue *bitID,
|
---|
49 | CRContext *fromCtx, CRContext *toCtx);
|
---|
50 |
|
---|
51 | void crStateBufferObjectSwitch(CRBufferObjectBits *bb, CRbitvalue *bitID,
|
---|
52 | CRContext *fromCtx, CRContext *toCtx);
|
---|
53 |
|
---|
54 | /* These would normally be in cr_client.h */
|
---|
55 |
|
---|
56 | void crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, CRContext *from, CRContext *to);
|
---|
57 |
|
---|
58 | void crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, CRContext *from, CRContext *to);
|
---|
59 |
|
---|
60 | void crStateFreeBufferObject(void *data, void *pvUser);
|
---|
61 | void crStateFreeFBO(void *data, void *pvUser);
|
---|
62 | void crStateFreeRBO(void *data, void *pvUser);
|
---|
63 |
|
---|
64 | void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names);
|
---|
65 | void crStateRegNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names);
|
---|
66 | void crStateOnTextureUsageRelease(PCRStateTracker pState, CRSharedState *pS, CRTextureObj *pObj);
|
---|
67 | #endif
|
---|