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(__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 | } crCheckIDHWID_t;
|
---|
25 |
|
---|
26 | extern SPUDispatchTable diff_api;
|
---|
27 | extern CRStateBits *__currentBits;
|
---|
28 |
|
---|
29 | #define GetCurrentBits() __currentBits
|
---|
30 |
|
---|
31 | #include <cr_threads.h>
|
---|
32 |
|
---|
33 | extern CRtsd __contextTSD;
|
---|
34 | #define GetCurrentContext() VBoxTlsRefGetCurrent(CRContext, &__contextTSD)
|
---|
35 |
|
---|
36 | /* NOTE: below SetCurrentContext stuff is supposed to be used only internally!!
|
---|
37 | * it is placed here only to simplify things since some code besides state_init.c
|
---|
38 | * (i.e. state_glsl.c) is using it */
|
---|
39 | #define SetCurrentContext(_ctx) VBoxTlsRefSetCurrent(CRContext, &__contextTSD, _ctx)
|
---|
40 |
|
---|
41 | extern GLboolean g_bVBoxEnableDiffOnMakeCurrent;
|
---|
42 |
|
---|
43 | extern CRContext *g_pAvailableContexts[CR_MAX_CONTEXTS];
|
---|
44 | extern uint32_t g_cContexts;
|
---|
45 |
|
---|
46 | extern void crStateTextureInitTextureObj (CRContext *ctx, CRTextureObj *tobj, GLuint name, GLenum target);
|
---|
47 | extern void crStateTextureInitTextureFormat( CRTextureLevel *tl, GLenum internalFormat );
|
---|
48 |
|
---|
49 | /* Normally these functions would have been in cr_bufferobject.h but
|
---|
50 | * that led to a number of issues.
|
---|
51 | */
|
---|
52 | void crStateBufferObjectInit(CRContext *ctx);
|
---|
53 |
|
---|
54 | void crStateBufferObjectDestroy (CRContext *ctx);
|
---|
55 |
|
---|
56 | void crStateBufferObjectDiff(CRBufferObjectBits *bb, CRbitvalue *bitID,
|
---|
57 | CRContext *fromCtx, CRContext *toCtx);
|
---|
58 |
|
---|
59 | void crStateBufferObjectSwitch(CRBufferObjectBits *bb, CRbitvalue *bitID,
|
---|
60 | CRContext *fromCtx, CRContext *toCtx);
|
---|
61 |
|
---|
62 | /* These would normally be in cr_client.h */
|
---|
63 |
|
---|
64 | void crStateClientDiff(CRClientBits *cb, CRbitvalue *bitID, CRContext *from, CRContext *to);
|
---|
65 |
|
---|
66 | void crStateClientSwitch(CRClientBits *cb, CRbitvalue *bitID, CRContext *from, CRContext *to);
|
---|
67 |
|
---|
68 | void crStateFreeBufferObject(void *data);
|
---|
69 | void crStateFreeFBO(void *data);
|
---|
70 | void crStateFreeRBO(void *data);
|
---|
71 |
|
---|
72 | void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names);
|
---|
73 | void crStateRegNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names);
|
---|
74 | void crStateOnTextureUsageRelease(CRSharedState *pS, CRTextureObj *pObj);
|
---|
75 | #endif
|
---|