aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gpu/graphite/Caps.h7
-rw-r--r--src/gpu/graphite/vk/VulkanCaps.cpp7
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 =