blob: 06b14bcb470cc8e74cd3d24e46cd48611eb9ffff [file] [log] [blame]
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_wgpu_format_table.py using data from wgpu_format_map.json
//
// Copyright 2024 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// wgpu_format_table_autogen.cpp:
// Queries for full WebGPU format information based on GL format.
#include "libANGLE/renderer/wgpu/wgpu_format_utils.h"
#include "image_util/loadimage.h"
using namespace angle;
namespace rx
{
namespace webgpu
{
void Format::initialize(const angle::Format &angleFormat)
{
switch (angleFormat.id)
{
case angle::FormatID::A16_FLOAT:
mIntendedGLFormat = GL_ALPHA16F_EXT;
mActualImageFormatID = angle::FormatID::R16_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::A1R5G5B5_UNORM:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::A2R10G10B10_SINT_VERTEX:
mIntendedGLFormat = GL_INT_10_10_10_2_OES;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SINT;
mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<true, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::A2R10G10B10_SNORM_VERTEX:
mIntendedGLFormat = GL_A2_RGB10_SNORM_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SNORM;
mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<true, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::A2R10G10B10_SSCALED_VERTEX:
mIntendedGLFormat = GL_A2_RGB10_SSCALED_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<true, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::A2R10G10B10_UINT_VERTEX:
mIntendedGLFormat = GL_UNSIGNED_INT_10_10_10_2_OES;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UINT;
mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<false, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::A2R10G10B10_UNORM_VERTEX:
mIntendedGLFormat = GL_A2_RGB10_UNORM_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<false, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::A2R10G10B10_USCALED_VERTEX:
mIntendedGLFormat = GL_A2_RGB10_USCALED_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyW2XYZ10ToXYZWFloatVertexData<false, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::A32_FLOAT:
mIntendedGLFormat = GL_ALPHA32F_EXT;
mActualImageFormatID = angle::FormatID::R32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::A8_UNORM:
mIntendedGLFormat = GL_ALPHA8_EXT;
mActualImageFormatID = angle::FormatID::R8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ASTC_10x10_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x10_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x10_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x10_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x5_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x5_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x5_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x5_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x6_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x6_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x6_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x6_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x8_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x8_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_10x8_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_10x8_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_12x10_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_12x10_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_12x10_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_12x10_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_12x12_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_12x12_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_12x12_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_12x12_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_3x3x3_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_3x3x3_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_4x3x3_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_4x3x3_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_4x4_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_4x4_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_4x4_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_4x4_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_4x4x3_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_4x4x3_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_4x4x4_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_4x4x4_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_5x4_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_5x4_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_5x4_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_5x4_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_5x4x4_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_5x4x4_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_5x5_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_5x5_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_5x5_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_5x5_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_5x5x4_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_5x5x4_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_5x5x5_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_5x5x5_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_6x5_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_6x5_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_6x5_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_6x5_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_6x5x5_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_6x5x5_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_6x6_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_6x6_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_6x6_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_6x6_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_6x6x5_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_6x6x5_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_6x6x6_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_6x6x6_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ASTC_8x5_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_8x5_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_8x5_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_8x5_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_8x6_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_8x6_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_8x6_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_8x6_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_8x8_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_8x8_SRGB_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ASTC_8x8_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ASTC_8x8_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::B10G10R10A2_UNORM:
mIntendedGLFormat = GL_BGR10_A2_ANGLEX;
mActualImageFormatID = angle::FormatID::R10G10B10A2_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::B4G4R4A4_UNORM:
mIntendedGLFormat = GL_BGRA4_ANGLEX;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::B5G5R5A1_UNORM:
mIntendedGLFormat = GL_BGR5_A1_ANGLEX;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::B5G6R5_UNORM:
mIntendedGLFormat = GL_BGR565_ANGLEX;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::B8G8R8A8_TYPELESS:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::B8G8R8A8_TYPELESS_SRGB:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::B8G8R8A8_UNORM:
mIntendedGLFormat = GL_BGRA8_EXT;
mActualImageFormatID = angle::FormatID::B8G8R8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::B8G8R8A8_UNORM_SRGB:
mIntendedGLFormat = GL_BGRA8_SRGB_ANGLEX;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::B8G8R8A8_UNORM_SRGB, nullptr},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::B8G8R8X8_UNORM:
mIntendedGLFormat = GL_BGRX8_ANGLEX;
mActualImageFormatID = angle::FormatID::B8G8R8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::NONE;
mVertexLoadFunction = nullptr;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::B8G8R8X8_UNORM_SRGB:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::BC1_RGBA_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
mActualImageFormatID = angle::FormatID::BC1_RGBA_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
mActualImageFormatID = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC1_RGB_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::BC2_RGBA_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
mActualImageFormatID = angle::FormatID::BC2_RGBA_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
mActualImageFormatID = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC3_RGBA_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
mActualImageFormatID = angle::FormatID::BC3_RGBA_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
mActualImageFormatID = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC4_RED_SNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SIGNED_RED_RGTC1_EXT;
mActualImageFormatID = angle::FormatID::BC4_RED_SNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
break;
case angle::FormatID::BC4_RED_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RED_RGTC1_EXT;
mActualImageFormatID = angle::FormatID::BC4_RED_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC5_RG_SNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
mActualImageFormatID = angle::FormatID::BC5_RG_SNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
break;
case angle::FormatID::BC5_RG_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RED_GREEN_RGTC2_EXT;
mActualImageFormatID = angle::FormatID::BC5_RG_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC6H_RGB_SFLOAT_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
mActualImageFormatID = angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC6H_RGB_UFLOAT_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
mActualImageFormatID = angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC7_RGBA_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_EXT;
mActualImageFormatID = angle::FormatID::BC7_RGBA_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;
mActualImageFormatID = angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::D16_UNORM:
mIntendedGLFormat = GL_DEPTH_COMPONENT16;
mActualImageFormatID = angle::FormatID::D16_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::D24_UNORM_S8_UINT:
mIntendedGLFormat = GL_DEPTH24_STENCIL8;
mActualImageFormatID = angle::FormatID::D24_UNORM_S8_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::D24_UNORM_X8_UINT:
mIntendedGLFormat = GL_DEPTH_COMPONENT24;
mActualImageFormatID = angle::FormatID::D24_UNORM_S8_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::D32_FLOAT:
mIntendedGLFormat = GL_DEPTH_COMPONENT32F;
mActualImageFormatID = angle::FormatID::D32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::D32_FLOAT_S8X24_UINT:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::D32_UNORM:
mIntendedGLFormat = GL_DEPTH_COMPONENT32_OES;
mActualImageFormatID = angle::FormatID::D32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::NONE;
mVertexLoadFunction = nullptr;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::EAC_R11G11_SNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SIGNED_RG11_EAC;
mActualImageFormatID = angle::FormatID::EAC_R11G11_SNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
break;
case angle::FormatID::EAC_R11G11_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RG11_EAC;
mActualImageFormatID = angle::FormatID::EAC_R11G11_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::EAC_R11_SNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SIGNED_R11_EAC;
mActualImageFormatID = angle::FormatID::EAC_R11_SNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
break;
case angle::FormatID::EAC_R11_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_R11_EAC;
mActualImageFormatID = angle::FormatID::EAC_R11_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::ETC1_R8G8B8_UNORM_BLOCK:
mIntendedGLFormat = GL_ETC1_RGB8_OES;
mActualImageFormatID = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
mActualImageFormatID = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
mActualImageFormatID = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
mActualImageFormatID = angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
{
static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, nullptr},
{angle::FormatID::R8G8B8A8_UNORM, nullptr}};
initImageFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_SRGB8_ETC2;
mActualImageFormatID = angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK:
mIntendedGLFormat = GL_COMPRESSED_RGB8_ETC2;
mActualImageFormatID = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::EXTERNAL0:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL0;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL0;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL1:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL1;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL1;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL2:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL2;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL2;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL3:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL3;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL3;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL4:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL4;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL4;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL5:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL5;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL5;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL6:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL6;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL6;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::EXTERNAL7:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::EXTERNAL7;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::EXTERNAL7;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::G8_B8R8_2PLANE_420_UNORM:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::G8_B8_R8_3PLANE_420_UNORM:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::L16A16_FLOAT:
mIntendedGLFormat = GL_LUMINANCE_ALPHA16F_EXT;
mActualImageFormatID = angle::FormatID::R16G16_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::L16_FLOAT:
mIntendedGLFormat = GL_LUMINANCE16F_EXT;
mActualImageFormatID = angle::FormatID::R16_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::L32A32_FLOAT:
mIntendedGLFormat = GL_LUMINANCE_ALPHA32F_EXT;
mActualImageFormatID = angle::FormatID::R32G32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::L32_FLOAT:
mIntendedGLFormat = GL_LUMINANCE32F_EXT;
mActualImageFormatID = angle::FormatID::R32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::L4A4_UNORM:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::L8A8_UNORM:
mIntendedGLFormat = GL_LUMINANCE8_ALPHA8_EXT;
mActualImageFormatID = angle::FormatID::R8G8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::L8_UNORM:
mIntendedGLFormat = GL_LUMINANCE8_EXT;
mActualImageFormatID = angle::FormatID::R8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::NONE:
mIntendedGLFormat = GL_NONE;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::NONE;
mVertexLoadFunction = nullptr;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::PALETTE4_R4G4B4A4_UNORM:
mIntendedGLFormat = GL_PALETTE4_RGBA4_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE4_R5G5B5A1_UNORM:
mIntendedGLFormat = GL_PALETTE4_RGB5_A1_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE4_R5G6B5_UNORM:
mIntendedGLFormat = GL_PALETTE4_R5_G6_B5_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE4_R8G8B8A8_UNORM:
mIntendedGLFormat = GL_PALETTE4_RGBA8_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE4_R8G8B8_UNORM:
mIntendedGLFormat = GL_PALETTE4_RGB8_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE8_R4G4B4A4_UNORM:
mIntendedGLFormat = GL_PALETTE8_RGBA4_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE8_R5G5B5A1_UNORM:
mIntendedGLFormat = GL_PALETTE8_RGB5_A1_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE8_R5G6B5_UNORM:
mIntendedGLFormat = GL_PALETTE8_R5_G6_B5_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE8_R8G8B8A8_UNORM:
mIntendedGLFormat = GL_PALETTE8_RGBA8_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PALETTE8_R8G8B8_UNORM:
mIntendedGLFormat = GL_PALETTE8_RGB8_OES;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R10G10B10A2_SINT:
mIntendedGLFormat = GL_RGB10_A2_SINT_ANGLEX;
mActualImageFormatID = angle::FormatID::R10G10B10A2_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R10G10B10A2_SNORM:
mIntendedGLFormat = GL_RGB10_A2_SNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SNORM;
mVertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<true, true, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R10G10B10A2_SSCALED:
mIntendedGLFormat = GL_RGB10_A2_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<true, false, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R10G10B10A2_UINT:
mIntendedGLFormat = GL_RGB10_A2UI;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UINT;
mVertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<false, false, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R10G10B10A2_UNORM:
mIntendedGLFormat = GL_RGB10_A2;
mActualImageFormatID = angle::FormatID::R10G10B10A2_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R10G10B10A2_UNORM;
mVertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<false, true, true, true>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R10G10B10A2_USCALED:
mIntendedGLFormat = GL_RGB10_A2_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyXYZ10W2ToXYZWFloatVertexData<false, false, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R10G10B10X2_UNORM:
mIntendedGLFormat = GL_RGB10_EXT;
mActualImageFormatID = angle::FormatID::R10G10B10A2_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::NONE;
mVertexLoadFunction = nullptr;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R10X6G10X6B10X6A10X6_UNORM:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R11G11B10_FLOAT:
mIntendedGLFormat = GL_R11F_G11F_B10F;
mActualImageFormatID = angle::FormatID::R11G11B10_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R16G16B16A16_FLOAT:
mIntendedGLFormat = GL_RGBA16F;
mActualImageFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLhalf, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16B16A16_SINT:
mIntendedGLFormat = GL_RGBA16I;
mActualImageFormatID = angle::FormatID::R16G16B16A16_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16B16A16_SNORM:
mIntendedGLFormat = GL_RGBA16_SNORM_EXT;
mActualImageFormatID = angle::FormatID::R16G16B16A16_SNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SNORM;
mVertexLoadFunction = CopyNativeVertexData<GLshort, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16B16A16_SSCALED:
mIntendedGLFormat = GL_RGBA16_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLshort, 4, 4, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16A16_UINT:
mIntendedGLFormat = GL_RGBA16UI;
mActualImageFormatID = angle::FormatID::R16G16B16A16_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16B16A16_UNORM:
mIntendedGLFormat = GL_RGBA16_EXT;
mActualImageFormatID = angle::FormatID::R16G16B16A16_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UNORM;
mVertexLoadFunction = CopyNativeVertexData<GLushort, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16B16A16_USCALED:
mIntendedGLFormat = GL_RGBA16_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLushort, 4, 4, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16_FLOAT:
mIntendedGLFormat = GL_RGB16F;
mActualImageFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mImageInitializerFunction =
Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16_SINT:
mIntendedGLFormat = GL_RGB16I;
mActualImageFormatID = angle::FormatID::R16G16B16A16_SINT;
mImageInitializerFunction =
Initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001>;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLshort, 3, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16_SNORM:
mIntendedGLFormat = GL_RGB16_SNORM_EXT;
mActualImageFormatID = angle::FormatID::R16G16B16A16_SNORM;
mImageInitializerFunction =
Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x7FFF>;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLshort, 3, 4, std::numeric_limits<GLshort>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16_SSCALED:
mIntendedGLFormat = GL_RGB16_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLshort, 3, 4, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16_UINT:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R16G16B16_UNORM:
mIntendedGLFormat = GL_RGB16_EXT;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLushort, 3, 4, std::numeric_limits<GLushort>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16B16_USCALED:
mIntendedGLFormat = GL_RGB16_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLushort, 3, 4, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16_FLOAT:
mIntendedGLFormat = GL_RG16F;
mActualImageFormatID = angle::FormatID::R16G16_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLhalf, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16_SINT:
mIntendedGLFormat = GL_RG16I;
mActualImageFormatID = angle::FormatID::R16G16_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16_SNORM:
mIntendedGLFormat = GL_RG16_SNORM_EXT;
mActualImageFormatID = angle::FormatID::R16G16_SNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R16G16_SNORM;
mVertexLoadFunction = CopyNativeVertexData<GLshort, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16_SSCALED:
mIntendedGLFormat = GL_RG16_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLshort, 2, 2, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16G16_UINT:
mIntendedGLFormat = GL_RG16UI;
mActualImageFormatID = angle::FormatID::R16G16_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16_UNORM:
mIntendedGLFormat = GL_RG16_EXT;
mActualImageFormatID = angle::FormatID::R16G16_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16_UNORM;
mVertexLoadFunction = CopyNativeVertexData<GLushort, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R16G16_USCALED:
mIntendedGLFormat = GL_RG16_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLushort, 2, 2, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16_FLOAT:
mIntendedGLFormat = GL_R16F;
mActualImageFormatID = angle::FormatID::R16_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R16_SINT:
mIntendedGLFormat = GL_R16I;
mActualImageFormatID = angle::FormatID::R16_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R16_SNORM:
mIntendedGLFormat = GL_R16_SNORM_EXT;
mActualImageFormatID = angle::FormatID::R16_SNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
break;
case angle::FormatID::R16_SSCALED:
mIntendedGLFormat = GL_R16_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLshort, 1, 1, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16_UINT:
mIntendedGLFormat = GL_R16UI;
mActualImageFormatID = angle::FormatID::R16_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R16_UNORM:
mIntendedGLFormat = GL_R16_EXT;
mActualImageFormatID = angle::FormatID::R16_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16_UNORM;
mVertexLoadFunction = CopyNativeVertexData<GLushort, 1, 2, 0>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R16_USCALED:
mIntendedGLFormat = GL_R16_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLushort, 1, 1, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32A32_FIXED:
mIntendedGLFormat = GL_RGBA32_FIXED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = Copy32FixedTo32FVertexData<4, 4>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32A32_FLOAT:
mIntendedGLFormat = GL_RGBA32F;
mActualImageFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLfloat, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32B32A32_SINT:
mIntendedGLFormat = GL_RGBA32I;
mActualImageFormatID = angle::FormatID::R32G32B32A32_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLint, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32B32A32_SNORM:
mIntendedGLFormat = GL_RGBA32_SNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 4, 4, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32A32_SSCALED:
mIntendedGLFormat = GL_RGBA32_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 4, 4, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32A32_UINT:
mIntendedGLFormat = GL_RGBA32UI;
mActualImageFormatID = angle::FormatID::R32G32B32A32_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLuint, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32B32A32_UNORM:
mIntendedGLFormat = GL_RGBA32_UNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 4, 4, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32A32_USCALED:
mIntendedGLFormat = GL_RGBA32_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 4, 4, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32_FIXED:
mIntendedGLFormat = GL_RGB32_FIXED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
mVertexLoadFunction = Copy32FixedTo32FVertexData<3, 3>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32_FLOAT:
mIntendedGLFormat = GL_RGB32F;
mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLfloat, 3, 3, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32B32_SINT:
mIntendedGLFormat = GL_RGB32I;
mActualImageFormatID = angle::FormatID::R32G32B32A32_SINT;
mImageInitializerFunction =
Initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32B32_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLint, 3, 3, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32B32_SNORM:
mIntendedGLFormat = GL_RGB32_SNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 3, 3, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32_SSCALED:
mIntendedGLFormat = GL_RGB32_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 3, 3, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32_UINT:
mIntendedGLFormat = GL_RGB32UI;
{
static constexpr BufferFormatInitInfo kInfo[] = {
{angle::FormatID::R32G32B32_UINT, CopyNativeVertexData<GLuint, 3, 3, 0>, false},
{angle::FormatID::R32G32B32A32_UINT, CopyNativeVertexData<GLuint, 3, 4, 1>,
true}};
initBufferFallback(kInfo, ArraySize(kInfo));
}
break;
case angle::FormatID::R32G32B32_UNORM:
mIntendedGLFormat = GL_RGB32_UNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 3, 3, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32B32_USCALED:
mIntendedGLFormat = GL_RGB32_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32B32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 3, 3, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32_FIXED:
mIntendedGLFormat = GL_RG32_FIXED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = Copy32FixedTo32FVertexData<2, 2>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32_FLOAT:
mIntendedGLFormat = GL_RG32F;
mActualImageFormatID = angle::FormatID::R32G32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLfloat, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32_SINT:
mIntendedGLFormat = GL_RG32I;
mActualImageFormatID = angle::FormatID::R32G32_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLint, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32_SNORM:
mIntendedGLFormat = GL_RG32_SNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 2, 2, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32_SSCALED:
mIntendedGLFormat = GL_RG32_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 2, 2, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32_UINT:
mIntendedGLFormat = GL_RG32UI;
mActualImageFormatID = angle::FormatID::R32G32_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32G32_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLuint, 2, 2, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32G32_UNORM:
mIntendedGLFormat = GL_RG32_UNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 2, 2, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32G32_USCALED:
mIntendedGLFormat = GL_RG32_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32G32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 2, 2, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32_FIXED:
mIntendedGLFormat = GL_R32_FIXED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = Copy32FixedTo32FVertexData<1, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32_FLOAT:
mIntendedGLFormat = GL_R32F;
mActualImageFormatID = angle::FormatID::R32_FLOAT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyNativeVertexData<GLfloat, 1, 1, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32_SINT:
mIntendedGLFormat = GL_R32I;
mActualImageFormatID = angle::FormatID::R32_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLint, 1, 1, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32_SNORM:
mIntendedGLFormat = GL_R32_SNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 1, 1, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32_SSCALED:
mIntendedGLFormat = GL_R32_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLint, 1, 1, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32_UINT:
mIntendedGLFormat = GL_R32UI;
mActualImageFormatID = angle::FormatID::R32_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R32_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLuint, 1, 1, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R32_UNORM:
mIntendedGLFormat = GL_R32_UNORM_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 1, 1, true, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R32_USCALED:
mIntendedGLFormat = GL_R32_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLuint, 1, 1, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R4G4B4A4_UNORM:
mIntendedGLFormat = GL_RGBA4;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R5G5B5A1_UNORM:
mIntendedGLFormat = GL_RGB5_A1;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R5G6B5_UNORM:
mIntendedGLFormat = GL_RGB565;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
mIsRenderable = true;
break;
case angle::FormatID::R8G8B8A8_SINT:
mIntendedGLFormat = GL_RGBA8I;
mActualImageFormatID = angle::FormatID::R8G8B8A8_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R8G8B8A8_SNORM:
mIntendedGLFormat = GL_RGBA8_SNORM;
mActualImageFormatID = angle::FormatID::R8G8B8A8_SNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SNORM;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R8G8B8A8_SSCALED:
mIntendedGLFormat = GL_RGBA8_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLbyte, 4, 4, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8A8_TYPELESS:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R8G8B8A8_TYPELESS_SRGB:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R8G8B8A8_UINT:
mIntendedGLFormat = GL_RGBA8UI;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R8G8B8A8_UNORM:
mIntendedGLFormat = GL_RGBA8;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM;
mVertexLoadFunction = CopyNativeVertexData<GLubyte, 4, 4, 0>;
mVertexLoadRequiresConversion = false;
break;
case angle::FormatID::R8G8B8A8_UNORM_SRGB:
mIntendedGLFormat = GL_SRGB8_ALPHA8;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::R8G8B8A8_USCALED:
mIntendedGLFormat = GL_RGBA8_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLubyte, 4, 4, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8X8_UNORM:
mIntendedGLFormat = GL_RGBX8_ANGLE;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::NONE;
mVertexLoadFunction = nullptr;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8X8_UNORM_SRGB:
mIntendedGLFormat = GL_RGBX8_SRGB_ANGLEX;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::NONE;
mVertexLoadFunction = nullptr;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8_SINT:
mIntendedGLFormat = GL_RGB8I;
mActualImageFormatID = angle::FormatID::R8G8B8A8_SINT;
mImageInitializerFunction = Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01>;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 3, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8_SNORM:
mIntendedGLFormat = GL_RGB8_SNORM;
mActualImageFormatID = angle::FormatID::R8G8B8A8_SNORM;
mImageInitializerFunction = Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x7F>;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLbyte, 3, 4, std::numeric_limits<GLbyte>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8_SSCALED:
mIntendedGLFormat = GL_RGB8_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLbyte, 3, 4, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8_UINT:
mIntendedGLFormat = GL_RGB8UI;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UINT;
mImageInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01>;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLubyte, 3, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8_UNORM:
mIntendedGLFormat = GL_RGB8;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM;
mImageInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLubyte, 3, 4, std::numeric_limits<GLubyte>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8B8_UNORM_SRGB:
mIntendedGLFormat = GL_SRGB8;
mActualImageFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB;
mImageInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
mIsRenderable = true;
break;
case angle::FormatID::R8G8B8_USCALED:
mIntendedGLFormat = GL_RGB8_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLubyte, 3, 4, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8_SINT:
mIntendedGLFormat = GL_RG8I;
mActualImageFormatID = angle::FormatID::R8G8_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 2, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8_SNORM:
mIntendedGLFormat = GL_RG8_SNORM;
mActualImageFormatID = angle::FormatID::R8G8_SNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLbyte, 2, 4, std::numeric_limits<GLbyte>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8_SSCALED:
mIntendedGLFormat = GL_RG8_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLbyte, 2, 2, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8_UINT:
mIntendedGLFormat = GL_RG8UI;
mActualImageFormatID = angle::FormatID::R8G8_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLubyte, 2, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8_UNORM:
mIntendedGLFormat = GL_RG8;
mActualImageFormatID = angle::FormatID::R8G8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLubyte, 2, 4, std::numeric_limits<GLubyte>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8G8_UNORM_SRGB:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R8G8_USCALED:
mIntendedGLFormat = GL_RG8_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R16G16_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLubyte, 2, 2, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8_SINT:
mIntendedGLFormat = GL_R8I;
mActualImageFormatID = angle::FormatID::R8_SINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SINT;
mVertexLoadFunction = CopyNativeVertexData<GLbyte, 1, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8_SNORM:
mIntendedGLFormat = GL_R8_SNORM;
mActualImageFormatID = angle::FormatID::R8_SNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_SNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLbyte, 1, 4, std::numeric_limits<GLbyte>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8_SSCALED:
mIntendedGLFormat = GL_R8_SSCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLbyte, 1, 1, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8_UINT:
mIntendedGLFormat = GL_R8UI;
mActualImageFormatID = angle::FormatID::R8_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UINT;
mVertexLoadFunction = CopyNativeVertexData<GLubyte, 1, 4, 1>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8_UNORM:
mIntendedGLFormat = GL_R8;
mActualImageFormatID = angle::FormatID::R8_UNORM;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM;
mVertexLoadFunction =
CopyNativeVertexData<GLubyte, 1, 4, std::numeric_limits<GLubyte>::max()>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R8_UNORM_SRGB:
// This format is not implemented in WebGPU.
break;
case angle::FormatID::R8_USCALED:
mIntendedGLFormat = GL_R8_USCALED_ANGLEX;
mActualBufferFormatID = angle::FormatID::R32_FLOAT;
mVertexLoadFunction = CopyToFloatVertexData<GLubyte, 1, 1, false, false>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::R9G9B9E5_SHAREDEXP:
mIntendedGLFormat = GL_RGB9_E5;
mActualImageFormatID = angle::FormatID::R9G9B9E5_SHAREDEXP;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::S8_UINT:
mIntendedGLFormat = GL_STENCIL_INDEX8;
mActualImageFormatID = angle::FormatID::S8_UINT;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
break;
case angle::FormatID::X2R10G10B10_SINT_VERTEX:
mIntendedGLFormat = GL_X2_RGB10_SINT_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SINT;
mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<true, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::X2R10G10B10_SNORM_VERTEX:
mIntendedGLFormat = GL_X2_RGB10_SNORM_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = false;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_SNORM;
mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<true, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::X2R10G10B10_SSCALED_VERTEX:
mIntendedGLFormat = GL_X2_RGB10_SSCALED_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<true, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::X2R10G10B10_UINT_VERTEX:
mIntendedGLFormat = GL_X2_RGB10_UINT_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UINT;
mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<false, false, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::X2R10G10B10_UNORM_VERTEX:
mIntendedGLFormat = GL_X2_RGB10_UNORM_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_UNORM;
mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<false, true, true>;
mVertexLoadRequiresConversion = true;
break;
case angle::FormatID::X2R10G10B10_USCALED_VERTEX:
mIntendedGLFormat = GL_X2_RGB10_USCALED_ANGLEX;
mActualImageFormatID = angle::FormatID::NONE;
mImageInitializerFunction = nullptr;
mIsRenderable = true;
mActualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT;
mVertexLoadFunction = CopyXYZ10ToXYZWFloatVertexData<false, false, true>;
mVertexLoadRequiresConversion = true;
break;
default:
UNREACHABLE();
break;
}
}
WGPUTextureFormat GetWgpuTextureFormatFromFormatID(angle::FormatID formatID)
{
static constexpr angle::FormatMap<WGPUTextureFormat> kMap = {
{angle::FormatID::ASTC_10x10_SRGB_BLOCK, WGPUTextureFormat_ASTC10x10UnormSrgb},
{angle::FormatID::ASTC_10x10_UNORM_BLOCK, WGPUTextureFormat_ASTC10x10Unorm},
{angle::FormatID::ASTC_10x5_SRGB_BLOCK, WGPUTextureFormat_ASTC10x5UnormSrgb},
{angle::FormatID::ASTC_10x5_UNORM_BLOCK, WGPUTextureFormat_ASTC10x5Unorm},
{angle::FormatID::ASTC_10x6_SRGB_BLOCK, WGPUTextureFormat_ASTC10x6UnormSrgb},
{angle::FormatID::ASTC_10x6_UNORM_BLOCK, WGPUTextureFormat_ASTC10x6Unorm},
{angle::FormatID::ASTC_10x8_SRGB_BLOCK, WGPUTextureFormat_ASTC10x8UnormSrgb},
{angle::FormatID::ASTC_10x8_UNORM_BLOCK, WGPUTextureFormat_ASTC10x8Unorm},
{angle::FormatID::ASTC_12x10_SRGB_BLOCK, WGPUTextureFormat_ASTC12x10UnormSrgb},
{angle::FormatID::ASTC_12x10_UNORM_BLOCK, WGPUTextureFormat_ASTC12x10Unorm},
{angle::FormatID::ASTC_12x12_SRGB_BLOCK, WGPUTextureFormat_ASTC12x12UnormSrgb},
{angle::FormatID::ASTC_12x12_UNORM_BLOCK, WGPUTextureFormat_ASTC12x12Unorm},
{angle::FormatID::ASTC_4x4_SRGB_BLOCK, WGPUTextureFormat_ASTC4x4UnormSrgb},
{angle::FormatID::ASTC_4x4_UNORM_BLOCK, WGPUTextureFormat_ASTC4x4Unorm},
{angle::FormatID::ASTC_5x4_SRGB_BLOCK, WGPUTextureFormat_ASTC5x4UnormSrgb},
{angle::FormatID::ASTC_5x4_UNORM_BLOCK, WGPUTextureFormat_ASTC5x4Unorm},
{angle::FormatID::ASTC_5x5_SRGB_BLOCK, WGPUTextureFormat_ASTC5x5UnormSrgb},
{angle::FormatID::ASTC_5x5_UNORM_BLOCK, WGPUTextureFormat_ASTC5x5Unorm},
{angle::FormatID::ASTC_6x5_SRGB_BLOCK, WGPUTextureFormat_ASTC6x5UnormSrgb},
{angle::FormatID::ASTC_6x5_UNORM_BLOCK, WGPUTextureFormat_ASTC6x5Unorm},
{angle::FormatID::ASTC_6x6_SRGB_BLOCK, WGPUTextureFormat_ASTC6x6UnormSrgb},
{angle::FormatID::ASTC_6x6_UNORM_BLOCK, WGPUTextureFormat_ASTC6x6Unorm},
{angle::FormatID::ASTC_8x5_SRGB_BLOCK, WGPUTextureFormat_ASTC8x5UnormSrgb},
{angle::FormatID::ASTC_8x5_UNORM_BLOCK, WGPUTextureFormat_ASTC8x5Unorm},
{angle::FormatID::ASTC_8x6_SRGB_BLOCK, WGPUTextureFormat_ASTC8x6UnormSrgb},
{angle::FormatID::ASTC_8x6_UNORM_BLOCK, WGPUTextureFormat_ASTC8x6Unorm},
{angle::FormatID::ASTC_8x8_SRGB_BLOCK, WGPUTextureFormat_ASTC8x8UnormSrgb},
{angle::FormatID::ASTC_8x8_UNORM_BLOCK, WGPUTextureFormat_ASTC8x8Unorm},
{angle::FormatID::B8G8R8A8_UNORM, WGPUTextureFormat_BGRA8Unorm},
{angle::FormatID::B8G8R8A8_UNORM_SRGB, WGPUTextureFormat_BGRA8UnormSrgb},
{angle::FormatID::BC1_RGBA_UNORM_BLOCK, WGPUTextureFormat_BC1RGBAUnorm},
{angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK, WGPUTextureFormat_BC1RGBAUnormSrgb},
{angle::FormatID::BC2_RGBA_UNORM_BLOCK, WGPUTextureFormat_BC2RGBAUnorm},
{angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK, WGPUTextureFormat_BC2RGBAUnormSrgb},
{angle::FormatID::BC3_RGBA_UNORM_BLOCK, WGPUTextureFormat_BC3RGBAUnorm},
{angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK, WGPUTextureFormat_BC3RGBAUnormSrgb},
{angle::FormatID::BC4_RED_SNORM_BLOCK, WGPUTextureFormat_BC4RSnorm},
{angle::FormatID::BC4_RED_UNORM_BLOCK, WGPUTextureFormat_BC4RUnorm},
{angle::FormatID::BC5_RG_SNORM_BLOCK, WGPUTextureFormat_BC5RGSnorm},
{angle::FormatID::BC5_RG_UNORM_BLOCK, WGPUTextureFormat_BC5RGUnorm},
{angle::FormatID::BC6H_RGB_SFLOAT_BLOCK, WGPUTextureFormat_BC6HRGBFloat},
{angle::FormatID::BC6H_RGB_UFLOAT_BLOCK, WGPUTextureFormat_BC6HRGBUfloat},
{angle::FormatID::BC7_RGBA_UNORM_BLOCK, WGPUTextureFormat_BC7RGBAUnorm},
{angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK, WGPUTextureFormat_BC7RGBAUnormSrgb},
{angle::FormatID::D16_UNORM, WGPUTextureFormat_Depth16Unorm},
{angle::FormatID::D24_UNORM_S8_UINT, WGPUTextureFormat_Depth24PlusStencil8},
{angle::FormatID::D32_FLOAT, WGPUTextureFormat_Depth32Float},
{angle::FormatID::EAC_R11G11_SNORM_BLOCK, WGPUTextureFormat_EACRG11Snorm},
{angle::FormatID::EAC_R11G11_UNORM_BLOCK, WGPUTextureFormat_EACRG11Unorm},
{angle::FormatID::EAC_R11_SNORM_BLOCK, WGPUTextureFormat_EACR11Snorm},
{angle::FormatID::EAC_R11_UNORM_BLOCK, WGPUTextureFormat_EACR11Unorm},
{angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, WGPUTextureFormat_ETC2RGB8A1UnormSrgb},
{angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK, WGPUTextureFormat_ETC2RGB8A1Unorm},
{angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, WGPUTextureFormat_ETC2RGBA8UnormSrgb},
{angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, WGPUTextureFormat_ETC2RGBA8Unorm},
{angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK, WGPUTextureFormat_ETC2RGB8UnormSrgb},
{angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, WGPUTextureFormat_ETC2RGB8Unorm},
{angle::FormatID::EXTERNAL0, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL1, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL2, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL3, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL4, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL5, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL6, WGPUTextureFormat_Undefined},
{angle::FormatID::EXTERNAL7, WGPUTextureFormat_Undefined},
{angle::FormatID::NONE, WGPUTextureFormat_Undefined},
{angle::FormatID::R10G10B10A2_SINT, WGPUTextureFormat_RGB10A2Uint},
{angle::FormatID::R10G10B10A2_UNORM, WGPUTextureFormat_RGB10A2Unorm},
{angle::FormatID::R11G11B10_FLOAT, WGPUTextureFormat_RG11B10Ufloat},
{angle::FormatID::R16G16B16A16_FLOAT, WGPUTextureFormat_RGBA16Float},
{angle::FormatID::R16G16B16A16_SINT, WGPUTextureFormat_RGBA16Sint},
{angle::FormatID::R16G16B16A16_SNORM, WGPUTextureFormat_RGBA16Snorm},
{angle::FormatID::R16G16B16A16_UINT, WGPUTextureFormat_RGBA16Uint},
{angle::FormatID::R16G16B16A16_UNORM, WGPUTextureFormat_RGBA16Unorm},
{angle::FormatID::R16G16_FLOAT, WGPUTextureFormat_RG16Float},
{angle::FormatID::R16G16_SINT, WGPUTextureFormat_RG16Sint},
{angle::FormatID::R16G16_SNORM, WGPUTextureFormat_RG16Snorm},
{angle::FormatID::R16G16_UINT, WGPUTextureFormat_RG16Uint},
{angle::FormatID::R16G16_UNORM, WGPUTextureFormat_RG16Unorm},
{angle::FormatID::R16_FLOAT, WGPUTextureFormat_R16Float},
{angle::FormatID::R16_SINT, WGPUTextureFormat_R16Sint},
{angle::FormatID::R16_SNORM, WGPUTextureFormat_R16Snorm},
{angle::FormatID::R16_UINT, WGPUTextureFormat_R16Uint},
{angle::FormatID::R16_UNORM, WGPUTextureFormat_R16Unorm},
{angle::FormatID::R32G32B32A32_FLOAT, WGPUTextureFormat_RGBA32Float},
{angle::FormatID::R32G32B32A32_SINT, WGPUTextureFormat_RGBA32Sint},
{angle::FormatID::R32G32B32A32_UINT, WGPUTextureFormat_RGBA32Uint},
{angle::FormatID::R32G32_FLOAT, WGPUTextureFormat_RG32Float},
{angle::FormatID::R32G32_SINT, WGPUTextureFormat_RG32Sint},
{angle::FormatID::R32G32_UINT, WGPUTextureFormat_RG32Uint},
{angle::FormatID::R32_FLOAT, WGPUTextureFormat_R32Float},
{angle::FormatID::R32_SINT, WGPUTextureFormat_R32Sint},
{angle::FormatID::R32_UINT, WGPUTextureFormat_R32Uint},
{angle::FormatID::R8G8B8A8_SINT, WGPUTextureFormat_RGBA8Sint},
{angle::FormatID::R8G8B8A8_SNORM, WGPUTextureFormat_RGBA8Snorm},
{angle::FormatID::R8G8B8A8_UINT, WGPUTextureFormat_RGBA8Uint},
{angle::FormatID::R8G8B8A8_UNORM, WGPUTextureFormat_RGBA8Unorm},
{angle::FormatID::R8G8B8A8_UNORM_SRGB, WGPUTextureFormat_RGBA8UnormSrgb},
{angle::FormatID::R8G8_SINT, WGPUTextureFormat_RG8Sint},
{angle::FormatID::R8G8_SNORM, WGPUTextureFormat_RG8Snorm},
{angle::FormatID::R8G8_UINT, WGPUTextureFormat_RG8Uint},
{angle::FormatID::R8G8_UNORM, WGPUTextureFormat_RG8Unorm},
{angle::FormatID::R8_SINT, WGPUTextureFormat_R8Sint},
{angle::FormatID::R8_SNORM, WGPUTextureFormat_R8Snorm},
{angle::FormatID::R8_UINT, WGPUTextureFormat_R8Uint},
{angle::FormatID::R8_UNORM, WGPUTextureFormat_R8Unorm},
{angle::FormatID::R9G9B9E5_SHAREDEXP, WGPUTextureFormat_RGB9E5Ufloat},
{angle::FormatID::S8_UINT, WGPUTextureFormat_Stencil8}};
return kMap[formatID];
}
angle::FormatID GetFormatIDFromWgpuTextureFormat(WGPUTextureFormat wgpuFormat)
{
switch (wgpuFormat)
{
case WGPUTextureFormat_ASTC10x10UnormSrgb:
return angle::FormatID::ASTC_10x10_SRGB_BLOCK;
case WGPUTextureFormat_ASTC10x10Unorm:
return angle::FormatID::ASTC_10x10_UNORM_BLOCK;
case WGPUTextureFormat_ASTC10x5UnormSrgb:
return angle::FormatID::ASTC_10x5_SRGB_BLOCK;
case WGPUTextureFormat_ASTC10x5Unorm:
return angle::FormatID::ASTC_10x5_UNORM_BLOCK;
case WGPUTextureFormat_ASTC10x6UnormSrgb:
return angle::FormatID::ASTC_10x6_SRGB_BLOCK;
case WGPUTextureFormat_ASTC10x6Unorm:
return angle::FormatID::ASTC_10x6_UNORM_BLOCK;
case WGPUTextureFormat_ASTC10x8UnormSrgb:
return angle::FormatID::ASTC_10x8_SRGB_BLOCK;
case WGPUTextureFormat_ASTC10x8Unorm:
return angle::FormatID::ASTC_10x8_UNORM_BLOCK;
case WGPUTextureFormat_ASTC12x10UnormSrgb:
return angle::FormatID::ASTC_12x10_SRGB_BLOCK;
case WGPUTextureFormat_ASTC12x10Unorm:
return angle::FormatID::ASTC_12x10_UNORM_BLOCK;
case WGPUTextureFormat_ASTC12x12UnormSrgb:
return angle::FormatID::ASTC_12x12_SRGB_BLOCK;
case WGPUTextureFormat_ASTC12x12Unorm:
return angle::FormatID::ASTC_12x12_UNORM_BLOCK;
case WGPUTextureFormat_ASTC4x4UnormSrgb:
return angle::FormatID::ASTC_4x4_SRGB_BLOCK;
case WGPUTextureFormat_ASTC4x4Unorm:
return angle::FormatID::ASTC_4x4_UNORM_BLOCK;
case WGPUTextureFormat_ASTC5x4UnormSrgb:
return angle::FormatID::ASTC_5x4_SRGB_BLOCK;
case WGPUTextureFormat_ASTC5x4Unorm:
return angle::FormatID::ASTC_5x4_UNORM_BLOCK;
case WGPUTextureFormat_ASTC5x5UnormSrgb:
return angle::FormatID::ASTC_5x5_SRGB_BLOCK;
case WGPUTextureFormat_ASTC5x5Unorm:
return angle::FormatID::ASTC_5x5_UNORM_BLOCK;
case WGPUTextureFormat_ASTC6x5UnormSrgb:
return angle::FormatID::ASTC_6x5_SRGB_BLOCK;
case WGPUTextureFormat_ASTC6x5Unorm:
return angle::FormatID::ASTC_6x5_UNORM_BLOCK;
case WGPUTextureFormat_ASTC6x6UnormSrgb:
return angle::FormatID::ASTC_6x6_SRGB_BLOCK;
case WGPUTextureFormat_ASTC6x6Unorm:
return angle::FormatID::ASTC_6x6_UNORM_BLOCK;
case WGPUTextureFormat_ASTC8x5UnormSrgb:
return angle::FormatID::ASTC_8x5_SRGB_BLOCK;
case WGPUTextureFormat_ASTC8x5Unorm:
return angle::FormatID::ASTC_8x5_UNORM_BLOCK;
case WGPUTextureFormat_ASTC8x6UnormSrgb:
return angle::FormatID::ASTC_8x6_SRGB_BLOCK;
case WGPUTextureFormat_ASTC8x6Unorm:
return angle::FormatID::ASTC_8x6_UNORM_BLOCK;
case WGPUTextureFormat_ASTC8x8UnormSrgb:
return angle::FormatID::ASTC_8x8_SRGB_BLOCK;
case WGPUTextureFormat_ASTC8x8Unorm:
return angle::FormatID::ASTC_8x8_UNORM_BLOCK;
case WGPUTextureFormat_BGRA8Unorm:
return angle::FormatID::B8G8R8A8_UNORM;
case WGPUTextureFormat_BGRA8UnormSrgb:
return angle::FormatID::B8G8R8A8_UNORM_SRGB;
case WGPUTextureFormat_BC1RGBAUnorm:
return angle::FormatID::BC1_RGBA_UNORM_BLOCK;
case WGPUTextureFormat_BC1RGBAUnormSrgb:
return angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
case WGPUTextureFormat_BC2RGBAUnorm:
return angle::FormatID::BC2_RGBA_UNORM_BLOCK;
case WGPUTextureFormat_BC2RGBAUnormSrgb:
return angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
case WGPUTextureFormat_BC3RGBAUnorm:
return angle::FormatID::BC3_RGBA_UNORM_BLOCK;
case WGPUTextureFormat_BC3RGBAUnormSrgb:
return angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
case WGPUTextureFormat_BC4RSnorm:
return angle::FormatID::BC4_RED_SNORM_BLOCK;
case WGPUTextureFormat_BC4RUnorm:
return angle::FormatID::BC4_RED_UNORM_BLOCK;
case WGPUTextureFormat_BC5RGSnorm:
return angle::FormatID::BC5_RG_SNORM_BLOCK;
case WGPUTextureFormat_BC5RGUnorm:
return angle::FormatID::BC5_RG_UNORM_BLOCK;
case WGPUTextureFormat_BC6HRGBFloat:
return angle::FormatID::BC6H_RGB_SFLOAT_BLOCK;
case WGPUTextureFormat_BC6HRGBUfloat:
return angle::FormatID::BC6H_RGB_UFLOAT_BLOCK;
case WGPUTextureFormat_BC7RGBAUnorm:
return angle::FormatID::BC7_RGBA_UNORM_BLOCK;
case WGPUTextureFormat_BC7RGBAUnormSrgb:
return angle::FormatID::BC7_RGBA_UNORM_SRGB_BLOCK;
case WGPUTextureFormat_Depth16Unorm:
return angle::FormatID::D16_UNORM;
case WGPUTextureFormat_Depth24PlusStencil8:
return angle::FormatID::D24_UNORM_S8_UINT;
case WGPUTextureFormat_Depth32Float:
return angle::FormatID::D32_FLOAT;
case WGPUTextureFormat_EACRG11Snorm:
return angle::FormatID::EAC_R11G11_SNORM_BLOCK;
case WGPUTextureFormat_EACRG11Unorm:
return angle::FormatID::EAC_R11G11_UNORM_BLOCK;
case WGPUTextureFormat_EACR11Snorm:
return angle::FormatID::EAC_R11_SNORM_BLOCK;
case WGPUTextureFormat_EACR11Unorm:
return angle::FormatID::EAC_R11_UNORM_BLOCK;
case WGPUTextureFormat_ETC2RGB8A1UnormSrgb:
return angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
case WGPUTextureFormat_ETC2RGB8A1Unorm:
return angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
case WGPUTextureFormat_ETC2RGBA8UnormSrgb:
return angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
case WGPUTextureFormat_ETC2RGBA8Unorm:
return angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
case WGPUTextureFormat_ETC2RGB8UnormSrgb:
return angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK;
case WGPUTextureFormat_ETC2RGB8Unorm:
return angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK;
case WGPUTextureFormat_Undefined:
return angle::FormatID::NONE;
case WGPUTextureFormat_RGB10A2Uint:
return angle::FormatID::R10G10B10A2_SINT;
case WGPUTextureFormat_RGB10A2Unorm:
return angle::FormatID::R10G10B10A2_UNORM;
case WGPUTextureFormat_RG11B10Ufloat:
return angle::FormatID::R11G11B10_FLOAT;
case WGPUTextureFormat_RGBA16Float:
return angle::FormatID::R16G16B16A16_FLOAT;
case WGPUTextureFormat_RGBA16Sint:
return angle::FormatID::R16G16B16A16_SINT;
case WGPUTextureFormat_RGBA16Snorm:
return angle::FormatID::R16G16B16A16_SNORM;
case WGPUTextureFormat_RGBA16Uint:
return angle::FormatID::R16G16B16A16_UINT;
case WGPUTextureFormat_RGBA16Unorm:
return angle::FormatID::R16G16B16A16_UNORM;
case WGPUTextureFormat_RG16Float:
return angle::FormatID::R16G16_FLOAT;
case WGPUTextureFormat_RG16Sint:
return angle::FormatID::R16G16_SINT;
case WGPUTextureFormat_RG16Snorm:
return angle::FormatID::R16G16_SNORM;
case WGPUTextureFormat_RG16Uint:
return angle::FormatID::R16G16_UINT;
case WGPUTextureFormat_RG16Unorm:
return angle::FormatID::R16G16_UNORM;
case WGPUTextureFormat_R16Float:
return angle::FormatID::R16_FLOAT;
case WGPUTextureFormat_R16Sint:
return angle::FormatID::R16_SINT;
case WGPUTextureFormat_R16Snorm:
return angle::FormatID::R16_SNORM;
case WGPUTextureFormat_R16Uint:
return angle::FormatID::R16_UINT;
case WGPUTextureFormat_R16Unorm:
return angle::FormatID::R16_UNORM;
case WGPUTextureFormat_RGBA32Float:
return angle::FormatID::R32G32B32A32_FLOAT;
case WGPUTextureFormat_RGBA32Sint:
return angle::FormatID::R32G32B32A32_SINT;
case WGPUTextureFormat_RGBA32Uint:
return angle::FormatID::R32G32B32A32_UINT;
case WGPUTextureFormat_RG32Float:
return angle::FormatID::R32G32_FLOAT;
case WGPUTextureFormat_RG32Sint:
return angle::FormatID::R32G32_SINT;
case WGPUTextureFormat_RG32Uint:
return angle::FormatID::R32G32_UINT;
case WGPUTextureFormat_R32Float:
return angle::FormatID::R32_FLOAT;
case WGPUTextureFormat_R32Sint:
return angle::FormatID::R32_SINT;
case WGPUTextureFormat_R32Uint:
return angle::FormatID::R32_UINT;
case WGPUTextureFormat_RGBA8Sint:
return angle::FormatID::R8G8B8A8_SINT;
case WGPUTextureFormat_RGBA8Snorm:
return angle::FormatID::R8G8B8A8_SNORM;
case WGPUTextureFormat_RGBA8Uint:
return angle::FormatID::R8G8B8A8_UINT;
case WGPUTextureFormat_RGBA8Unorm:
return angle::FormatID::R8G8B8A8_UNORM;
case WGPUTextureFormat_RGBA8UnormSrgb:
return angle::FormatID::R8G8B8A8_UNORM_SRGB;
case WGPUTextureFormat_RG8Sint:
return angle::FormatID::R8G8_SINT;
case WGPUTextureFormat_RG8Snorm:
return angle::FormatID::R8G8_SNORM;
case WGPUTextureFormat_RG8Uint:
return angle::FormatID::R8G8_UINT;
case WGPUTextureFormat_RG8Unorm:
return angle::FormatID::R8G8_UNORM;
case WGPUTextureFormat_R8Sint:
return angle::FormatID::R8_SINT;
case WGPUTextureFormat_R8Snorm:
return angle::FormatID::R8_SNORM;
case WGPUTextureFormat_R8Uint:
return angle::FormatID::R8_UINT;
case WGPUTextureFormat_R8Unorm:
return angle::FormatID::R8_UNORM;
case WGPUTextureFormat_RGB9E5Ufloat:
return angle::FormatID::R9G9B9E5_SHAREDEXP;
case WGPUTextureFormat_Stencil8:
return angle::FormatID::S8_UINT;
default:
UNREACHABLE();
return angle::FormatID::NONE;
}
}
WGPUVertexFormat GetWgpuVertexFormatFromFormatID(angle::FormatID formatID)
{
static constexpr angle::FormatMap<WGPUVertexFormat> kMap = {
{angle::FormatID::EXTERNAL0, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL1, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL2, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL3, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL4, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL5, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL6, WGPUVertexFormat(0u)},
{angle::FormatID::EXTERNAL7, WGPUVertexFormat(0u)},
{angle::FormatID::NONE, WGPUVertexFormat(0u)},
{angle::FormatID::R10G10B10A2_UNORM, WGPUVertexFormat_Unorm10_10_10_2},
{angle::FormatID::R16G16B16A16_FLOAT, WGPUVertexFormat_Float16x4},
{angle::FormatID::R16G16B16A16_SINT, WGPUVertexFormat_Sint16x4},
{angle::FormatID::R16G16B16A16_SNORM, WGPUVertexFormat_Snorm16x4},
{angle::FormatID::R16G16B16A16_UINT, WGPUVertexFormat_Uint16x4},
{angle::FormatID::R16G16B16A16_UNORM, WGPUVertexFormat_Unorm16x4},
{angle::FormatID::R16G16_FLOAT, WGPUVertexFormat_Float16x2},
{angle::FormatID::R16G16_SINT, WGPUVertexFormat_Sint16x2},
{angle::FormatID::R16G16_SNORM, WGPUVertexFormat_Snorm16x2},
{angle::FormatID::R16G16_UINT, WGPUVertexFormat_Uint16x2},
{angle::FormatID::R16G16_UNORM, WGPUVertexFormat_Unorm16x2},
{angle::FormatID::R32G32B32A32_FLOAT, WGPUVertexFormat_Float32x4},
{angle::FormatID::R32G32B32A32_SINT, WGPUVertexFormat_Sint32x4},
{angle::FormatID::R32G32B32A32_UINT, WGPUVertexFormat_Uint32x4},
{angle::FormatID::R32G32B32_FLOAT, WGPUVertexFormat_Float32x3},
{angle::FormatID::R32G32B32_SINT, WGPUVertexFormat_Sint32x3},
{angle::FormatID::R32G32B32_UINT, WGPUVertexFormat_Uint32x3},
{angle::FormatID::R32G32_FLOAT, WGPUVertexFormat_Float32x2},
{angle::FormatID::R32G32_SINT, WGPUVertexFormat_Sint32x2},
{angle::FormatID::R32G32_UINT, WGPUVertexFormat_Uint32x2},
{angle::FormatID::R32_FLOAT, WGPUVertexFormat_Float32},
{angle::FormatID::R32_SINT, WGPUVertexFormat_Sint32},
{angle::FormatID::R32_UINT, WGPUVertexFormat_Uint32},
{angle::FormatID::R8G8B8A8_SINT, WGPUVertexFormat_Sint8x4},
{angle::FormatID::R8G8B8A8_SNORM, WGPUVertexFormat_Snorm8x4},
{angle::FormatID::R8G8B8A8_UINT, WGPUVertexFormat_Uint8x4},
{angle::FormatID::R8G8B8A8_UNORM, WGPUVertexFormat_Unorm8x4}};
return kMap[formatID];
}
angle::FormatID GetFormatIDFromWgpuBufferFormat(WGPUVertexFormat wgpuFormat)
{
switch (wgpuFormat)
{
case WGPUVertexFormat_Unorm10_10_10_2:
return angle::FormatID::R10G10B10A2_UNORM;
case WGPUVertexFormat_Float16x4:
return angle::FormatID::R16G16B16A16_FLOAT;
case WGPUVertexFormat_Sint16x4:
return angle::FormatID::R16G16B16A16_SINT;
case WGPUVertexFormat_Snorm16x4:
return angle::FormatID::R16G16B16A16_SNORM;
case WGPUVertexFormat_Uint16x4:
return angle::FormatID::R16G16B16A16_UINT;
case WGPUVertexFormat_Unorm16x4:
return angle::FormatID::R16G16B16A16_UNORM;
case WGPUVertexFormat_Float16x2:
return angle::FormatID::R16G16_FLOAT;
case WGPUVertexFormat_Sint16x2:
return angle::FormatID::R16G16_SINT;
case WGPUVertexFormat_Snorm16x2:
return angle::FormatID::R16G16_SNORM;
case WGPUVertexFormat_Uint16x2:
return angle::FormatID::R16G16_UINT;
case WGPUVertexFormat_Unorm16x2:
return angle::FormatID::R16G16_UNORM;
case WGPUVertexFormat_Float32x4:
return angle::FormatID::R32G32B32A32_FLOAT;
case WGPUVertexFormat_Sint32x4:
return angle::FormatID::R32G32B32A32_SINT;
case WGPUVertexFormat_Uint32x4:
return angle::FormatID::R32G32B32A32_UINT;
case WGPUVertexFormat_Float32x3:
return angle::FormatID::R32G32B32_FLOAT;
case WGPUVertexFormat_Sint32x3:
return angle::FormatID::R32G32B32_SINT;
case WGPUVertexFormat_Uint32x3:
return angle::FormatID::R32G32B32_UINT;
case WGPUVertexFormat_Float32x2:
return angle::FormatID::R32G32_FLOAT;
case WGPUVertexFormat_Sint32x2:
return angle::FormatID::R32G32_SINT;
case WGPUVertexFormat_Uint32x2:
return angle::FormatID::R32G32_UINT;
case WGPUVertexFormat_Float32:
return angle::FormatID::R32_FLOAT;
case WGPUVertexFormat_Sint32:
return angle::FormatID::R32_SINT;
case WGPUVertexFormat_Uint32:
return angle::FormatID::R32_UINT;
case WGPUVertexFormat_Sint8x4:
return angle::FormatID::R8G8B8A8_SINT;
case WGPUVertexFormat_Snorm8x4:
return angle::FormatID::R8G8B8A8_SNORM;
case WGPUVertexFormat_Uint8x4:
return angle::FormatID::R8G8B8A8_UINT;
case WGPUVertexFormat_Unorm8x4:
return angle::FormatID::R8G8B8A8_UNORM;
default:
UNREACHABLE();
return angle::FormatID::NONE;
}
}
} // namespace webgpu
} // namespace rx