diff options
-rw-r--r-- | src/vulkan/Android.mk | 9 | ||||
-rw-r--r-- | src/vulkan/Makefile.am | 9 | ||||
-rw-r--r-- | src/vulkan/util/gen_enum_to_str.py | 20 |
3 files changed, 33 insertions, 5 deletions
diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk index e19a33dd4f9..47c5c510819 100644 --- a/src/vulkan/Android.mk +++ b/src/vulkan/Android.mk @@ -44,11 +44,16 @@ LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, \ LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES) vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml +vk_android_native_buffer_xml = $(MESA_TOP)/src/vulkan/registry/vk_android_native_buffer.xml -$(LOCAL_GENERATED_SOURCES): $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py $(vulkan_api_xml) +$(LOCAL_GENERATED_SOURCES): $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py \ + $(vulkan_api_xml) $(vk_android_native_buffer_xml) @echo "target Generated: $(PRIVATE_MODULE) <= $(notdir $(@))" @mkdir -p $(dir $@) - $(hide) $(MESA_PYTHON2) $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py --xml $(vulkan_api_xml) --outdir $(dir $@) + $(hide) $(MESA_PYTHON2) $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py \ + --xml $(vulkan_api_xml) \ + --xml $(vk_android_native_buffer_xml) \ + --outdir $(dir $@) LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(intermediates) diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am index c897a07d6a8..c92748cb8a1 100644 --- a/src/vulkan/Makefile.am +++ b/src/vulkan/Makefile.am @@ -4,6 +4,7 @@ noinst_LTLIBRARIES = libvulkan_wsi.la libvulkan_util.la vulkan_includedir = $(includedir)/vulkan vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml +vk_android_native_buffer_xml = $(top_srcdir)/src/vulkan/registry/vk_android_native_buffer.xml MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D) PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) @@ -18,9 +19,13 @@ VULKAN_UTIL_SOURCES = \ BUILT_SOURCES = \ $(VULKAN_UTIL_GENERATED_FILES) -util/vk_enum_to_str.c util/vk_enum_to_str.h: util/gen_enum_to_str.py $(vulkan_api_xml) +util/vk_enum_to_str.c util/vk_enum_to_str.h: util/gen_enum_to_str.py \ + $(vulkan_api_xml) $(vk_android_native_buffer_xml) $(MKDIR_GEN) - $(PYTHON_GEN) $(srcdir)/util/gen_enum_to_str.py --xml $(vulkan_api_xml) --outdir $(top_builddir)/src/vulkan/util + $(PYTHON_GEN) $(srcdir)/util/gen_enum_to_str.py \ + --xml $(vulkan_api_xml) \ + --xml $(vk_android_native_buffer_xml) \ + --outdir $(top_builddir)/src/vulkan/util libvulkan_util_la_SOURCES = $(VULKAN_UTIL_SOURCES) diff --git a/src/vulkan/util/gen_enum_to_str.py b/src/vulkan/util/gen_enum_to_str.py index bc72c189943..df326d0a998 100644 --- a/src/vulkan/util/gen_enum_to_str.py +++ b/src/vulkan/util/gen_enum_to_str.py @@ -58,6 +58,7 @@ C_TEMPLATE = Template(textwrap.dedent(u"""\ */ #include <vulkan/vulkan.h> + #include <vulkan/vk_android_native_buffer.h> #include "util/macros.h" #include "vk_enum_to_str.h" @@ -68,8 +69,17 @@ C_TEMPLATE = Template(textwrap.dedent(u"""\ { switch(input) { % for v in enum.values: + % if v in FOREIGN_ENUM_VALUES: + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wswitch" + % endif case ${v}: return "${v}"; + % if v in FOREIGN_ENUM_VALUES: + #pragma GCC diagnostic pop + + % endif % endfor default: unreachable("Undefined enum value."); @@ -89,6 +99,7 @@ H_TEMPLATE = Template(textwrap.dedent(u"""\ #define MESA_VK_ENUM_TO_STR_H #include <vulkan/vulkan.h> + #include <vulkan/vk_android_native_buffer.h> % for enum in enums: const char * vk_${enum.name[2:]}_to_str(${enum.name} input); @@ -97,6 +108,12 @@ H_TEMPLATE = Template(textwrap.dedent(u"""\ #endif"""), output_encoding='utf-8') +# These enums are defined outside their respective enum blocks, and thus cause +# -Wswitch warnings. +FOREIGN_ENUM_VALUES = [ + "VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID", +] + class EnumFactory(object): """Factory for creating enums.""" @@ -175,7 +192,8 @@ def main(): f.write(template.render( file=os.path.basename(__file__), enums=efactory.registry.values(), - copyright=COPYRIGHT)) + copyright=COPYRIGHT, + FOREIGN_ENUM_VALUES=FOREIGN_ENUM_VALUES)) if __name__ == '__main__': |