diff options
| author | 2023-03-22 08:05:41 +0000 | |
|---|---|---|
| committer | 2023-03-22 08:05:41 +0000 | |
| commit | 600b5dd24733155c3f52cdda7c94a0627bd10a3d (patch) | |
| tree | 11ab4ced6bef7fda4d825e9b9cbd8c90ea6600f2 | |
| parent | 22ebfd21195ec18b6f147e8d8669d870356a25b9 (diff) | |
| parent | 56df2453e7bbe7ac592c2e04754a9e095a6163e6 (diff) | |
Merge "Explicitly query for VK_EXT_rgba10x6_formats in Vulkan" am: 7ac34d3210 am: 56df2453e7
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2472765
Change-Id: I32a5130d168fa5dbf2fbcf756d4c1d9090ba801c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/nativewindow/include/android/hardware_buffer.h | 4 | ||||
| -rw-r--r-- | vulkan/libvulkan/swapchain.cpp | 19 |
2 files changed, 18 insertions, 5 deletions
diff --git a/libs/nativewindow/include/android/hardware_buffer.h b/libs/nativewindow/include/android/hardware_buffer.h index 85a524988d..21798d0e29 100644 --- a/libs/nativewindow/include/android/hardware_buffer.h +++ b/libs/nativewindow/include/android/hardware_buffer.h @@ -177,14 +177,14 @@ enum AHardwareBuffer_Format { /** * Corresponding formats: * Vulkan: VK_FORMAT_R16_UINT - * OpenGL ES: GR_GL_R16UI + * OpenGL ES: GL_R16UI */ AHARDWAREBUFFER_FORMAT_R16_UINT = 0x39, /** * Corresponding formats: * Vulkan: VK_FORMAT_R16G16_UINT - * OpenGL ES: GR_GL_RG16UI + * OpenGL ES: GL_RG16UI */ AHARDWAREBUFFER_FORMAT_R16G16_UINT = 0x3a, diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp index e9935e5781..c46036a5e2 100644 --- a/vulkan/libvulkan/swapchain.cpp +++ b/vulkan/libvulkan/swapchain.cpp @@ -508,7 +508,6 @@ android::PixelFormat GetNativePixelFormat(VkFormat format) { case VK_FORMAT_R8_UNORM: native_format = android::PIXEL_FORMAT_R_8; break; - // TODO: Do we need to query for VK_EXT_rgba10x6_formats here? case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: native_format = android::PIXEL_FORMAT_RGBA_10101010; break; @@ -859,9 +858,23 @@ VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev, } } - // TODO query VK_EXT_rgba10x6_formats support + bool rgba10x6_formats_ext = false; + uint32_t exts_count; + const auto& driver = GetData(pdev).driver; + driver.EnumerateDeviceExtensionProperties(pdev, nullptr, &exts_count, + nullptr); + std::vector<VkExtensionProperties> props(exts_count); + driver.EnumerateDeviceExtensionProperties(pdev, nullptr, &exts_count, + props.data()); + for (uint32_t i = 0; i < exts_count; i++) { + VkExtensionProperties prop = props[i]; + if (strcmp(prop.extensionName, + VK_EXT_RGBA10X6_FORMATS_EXTENSION_NAME) == 0) { + rgba10x6_formats_ext = true; + } + } desc.format = AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM; - if (AHardwareBuffer_isSupported(&desc)) { + if (AHardwareBuffer_isSupported(&desc) && rgba10x6_formats_ext) { all_formats.emplace_back( VkSurfaceFormatKHR{VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR}); |