#ifndef UI_GFX_BUFFER_FORMAT_UTIL_H_
#define UI_GFX_BUFFER_FORMAT_UTIL_H_
#include <stddef.h>
#include <vector>
#include "base/containers/span.h"
#include "gpu/vulkan/buildflags.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gfx_export.h"
#if BUILDFLAG(ENABLE_VULKAN)
#include <vulkan/vulkan_core.h>
#endif
namespace gfx {
GFX_EXPORT base::span<const BufferFormat> GetBufferFormatsForTesting();
GFX_EXPORT size_t AlphaBitsForBufferFormat(BufferFormat format);
GFX_EXPORT size_t NumberOfPlanesForLinearBufferFormat(BufferFormat format);
GFX_EXPORT bool BufferFormatIsMultiplanar(BufferFormat format);
GFX_EXPORT size_t SubsamplingFactorForBufferFormat(BufferFormat format,
size_t plane);
GFX_EXPORT size_t RowByteAlignmentForBufferFormat(BufferFormat format,
size_t plane);
GFX_EXPORT size_t RowSizeForBufferFormat(size_t width,
BufferFormat format,
size_t plane);
[[nodiscard]] GFX_EXPORT bool RowSizeForBufferFormatChecked(
size_t width,
BufferFormat format,
size_t plane,
size_t* size_in_bytes);
GFX_EXPORT size_t PlaneSizeForBufferFormat(const Size& size,
BufferFormat format,
size_t plane);
[[nodiscard]] GFX_EXPORT bool PlaneSizeForBufferFormatChecked(
const Size& size,
BufferFormat format,
size_t plane,
size_t* size_in_bytes);
GFX_EXPORT size_t BufferSizeForBufferFormat(const Size& size,
BufferFormat format);
[[nodiscard]] GFX_EXPORT bool BufferSizeForBufferFormatChecked(
const Size& size,
BufferFormat format,
size_t* size_in_bytes);
GFX_EXPORT size_t BufferOffsetForBufferFormat(const Size& size,
BufferFormat format,
size_t plane);
GFX_EXPORT const char* BufferFormatToString(BufferFormat format);
GFX_EXPORT bool IsOddHeightMultiPlanarBuffersAllowed();
GFX_EXPORT bool IsOddWidthMultiPlanarBuffersAllowed();
#if BUILDFLAG(ENABLE_VULKAN)
GFX_EXPORT constexpr VkFormat ToVkFormat(const BufferFormat format) { … }
#endif
}
#endif