Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 194ff5e7 authored by Trevor Black's avatar Trevor Black Committed by Automerger Merge Worker
Browse files

Merge "Explicitly query for VK_EXT_rgba10x6_formats in Vulkan" am: 7ac34d32...

Merge "Explicitly query for VK_EXT_rgba10x6_formats in Vulkan" am: 7ac34d32 am: 56df2453 am: 600b5dd2 am: c9572db2 am: 10ec7bf2

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2472765



Change-Id: I10c31ceff22c43fc496d07c9410cbd69c17282d5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 974a4501 10ec7bf2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -177,14 +177,14 @@ enum AHardwareBuffer_Format {
    /**
    /**
     * Corresponding formats:
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R16_UINT
     *   Vulkan: VK_FORMAT_R16_UINT
     *   OpenGL ES: GR_GL_R16UI
     *   OpenGL ES: GL_R16UI
     */
     */
    AHARDWAREBUFFER_FORMAT_R16_UINT                 = 0x39,
    AHARDWAREBUFFER_FORMAT_R16_UINT                 = 0x39,


    /**
    /**
     * Corresponding formats:
     * Corresponding formats:
     *   Vulkan: VK_FORMAT_R16G16_UINT
     *   Vulkan: VK_FORMAT_R16G16_UINT
     *   OpenGL ES: GR_GL_RG16UI
     *   OpenGL ES: GL_RG16UI
     */
     */
    AHARDWAREBUFFER_FORMAT_R16G16_UINT              = 0x3a,
    AHARDWAREBUFFER_FORMAT_R16G16_UINT              = 0x3a,


+16 −3
Original line number Original line Diff line number Diff line
@@ -514,7 +514,6 @@ android::PixelFormat GetNativePixelFormat(VkFormat format) {
        case VK_FORMAT_R8_UNORM:
        case VK_FORMAT_R8_UNORM:
            native_format = android::PIXEL_FORMAT_R_8;
            native_format = android::PIXEL_FORMAT_R_8;
            break;
            break;
        // TODO: Do we need to query for VK_EXT_rgba10x6_formats here?
        case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:
        case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:
            native_format = android::PIXEL_FORMAT_RGBA_10101010;
            native_format = android::PIXEL_FORMAT_RGBA_10101010;
            break;
            break;
@@ -805,9 +804,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;
    desc.format = AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM;
    if (AHardwareBuffer_isSupported(&desc)) {
    if (AHardwareBuffer_isSupported(&desc) && rgba10x6_formats_ext) {
        all_formats.emplace_back(
        all_formats.emplace_back(
            VkSurfaceFormatKHR{VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,
            VkSurfaceFormatKHR{VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,
                               VK_COLOR_SPACE_SRGB_NONLINEAR_KHR});
                               VK_COLOR_SPACE_SRGB_NONLINEAR_KHR});