summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-12-06 10:27:39 +0800
committerChia-I Wu <olv@lunarg.com>2010-12-06 15:40:37 +0800
commit8f2a974cf2c9b6c00dfac11be4316a7d121dfbb4 (patch)
tree33f4139d4adb57568a9e020a06a696ffdb3922f2 /src/gallium
parent5ae4b6693a8254236435960ef84701fe405fe59b (diff)
mapi: Rewrite mapi_abi.py to get rid of preprocessor magic.
The preprocessor magic in mapi was nothing but obfuscation. Rewrite mapi_abi.py to generate real C code. This commit removes the hack added in 43121f20866bb89e8dac92bd92ec85a943704b7e.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/vega/.gitignore1
-rw-r--r--src/gallium/state_trackers/vega/Makefile6
-rw-r--r--src/gallium/state_trackers/vega/SConscript12
-rw-r--r--src/gallium/state_trackers/vega/api.c17
-rw-r--r--src/gallium/state_trackers/vega/api.h5
5 files changed, 20 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/vega/.gitignore b/src/gallium/state_trackers/vega/.gitignore
new file mode 100644
index 0000000000..c452229f7f
--- /dev/null
+++ b/src/gallium/state_trackers/vega/.gitignore
@@ -0,0 +1 @@
+api_tmp.h
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile
index deafa39aa6..7342c124c2 100644
--- a/src/gallium/state_trackers/vega/Makefile
+++ b/src/gallium/state_trackers/vega/Makefile
@@ -42,4 +42,10 @@ C_SOURCES = \
shader.c \
shaders_cache.c
+GENERATED_SOURCES := api_tmp.h
+
include ../../Makefile.template
+
+MAPI := $(TOP)/src/mapi
+api_tmp.h: $(MAPI)/mapi/mapi_abi.py $(MAPI)/vgapi/vgapi.csv
+ $(PYTHON2) $< --printer vgapi --mode app $(MAPI)/vgapi/vgapi.csv > $@
diff --git a/src/gallium/state_trackers/vega/SConscript b/src/gallium/state_trackers/vega/SConscript
index a62783ab18..4900135a1c 100644
--- a/src/gallium/state_trackers/vega/SConscript
+++ b/src/gallium/state_trackers/vega/SConscript
@@ -3,6 +3,8 @@
Import('*')
+from sys import executable as python_cmd
+
env = env.Clone()
env.Append(CPPPATH = [
@@ -40,10 +42,16 @@ vega_sources = [
'mask.c',
'shader.c',
'shaders_cache.c',
+ 'text.c',
]
-# vgapi_header must be generated first
-env.Depends(vega_sources, vgapi_header)
+api_tmp = env.CodeGenerate(
+ target = '#/src/gallium/state_trackers/vega/api_tmp.h',
+ script = '#src/mapi/mapi/mapi_abi.py',
+ source = '#src/mapi/vgapi/vgapi.csv',
+ command = python_cmd + ' $SCRIPT --printer vgapi --mode app $SOURCE > $TARGET'
+)
+env.Depends(vega_sources, api_tmp)
st_vega = env.ConvenienceLibrary(
target = 'st_vega',
diff --git a/src/gallium/state_trackers/vega/api.c b/src/gallium/state_trackers/vega/api.c
index bf1d37493a..4bf7c71d45 100644
--- a/src/gallium/state_trackers/vega/api.c
+++ b/src/gallium/state_trackers/vega/api.c
@@ -28,23 +28,10 @@
#include "mapi/mapi.h"
+/* define vega_spec and vega_procs for use with mapi */
+#define API_TMP_DEFINE_SPEC
#include "api.h"
-static const char vega_spec[] =
- "1"
-#define MAPI_ABI_ENTRY(ret, name, params) \
- "\0" #name "\0"
-#define MAPI_ALIAS_ENTRY(alias, ret, name, params) \
- #name "\0"
-#include "vgapi/vgapi_tmp.h"
- "\0";
-
-static const mapi_proc vega_procs[] = {
-#define MAPI_ABI_ENTRY(ret, name, params) \
- (mapi_proc) vega ## name,
-#include "vgapi/vgapi_tmp.h"
-};
-
static void api_init(void)
{
static boolean initialized = FALSE;
diff --git a/src/gallium/state_trackers/vega/api.h b/src/gallium/state_trackers/vega/api.h
index 955508dae9..459dafb4bb 100644
--- a/src/gallium/state_trackers/vega/api.h
+++ b/src/gallium/state_trackers/vega/api.h
@@ -33,10 +33,7 @@
#include "VG/vgext.h"
#include "vg_manager.h"
-/* declare the prototypes */
-#define MAPI_ABI_ENTRY(ret, name, params) \
- ret VG_API_ENTRY vega ## name params;
-#include "vgapi/vgapi_tmp.h"
+#include "api_tmp.h"
struct mapi_table;