From: Jason Ekstrand Date: Thu, 3 Dec 2015 06:06:22 +0000 (-0800) Subject: anv/entrypoints: Run the headers through the preprocessor first X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fde60c168495ab6a8f1ec3f4c3a41db575cd5d1e;p=mesa.git anv/entrypoints: Run the headers through the preprocessor first This allows us to filter based on preprocessor directives. We could build a partial preprocessor into the generator, but we would likely get it wrong. This allows us to filter out, for instance, windows-specific WSI stuff. --- diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am index 3f6d4a3e2e9..2f249488270 100644 --- a/src/vulkan/Makefile.am +++ b/src/vulkan/Makefile.am @@ -30,6 +30,12 @@ vulkan_include_HEADERS = \ $(top_srcdir)/include/vulkan/vk_ext_khr_swapchain.h \ $(top_srcdir)/include/vulkan/vk_ext_khr_device_swapchain.h +# Used when generating entrypoints to filter out unwanted extensions +VULKAN_ENTRYPOINT_CPPFLAGS = \ + -I$(top_srcdir)/include/vulkan \ + -DVK_USE_PLATFORM_XCB_KHR \ + -DVK_USE_PLATFORM_WAYLAND_KHR + lib_LTLIBRARIES = libvulkan.la check_LTLIBRARIES = libvulkan-test.la @@ -146,10 +152,10 @@ libvulkan_la_SOURCES = \ anv_gem.c anv_entrypoints.h : anv_entrypoints_gen.py $(vulkan_include_HEADERS) - $(AM_V_GEN)cat $(vulkan_include_HEADERS) | $(PYTHON2) $< header > $@ + $(AM_V_GEN) cat $(vulkan_include_HEADERS) | $(CPP) $(VULKAN_ENTRYPOINT_CPPFLAGS) - | $(PYTHON2) $< header > $@ anv_entrypoints.c : anv_entrypoints_gen.py $(vulkan_include_HEADERS) - $(AM_V_GEN)cat $(vulkan_include_HEADERS) | $(PYTHON2) $< code > $@ + $(AM_V_GEN) cat $(vulkan_include_HEADERS) | $(CPP) $(VULKAN_ENTRYPOINT_CPPFLAGS) - | $(PYTHON2) $< code > $@ isl_format_layout.c: isl_format_layout_gen.bash \ isl_format_layout.csv diff --git a/src/vulkan/anv_entrypoints_gen.py b/src/vulkan/anv_entrypoints_gen.py index 406f1421054..1e4cfcb1755 100644 --- a/src/vulkan/anv_entrypoints_gen.py +++ b/src/vulkan/anv_entrypoints_gen.py @@ -27,7 +27,7 @@ import fileinput, re, sys # Each function typedef in the vulkan.h header is all on one line and matches # this regepx. We hope that won't change. -p = re.compile('typedef ([^ ]*) *\(VKAPI_PTR \*PFN_vk([^(]*)\)(.*);') +p = re.compile('typedef ([^ ]*) *\((?:VKAPI_PTR)? *\*PFN_vk([^(]*)\)(.*);') entrypoints = []