1 | #ifndef CR_DISPATCH_H
|
---|
2 | #define CR_DISPATCH_H
|
---|
3 |
|
---|
4 | #include "spu_dispatch_table.h"
|
---|
5 |
|
---|
6 | #include <iprt/cdefs.h>
|
---|
7 |
|
---|
8 | #ifdef __cplusplus
|
---|
9 | extern "C" {
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * This structure offers a set of layers for controlling the
|
---|
14 | * dispatch table. The top layer is always the active layer,
|
---|
15 | * and controls the dispatch table. Utilities may push new
|
---|
16 | * layers onto the stack, or pop layers off, to control how
|
---|
17 | * dispatches are made. A utility may keep track of the
|
---|
18 | * layer it created, and change it as needed, if dynamic
|
---|
19 | * control of dispatch tables is needed.
|
---|
20 | */
|
---|
21 |
|
---|
22 | typedef struct crDispatchLayer {
|
---|
23 | SPUDispatchTable *dispatchTable;
|
---|
24 | void (*changedCallback)(SPUDispatchTable *changedTable, void *callbackParm);
|
---|
25 | void *callbackParm;
|
---|
26 | struct crDispatchLayer *next, *prev;
|
---|
27 | } crDispatchLayer;
|
---|
28 |
|
---|
29 | /** This has to be saved and restored for each graphics context */
|
---|
30 | typedef struct {
|
---|
31 | crDispatchLayer *topLayer;
|
---|
32 | crDispatchLayer *bottomLayer;
|
---|
33 | } crCurrentDispatchInfo;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * These are already called from appropriate opengl_stub
|
---|
37 | * routines, so SPUs or utilities shouldn't have to
|
---|
38 | * worry about them, as long as they let their
|
---|
39 | * parent routines for NewContext and MakeCurrent
|
---|
40 | * execute before they try to use any of the
|
---|
41 | * dispatch utilities.
|
---|
42 | */
|
---|
43 | DECLEXPORT(void) crDispatchInit(SPUDispatchTable *defaultTable);
|
---|
44 | DECLEXPORT(void) crInitDispatchInfo(crCurrentDispatchInfo *info);
|
---|
45 | DECLEXPORT(void) crSetCurrentDispatchInfo(crCurrentDispatchInfo *info);
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * SPUs and utilities are expected to use these routines
|
---|
49 | * to modify dispatch tables. They should only be called
|
---|
50 | * once the current dispatch info is set (i.e., after
|
---|
51 | * the opengl_stub routine for MakeCurrent has a chance
|
---|
52 | * to run).
|
---|
53 | */
|
---|
54 | DECLEXPORT(crDispatchLayer) *crNewDispatchLayer(SPUDispatchTable *newTable,
|
---|
55 | void (*changedCallback)(SPUDispatchTable *changedTable, void *callbackParm),
|
---|
56 | void *callbackParm);
|
---|
57 | DECLEXPORT(void) crChangeDispatchLayer(crDispatchLayer *layer,
|
---|
58 | SPUDispatchTable *changedTable);
|
---|
59 | DECLEXPORT(void) crFreeDispatchLayer(crDispatchLayer *layer);
|
---|
60 |
|
---|
61 |
|
---|
62 | #ifdef __cplusplus
|
---|
63 | }
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #endif /* CR_DISPATCH_H */
|
---|