mirror of https://gitlab.freedesktop.org/mesa/mesa
vulkan: Add helper to resolve Android external format
Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29090>
This commit is contained in:
parent
12092d1ac7
commit
270ee65667
|
@ -22,6 +22,9 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <vulkan/vulkan_android.h>
|
||||
|
||||
#include "vk_format.h"
|
||||
|
||||
#include "vk_enum_defines.h"
|
||||
|
@ -847,3 +850,17 @@ vk_swizzle_color_value(VkClearColorValue color,
|
|||
swizzled_color_component(&color, swizzle.a, 3, is_int),
|
||||
}};
|
||||
}
|
||||
|
||||
VkFormat
|
||||
vk_select_android_external_format(const void *next, VkFormat default_format)
|
||||
{
|
||||
const VkExternalFormatANDROID *android_format = vk_find_struct_const(next, EXTERNAL_FORMAT_ANDROID);
|
||||
|
||||
if (android_format && android_format->externalFormat) {
|
||||
assert(default_format == VK_FORMAT_UNDEFINED);
|
||||
assert((VkFormat)android_format->externalFormat != VK_FORMAT_UNDEFINED);
|
||||
return (VkFormat)android_format->externalFormat;
|
||||
}
|
||||
|
||||
return default_format;
|
||||
}
|
||||
|
|
|
@ -264,6 +264,9 @@ VkClearColorValue
|
|||
vk_swizzle_color_value(VkClearColorValue color,
|
||||
VkComponentMapping swizzle, bool is_int);
|
||||
|
||||
VkFormat
|
||||
vk_select_android_external_format(const void *next, VkFormat default_format);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue