New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 911313 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Add Vulkan platform abstractions beyond the instance

Project Member Reported by cblume@chromium.org, Dec 3

Issue description

Currently, there is a platform abstraction for Vulkan instances. An example is https://cs.chromium.org/chromium/src/gpu/vulkan/android/vulkan_implementation_android.h
(Despite being named "implementation" you can see it holds a VkInstance.)

This needs to exist for things beyond the instance, such as devices.

We considered adding a section for platform-specific function pointers to function_pointers.h after this code review comment: https://chromium-review.googlesource.com/c/chromium/src/+/1332608/11/gpu/vulkan/android/vulkan_implementation_android.cc#56
But that caused a problem.

When code outside of gpu/vulkan includes gpu/vulkan/function_pointers.h it doesn't have the Vulkan platform define that enables platform-specific functions.

We could add this define to every BUILD.gn which might include gpu/vulkan/function_pointers.h. But that isn't very future-proof. And debugging it is very painful. This would be setting a trap for some poor developer.

We could just add this to the top of function_pointers.h:
#if defined(OS_ANDROID)
  #define PLATFORM_SPECIFIC_VULKAN_FLAG
#endif
But then we're sensitive to include order. We found existing code which includes some other file before including function_pointers.h. If that other file includes <vulkan/vulkan.h> first then the include guard prevents the platform-specific flag from taking effect. This has the same "trap" qualities as the previous solution. It is very hard to debug and isn't future-proof.

We have already solved this issue for Vulkan instances. We have a platform-abstraction that only needs to know these details within gpu/vulkan. There is no sensitivity to include order or defines in other components.

So we need to expand this solution beyond instances. That will let us use platform-specific VkDevice functions.
 

Sign in to add a comment