#ifndef SRC_DAWN_UTILS_TEXTUREUTILS_H_
#define SRC_DAWN_UTILS_TEXTUREUTILS_H_
#include <webgpu/webgpu_cpp.h>
#include <array>
#include "dawn/common/Assert.h"
namespace dawn::utils {
#ifndef __EMSCRIPTEN__
static constexpr std::array<wgpu::TextureFormat, 101> kAllTextureFormats = …;
#endif
static constexpr std::array<wgpu::TextureFormat, 41> kFormatsInCoreSpec = …;
static constexpr std::array<wgpu::TextureFormat, 14> kBCFormats = …;
static constexpr std::array<wgpu::TextureFormat, 10> kETC2Formats = …;
static constexpr std::array<wgpu::TextureFormat, 28> kASTCFormats = …;
static constexpr std::array<wgpu::TextureFormat, 52> kCompressedFormats = …;
static_assert …;
#ifndef __EMSCRIPTEN__
static constexpr std::array<wgpu::TextureFormat, 6> kNorm16Formats = …;
#endif
static constexpr std::array<wgpu::TextureFormat, 5> kDepthFormats = …;
static constexpr std::array<wgpu::TextureFormat, 3> kStencilFormats = …;
static constexpr std::array<wgpu::TextureFormat, 2> kDepthAndStencilFormats = …;
class SubsamplingFactor { … };
bool TextureFormatSupportsStorageTexture(wgpu::TextureFormat format,
const wgpu::Device& device,
bool isCompatibilityMode);
bool TextureFormatSupportsReadWriteStorageTexture(wgpu::TextureFormat format);
bool IsBCTextureFormat(wgpu::TextureFormat textureFormat);
bool IsETC2TextureFormat(wgpu::TextureFormat textureFormat);
bool IsASTCTextureFormat(wgpu::TextureFormat textureFormat);
bool IsCompressedTextureFormat(wgpu::TextureFormat textureFormat);
bool IsDepthOnlyFormat(wgpu::TextureFormat textureFormat);
bool IsStencilOnlyFormat(wgpu::TextureFormat textureFormat);
bool IsDepthOrStencilFormat(wgpu::TextureFormat textureFormat);
bool IsRenderableFormat(const wgpu::Device& device, wgpu::TextureFormat textureFormat);
bool TextureFormatSupportsMultisampling(const wgpu::Device& device,
wgpu::TextureFormat textureFormat);
bool TextureFormatSupportsResolveTarget(const wgpu::Device& device,
wgpu::TextureFormat textureFormat);
#ifndef __EMSCRIPTEN__
bool IsUnorm16TextureFormat(wgpu::TextureFormat textureFormat);
bool IsSnorm16TextureFormat(wgpu::TextureFormat textureFormat);
bool IsMultiPlanarFormat(wgpu::TextureFormat textureFormat);
uint32_t GetMultiPlaneTextureBitDepth(wgpu::TextureFormat textureFormat);
uint32_t GetMultiPlaneTextureNumPlanes(wgpu::TextureFormat textureFormat);
uint32_t GetMultiPlaneTextureBytesPerElement(wgpu::TextureFormat textureFormat, size_t plane);
SubsamplingFactor GetMultiPlaneTextureSubsamplingFactor(wgpu::TextureFormat textureFormat,
size_t plane);
#endif
uint32_t GetTexelBlockSizeInBytes(wgpu::TextureFormat textureFormat);
uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat);
uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat);
const char* GetWGSLColorTextureComponentType(wgpu::TextureFormat textureFormat);
const char* GetWGSLImageFormatQualifier(wgpu::TextureFormat textureFormat);
uint32_t GetTextureComponentCount(wgpu::TextureFormat textureFormat);
wgpu::TextureDimension ViewDimensionToTextureDimension(const wgpu::TextureViewDimension dimension);
}
#endif