diff options
author | Robert Phillips <robertphillips@google.com> | 2023-12-12 14:19:36 -0500 |
---|---|---|
committer | SkCQ <skcq-be@skia-corp.google.com.iam.gserviceaccount.com> | 2023-12-12 21:16:09 +0000 |
commit | 49e32eb178a7b6ed5c598182329bf4f21e51157d (patch) | |
tree | 13907a894d2a7e3686ac0d9f6c548793af00391f | |
parent | 8e8d92ac15366f61d5566a09a34b4b069b7fb3c2 (diff) | |
download | skia-49e32eb178a7b6ed5c598182329bf4f21e51157d.tar.gz |
[graphite] Add Caps::supportsAHardwareBufferImages
Change-Id: Ib9ad8086d54aa6dd58c7bb9bcefc864a27f7c8e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/789157
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Nicolette Prevost <nicolettep@google.com>
-rw-r--r-- | src/gpu/graphite/Caps.h | 7 | ||||
-rw-r--r-- | src/gpu/graphite/vk/VulkanCaps.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/gpu/graphite/Caps.h b/src/gpu/graphite/Caps.h index 0f6bc2904c..0175594892 100644 --- a/src/gpu/graphite/Caps.h +++ b/src/gpu/graphite/Caps.h @@ -212,6 +212,12 @@ public: // Returns whether compute shaders are supported. bool computeSupport() const { return fComputeSupport; } + /** + * Returns true if the given backend supports importing AHardwareBuffers. This will only + * ever be supported on Android devices with API level >= 26. + */ + bool supportsAHardwareBufferImages() const { return fSupportsAHardwareBufferImages; } + // Returns the skgpu::Swizzle to use when sampling or reading back from a texture with the // passed in SkColorType and TextureInfo. skgpu::Swizzle getReadSwizzle(SkColorType, const TextureInfo&) const; @@ -308,6 +314,7 @@ protected: bool fMSAARenderToSingleSampledSupport = false; bool fComputeSupport = false; + bool fSupportsAHardwareBufferImages = false; ResourceBindingRequirements fResourceBindingReqs; diff --git a/src/gpu/graphite/vk/VulkanCaps.cpp b/src/gpu/graphite/vk/VulkanCaps.cpp index e4f7c5adcd..95e900da83 100644 --- a/src/gpu/graphite/vk/VulkanCaps.cpp +++ b/src/gpu/graphite/vk/VulkanCaps.cpp @@ -128,6 +128,13 @@ void VulkanCaps::init(const ContextOptions& contextOptions, } fMaxUniformBufferRange = physDevProperties.limits.maxUniformBufferRange; +#ifdef SK_BUILD_FOR_ANDROID + if (extensions->hasExtension( + VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, 2)) { + fSupportsAHardwareBufferImages = true; + } +#endif + // Determine whether the client enabled certain physical device features. if (features) { auto ycbcrFeatures = |