summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
commitf8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch)
tree26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
parentInitial commit. (diff)
downloadvirtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.tar.xz
virtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.zip
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py')
-rwxr-xr-xsrc/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py b/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
new file mode 100755
index 00000000..f3f15bee
--- /dev/null
+++ b/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
@@ -0,0 +1,78 @@
+# Copyright (c) 2001, Stanford University
+# All rights reserved.
+#
+# See the file LICENSE.txt for information on redistributing this software.
+
+# This script generates the spu_dispatch_table.h file from gl_header.parsed
+
+from __future__ import print_function
+import sys, string
+
+import apiutil
+
+
+apiutil.CopyrightC()
+
+print("""
+/* DO NOT EDIT - THIS FILE GENERATED BY THE dispatchheader.py SCRIPT */
+
+#ifndef CR_SPU_DISPATCH_TABLE_H
+#define CR_SPU_DISPATCH_TABLE_H
+
+#ifdef WINDOWS
+#define SPU_APIENTRY __stdcall
+#else
+#define SPU_APIENTRY
+#endif
+
+#include "chromium.h"
+#include "state/cr_statetypes.h"
+""")
+
+keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
+
+
+print('/* Offsets of each function within the dispatch table */')
+offset = 0
+for func_name in keys:
+ print('#define DISPATCH_OFFSET_%s %d' % (func_name, offset))
+ offset += 1
+print('')
+
+print('/* Function typedefs */')
+for func_name in keys:
+ return_type = apiutil.ReturnType(func_name)
+ params = apiutil.Parameters(func_name)
+
+ print('typedef %s (SPU_APIENTRY *%sFunc_t)(%s);' % (return_type, func_name, apiutil.MakePrototypeString(params)))
+print('')
+
+print('struct _copy_list_node;')
+print('')
+print('/* Prototype for SPU internal state load/unload callbacks. */')
+print('')
+print('typedef int (*SPUStateFunc_t)(void *);')
+print('')
+print('/* The SPU dispatch table */')
+print('typedef struct _spu_dispatch_table {')
+
+for func_name in keys:
+ print("\t%sFunc_t %s; " % ( func_name, func_name ))
+
+print("""
+ struct _copy_list_node *copyList;
+ struct _spu_dispatch_table *copy_of;
+ int mark;
+ void *server;
+ SPUStateFunc_t spu_save_state; /* Save SPU internal state callback (optional) */
+ SPUStateFunc_t spu_load_state; /* Load SPU internal state callback (optional) */
+} SPUDispatchTable;
+
+struct _copy_list_node {
+ SPUDispatchTable *copy;
+ struct _copy_list_node *next;
+};
+
+
+#endif /* CR_SPU_DISPATCH_TABLE_H */
+""")