Add a GetInstanceProcAddr helper for the native Vulkan backend.

This is a helper to allow a Dawn embedder to look up the Vulkan device
functions.  Possibly remove when we design a cleaner way to share function
pointers.

Change-Id: I3ed92568e543c1aad9e0e64d72ad0990824640cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12980
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-11-01 01:10:09 +00:00 committed by Commit Bot service account
parent ec9010eabc
commit fb03935bed
2 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,12 @@ namespace dawn_native { namespace vulkan {
return backendDevice->GetVkInstance(); return backendDevice->GetVkInstance();
} }
DAWN_NATIVE_EXPORT PFN_vkVoidFunction GetInstanceProcAddr(WGPUDevice device,
const char* pName) {
Device* backendDevice = reinterpret_cast<Device*>(device);
return (*backendDevice->fn.GetInstanceProcAddr)(backendDevice->GetVkInstance(), pName);
}
// Explicitly export this function because it uses the "native" type for surfaces while the // Explicitly export this function because it uses the "native" type for surfaces while the
// header as seen in this file uses the wrapped type. // header as seen in this file uses the wrapped type.
DAWN_NATIVE_EXPORT DawnSwapChainImplementation DAWN_NATIVE_EXPORT DawnSwapChainImplementation

View File

@ -34,6 +34,8 @@ namespace dawn_native { namespace vulkan {
DAWN_NATIVE_EXPORT VkInstance GetInstance(WGPUDevice device); DAWN_NATIVE_EXPORT VkInstance GetInstance(WGPUDevice device);
DAWN_NATIVE_EXPORT PFN_vkVoidFunction GetInstanceProcAddr(WGPUDevice device, const char* pName);
DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device,
VkSurfaceKHR surface); VkSurfaceKHR surface);
DAWN_NATIVE_EXPORT WGPUTextureFormat DAWN_NATIVE_EXPORT WGPUTextureFormat