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