vulkan/android: Add missing AHB formats

Signed-off-by: dawnhan <dawnhan@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30310>
This commit is contained in:
dawnhan 2024-07-22 15:39:23 -07:00 committed by Marge Bot
parent ceece45b2b
commit 6df5ace3a3
2 changed files with 15 additions and 0 deletions

View File

@ -158,6 +158,13 @@ enum AHardwareBuffer_Format {
* cube-maps or multi-layered textures.
*/
AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 = 0x23,
/**
* Corresponding formats:
* Vulkan: VK_FORMAT_R8_UNORM
* OpenGL ES: GR_GL_R8
*/
AHARDWAREBUFFER_FORMAT_R8_UNORM = 0x38,
};
/**

View File

@ -403,6 +403,10 @@ vk_ahb_format_to_image_format(uint32_t ahb_format)
return VK_FORMAT_D32_SFLOAT_S8_UINT;
case AHARDWAREBUFFER_FORMAT_S8_UINT:
return VK_FORMAT_S8_UINT;
#if ANDROID_API_LEVEL >= 33
case AHARDWAREBUFFER_FORMAT_R8_UNORM:
return VK_FORMAT_R8_UNORM;
#endif
default:
return VK_FORMAT_UNDEFINED;
}
@ -440,6 +444,10 @@ vk_image_format_to_ahb_format(VkFormat vk_format)
return AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT;
case VK_FORMAT_S8_UINT:
return AHARDWAREBUFFER_FORMAT_S8_UINT;
#if ANDROID_API_LEVEL >= 33
case VK_FORMAT_R8_UNORM:
return AHARDWAREBUFFER_FORMAT_R8_UNORM;
#endif
default:
return 0;
}