OSDN Git Service

vulkan: rework driver::Get*ProcAddr
authorChia-I Wu <olv@google.com>
Thu, 24 Mar 2016 01:11:06 +0000 (09:11 +0800)
committerChia-I Wu <olv@google.com>
Thu, 7 Apr 2016 13:15:03 +0000 (21:15 +0800)
commiteb7db124e46da9a9210cf868353f5ea79502ffec
tree58801422f306957db776bcaa000e648ce7b6bd82
parentb262ddcfaba592ca153beddb120aeb68b64e6e63
vulkan: rework driver::Get*ProcAddr

Introduce driver::ProcHook which is a struct to describe an intercepted
function.  Given a function name, GetProcHook returns a ProcHook if the
function is intercepted.  NULL otherwise.

A ProcHook has three function pointers.  ProcHook::proc points to the real
intercepting function.  ProcHook::disabled_proc points to a no-op function
that logs an error.  ProcHook::checked_proc points to a trampoline that
calls either ProcHook::proc or ProcHook::disabled_proc.

For core functions, driver::Get*ProcAddr simply return ProcHook::proc.
For extension functions, driver::Get*ProcAddr return ProcHook::proc when
the extension is known to be enabled.  They return ProcHook::disabled_proc
when the extension is known to be disabled.  Finally, they return
ProcHook::checked_proc when they do not know if the extension is enabled
or not.

All ProcHooks as well as their disabled_proc/checked_proc are generated in
driver_gen.cpp.  This allows us to get rid of all hand-written "_Disabled"
functions, all no-op "_Bottom" functions, and special cases for
VK_ANDROID_native_buffer.  The reworked driver::Get*ProcAddr also detects
more applications' errors and logs them.

Change-Id: I8e6f476f450688b5547fd75243c66cb603c516b5
vulkan/libvulkan/Android.mk
vulkan/libvulkan/code-generator.tmpl
vulkan/libvulkan/dispatch.tmpl
vulkan/libvulkan/dispatch_gen.cpp
vulkan/libvulkan/driver.cpp
vulkan/libvulkan/driver.h
vulkan/libvulkan/driver_gen.cpp [new file with mode: 0644]
vulkan/libvulkan/driver_gen.h [new file with mode: 0644]
vulkan/libvulkan/loader.cpp
vulkan/libvulkan/loader.h