1 | /* $Id: dlm_calllist.c 54905 2015-03-23 11:20:58Z vboxsync $ */
|
---|
2 | #include <stdio.h>
|
---|
3 | #include "cr_spu.h"
|
---|
4 | #include "cr_dlm.h"
|
---|
5 | #include "cr_mem.h"
|
---|
6 | #include "cr_error.h"
|
---|
7 | #include "dlm.h"
|
---|
8 | #include <VBox/VBoxUhgsmi.h>
|
---|
9 | /* The headers and structures are still auto-generated */
|
---|
10 | #include "dlm_generated.h"
|
---|
11 |
|
---|
12 | /* The CallList functions have a special implementation. They aren't commonly
|
---|
13 | * listed as state-changers, but they can cause state to change.
|
---|
14 | */
|
---|
15 |
|
---|
16 | static void DLM_APIENTRY executeCallList(DLMInstanceList *x, SPUDispatchTable *dispatchTable)
|
---|
17 | {
|
---|
18 | struct instanceCallList *instance = (struct instanceCallList *)x;
|
---|
19 | dispatchTable->CallList(instance->list);
|
---|
20 | }
|
---|
21 | void DLM_APIENTRY crDLMCompileCallList( GLuint list )
|
---|
22 | {
|
---|
23 | struct instanceCallList *instance;
|
---|
24 | instance = crCalloc(sizeof(struct instanceCallList));
|
---|
25 | if (!instance) {
|
---|
26 | crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,
|
---|
27 | "out of memory adding CallList to display list");
|
---|
28 | return;
|
---|
29 | }
|
---|
30 | /* Put in the parameters */
|
---|
31 | instance->list = list;
|
---|
32 |
|
---|
33 | /* Add to the display list correctly */
|
---|
34 | crdlm_add_to_list((DLMInstanceList *)instance, executeCallList);
|
---|
35 | }
|
---|
36 |
|
---|
37 | /*** CallLists ***/
|
---|
38 | static void DLM_APIENTRY executeCallLists(DLMInstanceList *x, SPUDispatchTable *dispatchTable)
|
---|
39 | {
|
---|
40 | struct instanceCallLists *instance = (struct instanceCallLists *)x;
|
---|
41 | dispatchTable->CallLists(instance->n, instance->type, instance->lists);
|
---|
42 | }
|
---|
43 | void DLM_APIENTRY crDLMCompileCallLists( GLsizei n, GLenum type, const GLvoid * lists )
|
---|
44 | {
|
---|
45 | struct instanceCallLists *instance;
|
---|
46 | instance = crCalloc(sizeof(struct instanceCallLists) + crdlm_pointers_CallLists(NULL, n, type, lists));
|
---|
47 | if (!instance) {
|
---|
48 | crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,
|
---|
49 | "out of memory adding CallLists to display list");
|
---|
50 | return;
|
---|
51 | }
|
---|
52 | instance->n = n;
|
---|
53 | instance->type = type;
|
---|
54 | if (lists == NULL) {
|
---|
55 | instance->lists = NULL;
|
---|
56 | }
|
---|
57 | else {
|
---|
58 | instance->lists = instance->listsData;
|
---|
59 | }
|
---|
60 | (void) crdlm_pointers_CallLists(instance, n, type, lists);
|
---|
61 |
|
---|
62 | crdlm_add_to_list((DLMInstanceList *)instance, executeCallLists);
|
---|
63 | }
|
---|