[Mesa-dev] [PATCH 2/2] anv: Autogenerate extension query and lookup

Emil Velikov emil.l.velikov at gmail.com
Fri Jul 14 14:17:36 UTC 2017


On 14 July 2017 at 07:14, Jason Ekstrand <jason at jlekstrand.net> wrote:
> As time goes on, extension advertising is going to get more complex.
> Today, we either implement an extension or we don't.  However, in the
> future, whether or not we advertise an extension will depend on kernel
> or hardware features.  This commit introduces a python codegen framework
> that generates the anv_EnumerateFooExtensionProperties functions as well
> as a pair of anv_foo_extension_supported functions for querying for the
> support of a given extension string.  Each extension has an "enable"
> predicate that is any valid C expression.  For device extensions, the
> physical device is available as "device" so the expression could be
> something such as "device->has_kernel_feature".  For instance
> extensions, the only option is VK_USE_PLATFORM defines.
>
> This mechanism also means that we have a single one-line-per-entry table
> for all extension declarations instead of the two tables we had in
> anv_device.c and the one we had in anv_entrypoints_gen.py.  The Python
> code is smart and uses the XML to determine whether an extension is an
> instance extension or device extension.
> ---
>  src/intel/Android.vulkan.mk        |   8 ++
>  src/intel/Makefile.sources         |   3 +-
>  src/intel/Makefile.vulkan.am       |   5 ++
>  src/intel/vulkan/anv_device.c      | 149 +------------------------------------
>  src/intel/vulkan/anv_extensions.py | 118 +++++++++++++++++++++++++++++
>  src/intel/vulkan/anv_private.h     |   4 +
>  6 files changed, 141 insertions(+), 146 deletions(-)
>
> diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
> index 398f2e7..f93d71f 100644
> --- a/src/intel/Android.vulkan.mk
> +++ b/src/intel/Android.vulkan.mk
> @@ -25,6 +25,8 @@ include $(LOCAL_PATH)/Makefile.sources
>
>  VK_ENTRYPOINTS_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/vulkan/anv_entrypoints_gen.py
>
> +VK_EXTENSIONS_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/vulkan/anv_extensions.py
> +
>  VULKAN_COMMON_INCLUDES := \
>         $(MESA_TOP)/src/mapi \
>         $(MESA_TOP)/src/gallium/auxiliary \
> @@ -213,6 +215,12 @@ $(intermediates)/vulkan/anv_entrypoints.c:
>                 --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
>                 --outdir $(dir $@)
>
Add the following line otherwise the file won't be in the binary.

LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.c

With the above nit
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

-Emil


More information about the mesa-dev mailing list