Commit a5b1561e by Jamie Madill Committed by Commit Bot

Place format info in angle::Format.

Some bits of information, like the copy functions and mipmap gen functions, can be shared across back-ends in the angle::Format class. Also name the info struct angle::Format, and use an enum class angle::Format::ID to identify the particular format. This patch introduces a new table generator for angle formats and updates the D3D11 generator accordingly. BUG=angleproject:1455 Change-Id: I13b8b98822b1186c6a9e436dc232c18fef50980c Reviewed-on: https://chromium-review.googlesource.com/365824Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 20f69ce5
...@@ -12,69 +12,47 @@ ...@@ -12,69 +12,47 @@
#ifndef LIBANGLE_RENDERER_FORMAT_H_ #ifndef LIBANGLE_RENDERER_FORMAT_H_
#define LIBANGLE_RENDERER_FORMAT_H_ #define LIBANGLE_RENDERER_FORMAT_H_
#include "libANGLE/renderer/renderer_utils.h"
namespace angle namespace angle
{ {
// TODO(jmadill): It would be nice if we could auto-generate this. struct Format final : angle::NonCopyable
enum class Format
{ {
NONE, enum class ID;
A8_UNORM,
B4G4R4A4_UNORM, Format(ID id,
B5G5R5A1_UNORM, GLenum glFormat,
B5G6R5_UNORM, GLenum fboFormat,
B8G8R8A8_UNORM, rx::MipGenerationFunction mipGen,
BC1_UNORM, rx::ColorReadFunction colorRead)
BC2_UNORM, : id(id),
BC3_UNORM, glInternalFormat(glFormat),
D16_UNORM, fboImplementationInternalFormat(fboFormat),
D24_UNORM_S8_UINT, mipGenerationFunction(mipGen),
D32_FLOAT, colorReadFunction(colorRead)
D32_FLOAT_S8X24_UINT, {
R10G10B10A2_UINT, }
R10G10B10A2_UNORM,
R11G11B10_FLOAT, static const Format &Get(ID id);
R16G16B16A16_FLOAT,
R16G16B16A16_SINT, ID id;
R16G16B16A16_SNORM,
R16G16B16A16_UINT, // The closest matching GL internal format for the storage this format uses. Note that this
R16G16B16A16_UNORM, // may be a different internal format than the one this ANGLE format is used for.
R16G16_FLOAT, GLenum glInternalFormat;
R16G16_SINT,
R16G16_SNORM, // The format we should report to the GL layer when querying implementation formats from a FBO.
R16G16_UINT, // This might not be the same as the glInternalFormat, since some DXGI formats don't have
R16G16_UNORM, // matching GL format enums, like BGRA4, BGR5A1 and B5G6R6.
R16_FLOAT, GLenum fboImplementationInternalFormat;
R16_SINT,
R16_SNORM, rx::MipGenerationFunction mipGenerationFunction;
R16_UINT, rx::ColorReadFunction colorReadFunction;
R16_UNORM,
R32G32B32A32_FLOAT,
R32G32B32A32_SINT,
R32G32B32A32_UINT,
R32G32_FLOAT,
R32G32_SINT,
R32G32_UINT,
R32_FLOAT,
R32_SINT,
R32_UINT,
R8G8B8A8_SINT,
R8G8B8A8_SNORM,
R8G8B8A8_UINT,
R8G8B8A8_UNORM,
R8G8B8A8_UNORM_SRGB,
R8G8_SINT,
R8G8_SNORM,
R8G8_UINT,
R8G8_UNORM,
R8_SINT,
R8_SNORM,
R8_UINT,
R8_UNORM,
R9G9B9E5_SHAREDEXP,
}; };
} // namespace angle } // namespace angle
#include "libANGLE/renderer/Format_ID_autogen.inl"
#endif // LIBANGLE_RENDERER_FORMAT_H_ #endif // LIBANGLE_RENDERER_FORMAT_H_
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_angle_format_table.py using data from angle_format_data.json
//
// Copyright 2016 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.
//
// ANGLE format enumeration.
namespace angle
{
enum class Format::ID
{
NONE,
A8_UNORM,
B4G4R4A4_UNORM,
B5G5R5A1_UNORM,
B5G6R5_UNORM,
B8G8R8A8_UNORM,
BC1_UNORM,
BC2_UNORM,
BC3_UNORM,
D16_UNORM,
D24_UNORM_S8_UINT,
D32_FLOAT,
D32_FLOAT_S8X24_UINT,
R10G10B10A2_UINT,
R10G10B10A2_UNORM,
R11G11B10_FLOAT,
R16G16B16A16_FLOAT,
R16G16B16A16_SINT,
R16G16B16A16_SNORM,
R16G16B16A16_UINT,
R16G16B16A16_UNORM,
R16G16_FLOAT,
R16G16_SINT,
R16G16_SNORM,
R16G16_UINT,
R16G16_UNORM,
R16_FLOAT,
R16_SINT,
R16_SNORM,
R16_UINT,
R16_UNORM,
R32G32B32A32_FLOAT,
R32G32B32A32_SINT,
R32G32B32A32_UINT,
R32G32_FLOAT,
R32G32_SINT,
R32G32_UINT,
R32_FLOAT,
R32_SINT,
R32_UINT,
R8G8B8A8_SINT,
R8G8B8A8_SNORM,
R8G8B8A8_UINT,
R8G8B8A8_UNORM,
R8G8B8A8_UNORM_SRGB,
R8G8_SINT,
R8G8_SNORM,
R8G8_UINT,
R8G8_UNORM,
R8_SINT,
R8_SNORM,
R8_UINT,
R8_UNORM,
R9G9B9E5_SHAREDEXP
};
} // namespace angle
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_angle_format_table.py using data from angle_format_data.json
//
// Copyright 2016 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.
//
// ANGLE Format table:
// Queries for typed format information from the ANGLE format enum.
#include "libANGLE/renderer/Format.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
namespace angle
{
// static
const Format &Format::Get(ID id)
{
// clang-format off
switch (id)
{
case ID::A8_UNORM:
{
static const Format info(ID::A8_UNORM,
GL_ALPHA8_EXT,
GL_ALPHA8_EXT,
GenerateMip<A8>,
ReadColor<A8, GLfloat>);
return info;
}
case ID::B4G4R4A4_UNORM:
{
static const Format info(ID::B4G4R4A4_UNORM,
GL_BGRA4_ANGLEX,
GL_RGBA4,
GenerateMip<A4R4G4B4>,
ReadColor<A4R4G4B4, GLfloat>);
return info;
}
case ID::B5G5R5A1_UNORM:
{
static const Format info(ID::B5G5R5A1_UNORM,
GL_BGR5_A1_ANGLEX,
GL_RGB5_A1,
GenerateMip<A1R5G5B5>,
ReadColor<A1R5G5B5, GLfloat>);
return info;
}
case ID::B5G6R5_UNORM:
{
static const Format info(ID::B5G6R5_UNORM,
GL_BGR565_ANGLEX,
GL_RGB565,
GenerateMip<B5G6R5>,
ReadColor<B5G6R5, GLfloat>);
return info;
}
case ID::B8G8R8A8_UNORM:
{
static const Format info(ID::B8G8R8A8_UNORM,
GL_BGRA8_EXT,
GL_BGRA8_EXT,
GenerateMip<B8G8R8A8>,
ReadColor<B8G8R8A8, GLfloat>);
return info;
}
case ID::BC1_UNORM:
{
static const Format info(ID::BC1_UNORM,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
nullptr,
nullptr);
return info;
}
case ID::BC2_UNORM:
{
static const Format info(ID::BC2_UNORM,
GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
nullptr,
nullptr);
return info;
}
case ID::BC3_UNORM:
{
static const Format info(ID::BC3_UNORM,
GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
nullptr,
nullptr);
return info;
}
case ID::D16_UNORM:
{
static const Format info(ID::D16_UNORM,
GL_DEPTH_COMPONENT16,
GL_DEPTH_COMPONENT16,
nullptr,
nullptr);
return info;
}
case ID::D24_UNORM_S8_UINT:
{
static const Format info(ID::D24_UNORM_S8_UINT,
GL_DEPTH24_STENCIL8_OES,
GL_DEPTH24_STENCIL8_OES,
nullptr,
nullptr);
return info;
}
case ID::D32_FLOAT:
{
static const Format info(ID::D32_FLOAT,
GL_DEPTH_COMPONENT32F,
GL_DEPTH_COMPONENT32F,
nullptr,
nullptr);
return info;
}
case ID::D32_FLOAT_S8X24_UINT:
{
static const Format info(ID::D32_FLOAT_S8X24_UINT,
GL_DEPTH32F_STENCIL8,
GL_DEPTH32F_STENCIL8,
nullptr,
nullptr);
return info;
}
case ID::NONE:
{
static const Format info(ID::NONE,
GL_NONE,
GL_NONE,
nullptr,
nullptr);
return info;
}
case ID::R10G10B10A2_UINT:
{
static const Format info(ID::R10G10B10A2_UINT,
GL_RGB10_A2UI,
GL_RGB10_A2UI,
GenerateMip<R10G10B10A2>,
ReadColor<R10G10B10A2, GLuint>);
return info;
}
case ID::R10G10B10A2_UNORM:
{
static const Format info(ID::R10G10B10A2_UNORM,
GL_RGB10_A2,
GL_RGB10_A2,
GenerateMip<R10G10B10A2>,
ReadColor<R10G10B10A2, GLfloat>);
return info;
}
case ID::R11G11B10_FLOAT:
{
static const Format info(ID::R11G11B10_FLOAT,
GL_R11F_G11F_B10F,
GL_R11F_G11F_B10F,
GenerateMip<R11G11B10F>,
ReadColor<R11G11B10F, GLfloat>);
return info;
}
case ID::R16G16B16A16_FLOAT:
{
static const Format info(ID::R16G16B16A16_FLOAT,
GL_RGBA16F,
GL_RGBA16F,
GenerateMip<R16G16B16A16F>,
ReadColor<R16G16B16A16F, GLfloat>);
return info;
}
case ID::R16G16B16A16_SINT:
{
static const Format info(ID::R16G16B16A16_SINT,
GL_RGBA16I,
GL_RGBA16I,
GenerateMip<R16G16B16A16S>,
ReadColor<R16G16B16A16S, GLint>);
return info;
}
case ID::R16G16B16A16_SNORM:
{
static const Format info(ID::R16G16B16A16_SNORM,
GL_RGBA16_SNORM_EXT,
GL_RGBA16_SNORM_EXT,
GenerateMip<R16G16B16A16S>,
ReadColor<R16G16B16A16S, GLfloat>);
return info;
}
case ID::R16G16B16A16_UINT:
{
static const Format info(ID::R16G16B16A16_UINT,
GL_RGBA16UI,
GL_RGBA16UI,
GenerateMip<R16G16B16A16>,
ReadColor<R16G16B16A16, GLuint>);
return info;
}
case ID::R16G16B16A16_UNORM:
{
static const Format info(ID::R16G16B16A16_UNORM,
GL_RGBA16_EXT,
GL_RGBA16_EXT,
GenerateMip<R16G16B16A16>,
ReadColor<R16G16B16A16, GLfloat>);
return info;
}
case ID::R16G16_FLOAT:
{
static const Format info(ID::R16G16_FLOAT,
GL_RG16F,
GL_RG16F,
GenerateMip<R16G16F>,
ReadColor<R16G16F, GLfloat>);
return info;
}
case ID::R16G16_SINT:
{
static const Format info(ID::R16G16_SINT,
GL_RG16I,
GL_RG16I,
GenerateMip<R16G16S>,
ReadColor<R16G16S, GLint>);
return info;
}
case ID::R16G16_SNORM:
{
static const Format info(ID::R16G16_SNORM,
GL_RG16_SNORM_EXT,
GL_RG16_SNORM_EXT,
GenerateMip<R16G16S>,
ReadColor<R16G16S, GLfloat>);
return info;
}
case ID::R16G16_UINT:
{
static const Format info(ID::R16G16_UINT,
GL_RG16UI,
GL_RG16UI,
GenerateMip<R16G16>,
ReadColor<R16G16, GLuint>);
return info;
}
case ID::R16G16_UNORM:
{
static const Format info(ID::R16G16_UNORM,
GL_RG16_EXT,
GL_RG16_EXT,
GenerateMip<R16G16>,
ReadColor<R16G16, GLfloat>);
return info;
}
case ID::R16_FLOAT:
{
static const Format info(ID::R16_FLOAT,
GL_R16F,
GL_R16F,
GenerateMip<R16F>,
ReadColor<R16F, GLfloat>);
return info;
}
case ID::R16_SINT:
{
static const Format info(ID::R16_SINT,
GL_R16I,
GL_R16I,
GenerateMip<R16S>,
ReadColor<R16S, GLint>);
return info;
}
case ID::R16_SNORM:
{
static const Format info(ID::R16_SNORM,
GL_R16_SNORM_EXT,
GL_R16_SNORM_EXT,
GenerateMip<R16S>,
ReadColor<R16S, GLfloat>);
return info;
}
case ID::R16_UINT:
{
static const Format info(ID::R16_UINT,
GL_R16UI,
GL_R16UI,
GenerateMip<R16>,
ReadColor<R16, GLuint>);
return info;
}
case ID::R16_UNORM:
{
static const Format info(ID::R16_UNORM,
GL_R16_EXT,
GL_R16_EXT,
GenerateMip<R16>,
ReadColor<R16, GLfloat>);
return info;
}
case ID::R32G32B32A32_FLOAT:
{
static const Format info(ID::R32G32B32A32_FLOAT,
GL_RGBA32F,
GL_RGBA32F,
GenerateMip<R32G32B32A32F>,
ReadColor<R32G32B32A32F, GLfloat>);
return info;
}
case ID::R32G32B32A32_SINT:
{
static const Format info(ID::R32G32B32A32_SINT,
GL_RGBA32I,
GL_RGBA32I,
GenerateMip<R32G32B32A32S>,
ReadColor<R32G32B32A32S, GLint>);
return info;
}
case ID::R32G32B32A32_UINT:
{
static const Format info(ID::R32G32B32A32_UINT,
GL_RGBA32UI,
GL_RGBA32UI,
GenerateMip<R32G32B32A32>,
ReadColor<R32G32B32A32, GLuint>);
return info;
}
case ID::R32G32_FLOAT:
{
static const Format info(ID::R32G32_FLOAT,
GL_RG32F,
GL_RG32F,
GenerateMip<R32G32F>,
ReadColor<R32G32F, GLfloat>);
return info;
}
case ID::R32G32_SINT:
{
static const Format info(ID::R32G32_SINT,
GL_RG32I,
GL_RG32I,
GenerateMip<R32G32S>,
ReadColor<R32G32S, GLint>);
return info;
}
case ID::R32G32_UINT:
{
static const Format info(ID::R32G32_UINT,
GL_RG32UI,
GL_RG32UI,
GenerateMip<R32G32>,
ReadColor<R32G32, GLuint>);
return info;
}
case ID::R32_FLOAT:
{
static const Format info(ID::R32_FLOAT,
GL_R32F,
GL_R32F,
GenerateMip<R32F>,
ReadColor<R32F, GLfloat>);
return info;
}
case ID::R32_SINT:
{
static const Format info(ID::R32_SINT,
GL_R32I,
GL_R32I,
GenerateMip<R32S>,
ReadColor<R32S, GLint>);
return info;
}
case ID::R32_UINT:
{
static const Format info(ID::R32_UINT,
GL_R32UI,
GL_R32UI,
GenerateMip<R32>,
ReadColor<R32, GLuint>);
return info;
}
case ID::R8G8B8A8_SINT:
{
static const Format info(ID::R8G8B8A8_SINT,
GL_RGBA8I,
GL_RGBA8I,
GenerateMip<R8G8B8A8S>,
ReadColor<R8G8B8A8S, GLint>);
return info;
}
case ID::R8G8B8A8_SNORM:
{
static const Format info(ID::R8G8B8A8_SNORM,
GL_RGBA8_SNORM,
GL_RGBA8_SNORM,
GenerateMip<R8G8B8A8S>,
ReadColor<R8G8B8A8S, GLfloat>);
return info;
}
case ID::R8G8B8A8_UINT:
{
static const Format info(ID::R8G8B8A8_UINT,
GL_RGBA8UI,
GL_RGBA8UI,
GenerateMip<R8G8B8A8>,
ReadColor<R8G8B8A8, GLuint>);
return info;
}
case ID::R8G8B8A8_UNORM:
{
static const Format info(ID::R8G8B8A8_UNORM,
GL_RGBA8,
GL_RGBA8,
GenerateMip<R8G8B8A8>,
ReadColor<R8G8B8A8, GLfloat>);
return info;
}
case ID::R8G8B8A8_UNORM_SRGB:
{
static const Format info(ID::R8G8B8A8_UNORM_SRGB,
GL_SRGB8_ALPHA8,
GL_SRGB8_ALPHA8,
GenerateMip<R8G8B8A8>,
ReadColor<R8G8B8A8, GLfloat>);
return info;
}
case ID::R8G8_SINT:
{
static const Format info(ID::R8G8_SINT,
GL_RG8I,
GL_RG8I,
GenerateMip<R8G8S>,
ReadColor<R8G8S, GLint>);
return info;
}
case ID::R8G8_SNORM:
{
static const Format info(ID::R8G8_SNORM,
GL_RG8_SNORM,
GL_RG8_SNORM,
GenerateMip<R8G8S>,
ReadColor<R8G8S, GLfloat>);
return info;
}
case ID::R8G8_UINT:
{
static const Format info(ID::R8G8_UINT,
GL_RG8UI,
GL_RG8UI,
GenerateMip<R8G8>,
ReadColor<R8G8, GLuint>);
return info;
}
case ID::R8G8_UNORM:
{
static const Format info(ID::R8G8_UNORM,
GL_RG8,
GL_RG8,
GenerateMip<R8G8>,
ReadColor<R8G8, GLfloat>);
return info;
}
case ID::R8_SINT:
{
static const Format info(ID::R8_SINT,
GL_R8I,
GL_R8I,
GenerateMip<R8S>,
ReadColor<R8S, GLint>);
return info;
}
case ID::R8_SNORM:
{
static const Format info(ID::R8_SNORM,
GL_R8_SNORM,
GL_R8_SNORM,
GenerateMip<R8S>,
ReadColor<R8S, GLfloat>);
return info;
}
case ID::R8_UINT:
{
static const Format info(ID::R8_UINT,
GL_R8UI,
GL_R8UI,
GenerateMip<R8>,
ReadColor<R8, GLuint>);
return info;
}
case ID::R8_UNORM:
{
static const Format info(ID::R8_UNORM,
GL_R8,
GL_R8,
GenerateMip<R8>,
ReadColor<R8, GLfloat>);
return info;
}
case ID::R9G9B9E5_SHAREDEXP:
{
static const Format info(ID::R9G9B9E5_SHAREDEXP,
GL_RGB9_E5,
GL_RGB9_E5,
GenerateMip<R9G9B9E5>,
ReadColor<R9G9B9E5, GLfloat>);
return info;
}
default:
UNREACHABLE();
break;
}
// clang-format on
static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr);
return noneInfo;
}
} // namespace angle
{
"NONE": {
},
"A8_UNORM": {
"channels": "a",
"componentType": "unorm",
"bits": { "alpha": 8 },
"glInternalFormat": "GL_ALPHA8_EXT"
},
"R8G8B8A8_UNORM": {
"channels": "rgba",
"componentType": "unorm",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8"
},
"R16G16B16A16_UNORM": {
"channels": "rgba",
"componentType": "unorm",
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16_EXT"
},
"R16G16B16A16_FLOAT": {
"channels": "rgba",
"componentType": "float",
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16F"
},
"R32G32B32A32_FLOAT": {
"channels": "rgba",
"componentType": "float",
"bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
"glInternalFormat": "GL_RGBA32F"
},
"B8G8R8A8_UNORM": {
"channels": "bgra",
"componentType": "unorm",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_BGRA8_EXT"
},
"BC1_UNORM": {
"channels": "rgba",
"componentType": "unorm",
"swizzleFormat": "R8G8B8A8_UNORM",
"glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"
},
"BC2_UNORM": {
"channels": "rgba",
"componentType": "unorm",
"swizzleFormat": "R8G8B8A8_UNORM",
"glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE"
},
"BC3_UNORM": {
"channels": "rgba",
"componentType": "unorm",
"swizzleFormat": "R8G8B8A8_UNORM",
"glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE"
},
"D24_UNORM_S8_UINT": {
"channels": "ds",
"bits": { "depth": 24, "stencil": 8 },
"glInternalFormat": "GL_DEPTH24_STENCIL8_OES"
},
"D32_FLOAT_S8X24_UINT": {
"channels": "ds",
"bits": { "depth": 32, "stencil": 8 },
"glInternalFormat": "GL_DEPTH32F_STENCIL8"
},
"D16_UNORM": {
"channels": "d",
"componentType": "unorm",
"bits": { "depth": 16 },
"glInternalFormat": "GL_DEPTH_COMPONENT16"
},
"D32_FLOAT": {
"channels": "d",
"componentType": "float",
"bits": { "depth": 32 },
"glInternalFormat": "GL_DEPTH_COMPONENT32F"
},
"R11G11B10_FLOAT": {
"channels": "rgb",
"componentType": "float",
"bits": { "red": 11, "green": 11, "blue": 10 },
"glInternalFormat": "GL_R11F_G11F_B10F"
},
"R16_FLOAT": {
"channels": "r",
"componentType": "float",
"bits": { "red": 16 },
"glInternalFormat": "GL_R16F"
},
"R16_SINT": {
"channels": "r",
"componentType": "int",
"bits": { "red": 16 },
"glInternalFormat": "GL_R16I"
},
"R16_UINT": {
"channels": "r",
"componentType": "uint",
"bits": { "red": 16 },
"glInternalFormat": "GL_R16UI"
},
"R32_FLOAT": {
"channels": "r",
"componentType": "float",
"bits": { "red": 32 },
"glInternalFormat": "GL_R32F"
},
"R32_SINT": {
"channels": "r",
"componentType": "int",
"bits": { "red": 32 },
"glInternalFormat": "GL_R32I"
},
"R32_UINT": {
"channels": "r",
"componentType": "uint",
"bits": { "red": 32 },
"glInternalFormat": "GL_R32UI"
},
"R8_UNORM": {
"channels": "r",
"componentType": "unorm",
"bits": { "red": 8 },
"glInternalFormat": "GL_R8"
},
"R8_SINT": {
"channels": "r",
"componentType": "int",
"bits": { "red": 8 },
"glInternalFormat": "GL_R8I"
},
"R8_UINT": {
"channels": "r",
"componentType": "uint",
"bits": { "red": 8 },
"glInternalFormat": "GL_R8UI"
},
"R8_SNORM": {
"channels": "r",
"componentType": "snorm",
"bits": { "red": 8 },
"glInternalFormat": "GL_R8_SNORM"
},
"R16G16_FLOAT": {
"channels": "rg",
"componentType": "float",
"bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16F"
},
"R16G16_SINT": {
"channels": "rg",
"componentType": "int",
"bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16I"
},
"R16G16_UINT": {
"channels": "rg",
"componentType": "uint",
"bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16UI"
},
"R32G32_FLOAT": {
"channels": "rg",
"componentType": "float",
"bits": { "red": 32, "green": 32 },
"glInternalFormat": "GL_RG32F"
},
"R32G32_SINT": {
"channels": "rg",
"componentType": "int",
"bits": { "red": 32, "green": 32 },
"glInternalFormat": "GL_RG32I"
},
"R32G32_UINT": {
"channels": "rg",
"componentType": "uint",
"bits": { "red": 32, "green": 32 },
"glInternalFormat": "GL_RG32UI"
},
"R8G8_UNORM": {
"channels": "rg",
"componentType": "unorm",
"bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8"
},
"R8G8_SINT": {
"channels": "rg",
"componentType": "int",
"bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8I"
},
"R8G8_UINT": {
"channels": "rg",
"componentType": "uint",
"bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8UI"
},
"R8G8_SNORM": {
"channels": "rg",
"componentType": "snorm",
"bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8_SNORM"
},
"R10G10B10A2_UNORM": {
"channels": "rgba",
"componentType": "unorm",
"bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 },
"glInternalFormat": "GL_RGB10_A2"
},
"R10G10B10A2_UINT": {
"channels": "rgba",
"componentType": "uint",
"bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 },
"glInternalFormat": "GL_RGB10_A2UI"
},
"R16G16B16A16_SINT": {
"channels": "rgba",
"componentType": "int",
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16I"
},
"R16G16B16A16_UINT": {
"channels": "rgba",
"componentType": "uint",
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16UI"
},
"R32G32B32A32_SINT": {
"channels": "rgba",
"componentType": "int",
"bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
"glInternalFormat": "GL_RGBA32I"
},
"R32G32B32A32_UINT": {
"channels": "rgba",
"componentType": "uint",
"bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
"glInternalFormat": "GL_RGBA32UI"
},
"B5G6R5_UNORM": {
"channels": "bgr",
"componentType": "unorm",
"bits": { "red": 5, "green": 6, "blue": 5 },
"glInternalFormat": "GL_BGR565_ANGLEX",
"fboImplementationInternalFormat": "GL_RGB565",
"channelStruct": "B5G6R5"
},
"B5G5R5A1_UNORM": {
"channels": "bgra",
"componentType": "unorm",
"bits": { "red": 5, "green": 5, "blue": 5, "alpha": 1 },
"glInternalFormat": "GL_BGR5_A1_ANGLEX",
"fboImplementationInternalFormat": "GL_RGB5_A1",
"channelStruct": "A1R5G5B5"
},
"R8G8B8A8_SINT": {
"channels": "rgba",
"componentType": "int",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8I"
},
"R8G8B8A8_UINT": {
"channels": "rgba",
"componentType": "uint",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8UI"
},
"R8G8B8A8_SNORM": {
"channels": "rgba",
"componentType": "snorm",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8_SNORM"
},
"R9G9B9E5_SHAREDEXP": {
"channels": "rgb",
"componentType": "float",
"bits": { "red": 9, "green": 9, "blue": 9, "shared": 5 },
"glInternalFormat": "GL_RGB9_E5",
"channelStruct": "R9G9B9E5"
},
"B4G4R4A4_UNORM": {
"channels": "bgra",
"componentType": "unorm",
"bits": { "red": 4, "green": 4, "blue": 4, "alpha": 4 },
"glInternalFormat": "GL_BGRA4_ANGLEX",
"fboImplementationInternalFormat": "GL_RGBA4",
"channelStruct": "A4R4G4B4"
},
"R8G8B8A8_UNORM_SRGB": {
"channels": "rgba",
"componentType": "unorm",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_SRGB8_ALPHA8"
},
"R16_UNORM": {
"channels": "r",
"componentType": "unorm",
"bits": { "red": 16 },
"glInternalFormat": "GL_R16_EXT"
},
"R16G16_UNORM": {
"channels": "rg",
"componentType": "unorm",
"bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16_EXT"
},
"R16_SNORM": {
"channels": "r",
"componentType": "snorm",
"bits": { "red": 16 },
"glInternalFormat": "GL_R16_SNORM_EXT"
},
"R16G16_SNORM": {
"channels": "rg",
"componentType": "snorm",
"bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16_SNORM_EXT"
},
"R16G16B16A16_SNORM": {
"channels": "rgba",
"componentType": "snorm",
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16_SNORM_EXT"
}
}
...@@ -1984,7 +1984,7 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents) ...@@ -1984,7 +1984,7 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents)
releaseResolveDepthStencilResources(); releaseResolveDepthStencilResources();
} }
auto resolvedFormat = angle::Format::R32G32_FLOAT; auto resolvedFormat = angle::Format::ID::R32G32_FLOAT;
const auto &formatSet = const auto &formatSet =
d3d11::GetANGLEFormatSet(resolvedFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::GetANGLEFormatSet(resolvedFormat, mRenderer->getRenderer11DeviceCaps());
......
...@@ -358,7 +358,7 @@ gl::Error Framebuffer11::blitImpl(const gl::Rectangle &sourceArea, ...@@ -358,7 +358,7 @@ gl::Error Framebuffer11::blitImpl(const gl::Rectangle &sourceArea,
GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
{ {
RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget); RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget);
return renderTarget11->getFormatSet().fboImplementationInternalFormat; return renderTarget11->getFormatSet().format.fboImplementationInternalFormat;
} }
void Framebuffer11::updateColorRenderTarget(size_t colorIndex) void Framebuffer11::updateColorRenderTarget(size_t colorIndex)
......
...@@ -68,7 +68,7 @@ gl::Error Image11::generateMipmap(Image11 *dest, ...@@ -68,7 +68,7 @@ gl::Error Image11::generateMipmap(Image11 *dest,
uint8_t *destData = reinterpret_cast<uint8_t*>(destMapped.pData); uint8_t *destData = reinterpret_cast<uint8_t*>(destMapped.pData);
auto mipGenerationFunction = d3d11::GetTextureFormatInfo(src->getInternalFormat(), rendererCaps) auto mipGenerationFunction = d3d11::GetTextureFormatInfo(src->getInternalFormat(), rendererCaps)
.formatSet.mipGenerationFunction; .formatSet.format.mipGenerationFunction;
mipGenerationFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData, mipGenerationFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData,
srcMapped.RowPitch, srcMapped.DepthPitch, destData, destMapped.RowPitch, srcMapped.RowPitch, srcMapped.DepthPitch, destData, destMapped.RowPitch,
destMapped.DepthPitch); destMapped.DepthPitch);
......
...@@ -261,7 +261,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ...@@ -261,7 +261,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv,
{ {
mSubresourceIndex = GetRTVSubresourceIndex(mTexture, mRenderTarget); mSubresourceIndex = GetRTVSubresourceIndex(mTexture, mRenderTarget);
} }
ASSERT(mFormatSet.format != angle::Format::NONE || mWidth == 0 || mHeight == 0); ASSERT(mFormatSet.format.id != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0);
} }
TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv,
...@@ -305,7 +305,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ...@@ -305,7 +305,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv,
{ {
mSubresourceIndex = GetDSVSubresourceIndex(mTexture, mDepthStencil); mSubresourceIndex = GetDSVSubresourceIndex(mTexture, mDepthStencil);
} }
ASSERT(mFormatSet.format != angle::Format::NONE || mWidth == 0 || mHeight == 0); ASSERT(mFormatSet.format.id != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0);
} }
TextureRenderTarget11::~TextureRenderTarget11() TextureRenderTarget11::~TextureRenderTarget11()
......
...@@ -3280,8 +3280,8 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G ...@@ -3280,8 +3280,8 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G
{ {
*outRT = new TextureRenderTarget11( *outRT = new TextureRenderTarget11(
static_cast<ID3D11RenderTargetView *>(nullptr), nullptr, nullptr, nullptr, format, static_cast<ID3D11RenderTargetView *>(nullptr), nullptr, nullptr, nullptr, format,
d3d11::GetANGLEFormatSet(angle::Format::NONE, mRenderer11DeviceCaps), width, height, 1, d3d11::GetANGLEFormatSet(angle::Format::ID::NONE, mRenderer11DeviceCaps), width, height,
supportedSamples); 1, supportedSamples);
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -3538,7 +3538,7 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const ...@@ -3538,7 +3538,7 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
} }
// We don't support formats which we can't represent without conversion // We don't support formats which we can't represent without conversion
if (d3d11FormatInfo.formatSet.glInternalFormat != internalFormat) if (d3d11FormatInfo.formatSet.format.glInternalFormat != internalFormat)
{ {
return false; return false;
} }
...@@ -3788,11 +3788,11 @@ gl::Error Renderer11::packPixels(const TextureHelper11 &textureHelper, ...@@ -3788,11 +3788,11 @@ gl::Error Renderer11::packPixels(const TextureHelper11 &textureHelper,
int inputPitch = static_cast<int>(mapping.RowPitch); int inputPitch = static_cast<int>(mapping.RowPitch);
const auto &angleFormatInfo = textureHelper.getFormatSet(); const auto &angleFormatInfo = textureHelper.getFormatSet();
ASSERT(angleFormatInfo.glInternalFormat != GL_NONE); ASSERT(angleFormatInfo.format.glInternalFormat != GL_NONE);
const gl::InternalFormat &sourceFormatInfo = const gl::InternalFormat &sourceFormatInfo =
gl::GetInternalFormatInfo(angleFormatInfo.glInternalFormat); gl::GetInternalFormatInfo(angleFormatInfo.format.glInternalFormat);
const auto &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(textureHelper.getFormat()); const auto &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(textureHelper.getFormat());
ColorReadFunction colorReadFunction = angleFormatInfo.colorReadFunction; ColorReadFunction colorReadFunction = angleFormatInfo.format.colorReadFunction;
PackPixels(params, sourceFormatInfo, dxgiFormatInfo.fastCopyFunctions, colorReadFunction, PackPixels(params, sourceFormatInfo, dxgiFormatInfo.fastCopyFunctions, colorReadFunction,
inputPitch, source, pixelsOut); inputPitch, source, pixelsOut);
...@@ -3988,7 +3988,8 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn, ...@@ -3988,7 +3988,8 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
bool partialDSBlit = (dxgiFormatInfo.depthBits > 0 && depthBlit) != (dxgiFormatInfo.stencilBits > 0 && stencilBlit); bool partialDSBlit = (dxgiFormatInfo.depthBits > 0 && depthBlit) != (dxgiFormatInfo.stencilBits > 0 && stencilBlit);
if (readRenderTarget11->getFormatSet().format == drawRenderTarget11->getFormatSet().format && if (readRenderTarget11->getFormatSet().format.id ==
drawRenderTarget11->getFormatSet().format.id &&
!stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit && !stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit &&
!colorMaskingNeeded && (!(depthBlit || stencilBlit) || wholeBufferCopy)) !colorMaskingNeeded && (!(depthBlit || stencilBlit) || wholeBufferCopy))
{ {
......
...@@ -43,11 +43,11 @@ namespace rx ...@@ -43,11 +43,11 @@ namespace rx
namespace d3d11 namespace d3d11
{{ {{
const ANGLEFormatSet &GetANGLEFormatSet(angle::Format angleFormat, const ANGLEFormatSet &GetANGLEFormatSet(angle::Format::ID formatID,
const Renderer11DeviceCaps &deviceCaps) const Renderer11DeviceCaps &deviceCaps)
{{ {{
// clang-format off // clang-format off
switch (angleFormat) switch (formatID)
{{ {{
{angle_format_info_cases} {angle_format_info_cases}
default: default:
...@@ -73,7 +73,7 @@ const TextureFormat &GetTextureFormatInfo(GLenum internalFormat, ...@@ -73,7 +73,7 @@ const TextureFormat &GetTextureFormatInfo(GLenum internalFormat,
}} }}
// clang-format on // clang-format on
static const TextureFormat defaultInfo(GL_NONE, angle::Format::NONE, nullptr, deviceCaps); static const TextureFormat defaultInfo(GL_NONE, angle::Format::ID::NONE, nullptr, deviceCaps);
return defaultInfo; return defaultInfo;
}} // GetTextureFormatInfo }} // GetTextureFormatInfo
...@@ -158,8 +158,8 @@ def get_internal_format_initializer(internal_format, angle_format): ...@@ -158,8 +158,8 @@ def get_internal_format_initializer(internal_format, angle_format):
return internal_format_initializer return internal_format_initializer
def get_swizzle_format_id(angle_format_id, angle_format): def get_swizzle_format_id(angle_format_id, angle_format):
if angle_format_id == 'angle::Format::NONE': if angle_format_id == 'NONE':
return 'angle::Format::NONE' return 'NONE'
elif 'swizzleFormat' in angle_format: elif 'swizzleFormat' in angle_format:
# For some special formats like compressed formats that don't have a clearly defined number # For some special formats like compressed formats that don't have a clearly defined number
# of bits per channel, swizzle format needs to be specified manually. # of bits per channel, swizzle format needs to be specified manually.
...@@ -183,9 +183,9 @@ def get_swizzle_format_id(angle_format_id, angle_format): ...@@ -183,9 +183,9 @@ def get_swizzle_format_id(angle_format_id, angle_format):
# defined component type. # defined component type.
if angle_format['channels'].find('d') >= 0: if angle_format['channels'].find('d') >= 0:
if b == 24 or b == 32: if b == 24 or b == 32:
return 'angle::Format::R32G32B32A32_FLOAT' return 'R32G32B32A32_FLOAT'
if b == 16: if b == 16:
return 'angle::Format::R16G16B16A16_UNORM' return 'R16G16B16A16_UNORM'
if b == 24: if b == 24:
raise ValueError('unexpected 24-bit format when determining swizzleformat for format: ' + angle_format_id) raise ValueError('unexpected 24-bit format when determining swizzleformat for format: ' + angle_format_id)
...@@ -195,15 +195,15 @@ def get_swizzle_format_id(angle_format_id, angle_format): ...@@ -195,15 +195,15 @@ def get_swizzle_format_id(angle_format_id, angle_format):
component_type = angle_format['componentType'] component_type = angle_format['componentType']
if component_type == 'uint': if component_type == 'uint':
return 'angle::Format::R{}G{}B{}A{}_UINT'.format(b, b, b, b) return 'R{}G{}B{}A{}_UINT'.format(b, b, b, b)
elif component_type == 'int': elif component_type == 'int':
return 'angle::Format::R{}G{}B{}A{}_SINT'.format(b, b, b, b) return 'R{}G{}B{}A{}_SINT'.format(b, b, b, b)
elif component_type == 'unorm': elif component_type == 'unorm':
return 'angle::Format::R{}G{}B{}A{}_UNORM'.format(b, b, b, b) return 'R{}G{}B{}A{}_UNORM'.format(b, b, b, b)
elif component_type == 'snorm': elif component_type == 'snorm':
return 'angle::Format::R{}G{}B{}A{}_SNORM'.format(b, b, b, b) return 'R{}G{}B{}A{}_SNORM'.format(b, b, b, b)
elif component_type == 'float': elif component_type == 'float':
return 'angle::Format::R{}G{}B{}A{}_FLOAT'.format(b, b, b, b) return 'R{}G{}B{}A{}_FLOAT'.format(b, b, b, b)
else: else:
raise ValueError('could not determine swizzleformat based on componentType for format: ' + angle_format_id) raise ValueError('could not determine swizzleformat based on componentType for format: ' + angle_format_id)
...@@ -221,11 +221,11 @@ def get_texture_format_item(idx, internal_format, requirements_fn, angle_format_ ...@@ -221,11 +221,11 @@ def get_texture_format_item(idx, internal_format, requirements_fn, angle_format_
table_data += ' {\n' table_data += ' {\n'
indent += ' ' indent += ' '
table_data += indent + 'static const TextureFormat textureFormat(internalFormat,\n' table_data += indent + 'static const TextureFormat info(internalFormat,\n'
table_data += indent + ' ' + angle_format_id + ',\n' table_data += indent + ' angle::Format::ID::' + angle_format_id + ',\n'
table_data += indent + ' ' + internal_format_initializer + ',\n' table_data += indent + ' ' + internal_format_initializer + ',\n'
table_data += indent + ' deviceCaps);\n' table_data += indent + ' deviceCaps);\n'
table_data += indent + 'return textureFormat;\n' table_data += indent + 'return info;\n'
if requirements_fn != None: if requirements_fn != None:
table_data += ' }\n' table_data += ' }\n'
...@@ -257,51 +257,6 @@ def parse_json_into_switch_texture_format_string(json_map, json_data): ...@@ -257,51 +257,6 @@ def parse_json_into_switch_texture_format_string(json_map, json_data):
return table_data return table_data
def get_channel_struct(angle_format):
if 'bits' not in angle_format:
return None
bits = angle_format['bits']
if 'depth' in bits or 'stencil' in bits:
return None
if 'channelStruct' in angle_format:
return angle_format['channelStruct']
struct_name = ''
for channel in angle_format['channels']:
if channel == 'r':
struct_name += 'R{}'.format(bits['red'])
if channel == 'g':
struct_name += 'G{}'.format(bits['green'])
if channel == 'b':
struct_name += 'B{}'.format(bits['blue'])
if channel == 'a':
struct_name += 'A{}'.format(bits['alpha'])
if angle_format['componentType'] == 'float':
struct_name += 'F'
if angle_format['componentType'] == 'int' or angle_format['componentType'] == 'snorm':
struct_name += 'S'
return struct_name
def get_mip_generation_function(angle_format):
channel_struct = get_channel_struct(angle_format)
if channel_struct == None:
return 'nullptr'
return 'GenerateMip<' + channel_struct + '>'
def get_color_read_function(angle_format):
channel_struct = get_channel_struct(angle_format)
if channel_struct == None:
return 'nullptr'
component_type_map = {
'uint': 'GLuint',
'int': 'GLint',
'unorm': 'GLfloat',
'snorm': 'GLfloat',
'float': 'GLfloat'
}
return 'ReadColor<' + channel_struct + ', '+ component_type_map[angle_format['componentType']] + '>'
def get_blit_srv_format(angle_format): def get_blit_srv_format(angle_format):
if 'channels' not in angle_format: if 'channels' not in angle_format:
return 'DXGI_FORMAT_UNKNOWN' return 'DXGI_FORMAT_UNKNOWN'
...@@ -312,35 +267,27 @@ def get_blit_srv_format(angle_format): ...@@ -312,35 +267,27 @@ def get_blit_srv_format(angle_format):
format_entry_template = """{space}{{ format_entry_template = """{space}{{
{space} static const ANGLEFormatSet formatInfo({formatName}, {space} static const ANGLEFormatSet info(angle::Format::ID::{formatName},
{space} {glInternalFormat}, {space} {texFormat},
{space} {fboImplementationInternalFormat}, {space} {srvFormat},
{space} {texFormat}, {space} {rtvFormat},
{space} {srvFormat}, {space} {dsvFormat},
{space} {rtvFormat}, {space} {blitSRVFormat},
{space} {dsvFormat}, {space} angle::Format::ID::{swizzleFormat});
{space} {blitSRVFormat}, {space} return info;
{space} {swizzleFormat},
{space} {mipGenerationFunction},
{space} {colorReadFunction});
{space} return formatInfo;
{space}}} {space}}}
""" """
split_format_entry_template = """{space} {condition} split_format_entry_template = """{space} {condition}
{space} {{ {space} {{
{space} static const ANGLEFormatSet formatInfo({formatName}, {space} static const ANGLEFormatSet info(angle::Format::ID::{formatName},
{space} {glInternalFormat}, {space} {texFormat},
{space} {fboImplementationInternalFormat}, {space} {srvFormat},
{space} {texFormat}, {space} {rtvFormat},
{space} {srvFormat}, {space} {dsvFormat},
{space} {rtvFormat}, {space} {blitSRVFormat},
{space} {dsvFormat}, {space} angle::Format::ID::{swizzleFormat});
{space} {blitSRVFormat}, {space} return info;
{space} {swizzleFormat},
{space} {mipGenerationFunction},
{space} {colorReadFunction});
{space} return formatInfo;
{space} }} {space} }}
""" """
...@@ -355,25 +302,15 @@ def json_to_table_data(format_name, prefix, json): ...@@ -355,25 +302,15 @@ def json_to_table_data(format_name, prefix, json):
"srvFormat": "DXGI_FORMAT_UNKNOWN", "srvFormat": "DXGI_FORMAT_UNKNOWN",
"rtvFormat": "DXGI_FORMAT_UNKNOWN", "rtvFormat": "DXGI_FORMAT_UNKNOWN",
"dsvFormat": "DXGI_FORMAT_UNKNOWN", "dsvFormat": "DXGI_FORMAT_UNKNOWN",
"glInternalFormat": "GL_NONE",
"condition": prefix, "condition": prefix,
} }
for k, v in json.iteritems(): for k, v in json.iteritems():
parsed[k] = v parsed[k] = v
if (format_name != "angle::Format::NONE") and (parsed["glInternalFormat"] == "GL_NONE"):
print("Missing 'glInternalFormat' from " + format_name)
sys.exit(1)
if "fboImplementationInternalFormat" not in parsed:
parsed["fboImplementationInternalFormat"] = parsed["glInternalFormat"]
# Derived values. # Derived values.
parsed["blitSRVFormat"] = get_blit_srv_format(parsed) parsed["blitSRVFormat"] = get_blit_srv_format(parsed)
parsed["swizzleFormat"] = get_swizzle_format_id(format_name, parsed) parsed["swizzleFormat"] = get_swizzle_format_id(format_name, parsed)
parsed["mipGenerationFunction"] = get_mip_generation_function(parsed)
parsed["colorReadFunction"] = get_color_read_function(parsed)
if len(prefix) > 0: if len(prefix) > 0:
return split_format_entry_template.format(**parsed) return split_format_entry_template.format(**parsed)
...@@ -383,7 +320,7 @@ def json_to_table_data(format_name, prefix, json): ...@@ -383,7 +320,7 @@ def json_to_table_data(format_name, prefix, json):
def parse_json_into_switch_angle_format_string(json_data): def parse_json_into_switch_angle_format_string(json_data):
table_data = '' table_data = ''
for angle_format_item in sorted(json_data.iteritems()): for angle_format_item in sorted(json_data.iteritems()):
table_data += ' case ' + angle_format_item[0] + ':\n' table_data += ' case angle::Format::ID::' + angle_format_item[0] + ':\n'
format_name = angle_format_item[0] format_name = angle_format_item[0]
angle_format = angle_format_item[1] angle_format = angle_format_item[1]
......
{ {
"angle::Format::NONE": { "NONE": {
}, },
"angle::Format::A8_UNORM": { "A8_UNORM": {
"texFormat": "DXGI_FORMAT_A8_UNORM", "texFormat": "DXGI_FORMAT_A8_UNORM",
"srvFormat": "DXGI_FORMAT_A8_UNORM", "srvFormat": "DXGI_FORMAT_A8_UNORM",
"rtvFormat": "DXGI_FORMAT_A8_UNORM", "rtvFormat": "DXGI_FORMAT_A8_UNORM",
"channels": "a", "channels": "a",
"componentType": "unorm", "componentType": "unorm",
"bits": { "alpha": 8 }, "bits": { "alpha": 8 }
"glInternalFormat": "GL_ALPHA8_EXT"
}, },
"angle::Format::R8G8B8A8_UNORM": { "R8G8B8A8_UNORM": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_UNORM", "texFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM", "srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
"rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM", "rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
...@@ -19,7 +18,7 @@ ...@@ -19,7 +18,7 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 }, "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8" "glInternalFormat": "GL_RGBA8"
}, },
"angle::Format::R16G16B16A16_UNORM": { "R16G16B16A16_UNORM": {
"texFormat": "DXGI_FORMAT_R16G16B16A16_UNORM", "texFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
"srvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM", "srvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
"rtvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM", "rtvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
...@@ -28,7 +27,7 @@ ...@@ -28,7 +27,7 @@
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 }, "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16_EXT" "glInternalFormat": "GL_RGBA16_EXT"
}, },
"angle::Format::R16G16B16A16_FLOAT": { "R16G16B16A16_FLOAT": {
"texFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT", "texFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT",
"srvFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT", "srvFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT",
"rtvFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT", "rtvFormat": "DXGI_FORMAT_R16G16B16A16_FLOAT",
...@@ -37,7 +36,7 @@ ...@@ -37,7 +36,7 @@
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 }, "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16F" "glInternalFormat": "GL_RGBA16F"
}, },
"angle::Format::R32G32B32A32_FLOAT": { "R32G32B32A32_FLOAT": {
"texFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT", "texFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT",
"srvFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT", "srvFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT",
"rtvFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT", "rtvFormat": "DXGI_FORMAT_R32G32B32A32_FLOAT",
...@@ -46,7 +45,7 @@ ...@@ -46,7 +45,7 @@
"bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 }, "bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
"glInternalFormat": "GL_RGBA32F" "glInternalFormat": "GL_RGBA32F"
}, },
"angle::Format::B8G8R8A8_UNORM": { "B8G8R8A8_UNORM": {
"texFormat": "DXGI_FORMAT_B8G8R8A8_UNORM", "texFormat": "DXGI_FORMAT_B8G8R8A8_UNORM",
"srvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM", "srvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM",
"rtvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM", "rtvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM",
...@@ -55,31 +54,31 @@ ...@@ -55,31 +54,31 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 }, "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_BGRA8_EXT" "glInternalFormat": "GL_BGRA8_EXT"
}, },
"angle::Format::BC1_UNORM": { "BC1_UNORM": {
"texFormat": "DXGI_FORMAT_BC1_UNORM", "texFormat": "DXGI_FORMAT_BC1_UNORM",
"srvFormat": "DXGI_FORMAT_BC1_UNORM", "srvFormat": "DXGI_FORMAT_BC1_UNORM",
"channels": "rgba", "channels": "rgba",
"componentType": "unorm", "componentType": "unorm",
"swizzleFormat": "angle::Format::R8G8B8A8_UNORM", "swizzleFormat": "R8G8B8A8_UNORM",
"glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" "glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"
}, },
"angle::Format::BC2_UNORM": { "BC2_UNORM": {
"texFormat": "DXGI_FORMAT_BC2_UNORM", "texFormat": "DXGI_FORMAT_BC2_UNORM",
"srvFormat": "DXGI_FORMAT_BC2_UNORM", "srvFormat": "DXGI_FORMAT_BC2_UNORM",
"channels": "rgba", "channels": "rgba",
"componentType": "unorm", "componentType": "unorm",
"swizzleFormat": "angle::Format::R8G8B8A8_UNORM", "swizzleFormat": "R8G8B8A8_UNORM",
"glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE" "glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE"
}, },
"angle::Format::BC3_UNORM": { "BC3_UNORM": {
"texFormat": "DXGI_FORMAT_BC3_UNORM", "texFormat": "DXGI_FORMAT_BC3_UNORM",
"srvFormat": "DXGI_FORMAT_BC3_UNORM", "srvFormat": "DXGI_FORMAT_BC3_UNORM",
"channels": "rgba", "channels": "rgba",
"componentType": "unorm", "componentType": "unorm",
"swizzleFormat": "angle::Format::R8G8B8A8_UNORM", "swizzleFormat": "R8G8B8A8_UNORM",
"glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE" "glInternalFormat": "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE"
}, },
"angle::Format::D24_UNORM_S8_UINT": { "D24_UNORM_S8_UINT": {
"FL10Plus": { "FL10Plus": {
"texFormat": "DXGI_FORMAT_R24G8_TYPELESS", "texFormat": "DXGI_FORMAT_R24G8_TYPELESS",
"srvFormat": "DXGI_FORMAT_R24_UNORM_X8_TYPELESS" "srvFormat": "DXGI_FORMAT_R24_UNORM_X8_TYPELESS"
...@@ -92,7 +91,7 @@ ...@@ -92,7 +91,7 @@
"bits": { "depth": 24, "stencil": 8 }, "bits": { "depth": 24, "stencil": 8 },
"glInternalFormat": "GL_DEPTH24_STENCIL8_OES" "glInternalFormat": "GL_DEPTH24_STENCIL8_OES"
}, },
"angle::Format::D32_FLOAT_S8X24_UINT": { "D32_FLOAT_S8X24_UINT": {
"texFormat": "DXGI_FORMAT_R32G8X24_TYPELESS", "texFormat": "DXGI_FORMAT_R32G8X24_TYPELESS",
"srvFormat": "DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS", "srvFormat": "DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",
"dsvFormat": "DXGI_FORMAT_D32_FLOAT_S8X24_UINT", "dsvFormat": "DXGI_FORMAT_D32_FLOAT_S8X24_UINT",
...@@ -100,7 +99,7 @@ ...@@ -100,7 +99,7 @@
"bits": { "depth": 32, "stencil": 8 }, "bits": { "depth": 32, "stencil": 8 },
"glInternalFormat": "GL_DEPTH32F_STENCIL8" "glInternalFormat": "GL_DEPTH32F_STENCIL8"
}, },
"angle::Format::D16_UNORM": { "D16_UNORM": {
"FL10Plus": { "FL10Plus": {
"texFormat": "DXGI_FORMAT_R16_TYPELESS", "texFormat": "DXGI_FORMAT_R16_TYPELESS",
"srvFormat": "DXGI_FORMAT_R16_UNORM" "srvFormat": "DXGI_FORMAT_R16_UNORM"
...@@ -114,7 +113,7 @@ ...@@ -114,7 +113,7 @@
"bits": { "depth": 16 }, "bits": { "depth": 16 },
"glInternalFormat": "GL_DEPTH_COMPONENT16" "glInternalFormat": "GL_DEPTH_COMPONENT16"
}, },
"angle::Format::D32_FLOAT": { "D32_FLOAT": {
"texFormat": "DXGI_FORMAT_R32_TYPELESS", "texFormat": "DXGI_FORMAT_R32_TYPELESS",
"srvFormat": "DXGI_FORMAT_R32_FLOAT", "srvFormat": "DXGI_FORMAT_R32_FLOAT",
"dsvFormat": "DXGI_FORMAT_D32_FLOAT", "dsvFormat": "DXGI_FORMAT_D32_FLOAT",
...@@ -123,7 +122,7 @@ ...@@ -123,7 +122,7 @@
"bits": { "depth": 32 }, "bits": { "depth": 32 },
"glInternalFormat": "GL_DEPTH_COMPONENT32F" "glInternalFormat": "GL_DEPTH_COMPONENT32F"
}, },
"angle::Format::R11G11B10_FLOAT": { "R11G11B10_FLOAT": {
"texFormat": "DXGI_FORMAT_R11G11B10_FLOAT", "texFormat": "DXGI_FORMAT_R11G11B10_FLOAT",
"srvFormat": "DXGI_FORMAT_R11G11B10_FLOAT", "srvFormat": "DXGI_FORMAT_R11G11B10_FLOAT",
"rtvFormat": "DXGI_FORMAT_R11G11B10_FLOAT", "rtvFormat": "DXGI_FORMAT_R11G11B10_FLOAT",
...@@ -132,7 +131,7 @@ ...@@ -132,7 +131,7 @@
"bits": { "red": 11, "green": 11, "blue": 10 }, "bits": { "red": 11, "green": 11, "blue": 10 },
"glInternalFormat": "GL_R11F_G11F_B10F" "glInternalFormat": "GL_R11F_G11F_B10F"
}, },
"angle::Format::R16_FLOAT": { "R16_FLOAT": {
"texFormat": "DXGI_FORMAT_R16_FLOAT", "texFormat": "DXGI_FORMAT_R16_FLOAT",
"srvFormat": "DXGI_FORMAT_R16_FLOAT", "srvFormat": "DXGI_FORMAT_R16_FLOAT",
"rtvFormat": "DXGI_FORMAT_R16_FLOAT", "rtvFormat": "DXGI_FORMAT_R16_FLOAT",
...@@ -141,7 +140,7 @@ ...@@ -141,7 +140,7 @@
"bits": { "red": 16 }, "bits": { "red": 16 },
"glInternalFormat": "GL_R16F" "glInternalFormat": "GL_R16F"
}, },
"angle::Format::R16_SINT": { "R16_SINT": {
"texFormat": "DXGI_FORMAT_R16_SINT", "texFormat": "DXGI_FORMAT_R16_SINT",
"srvFormat": "DXGI_FORMAT_R16_SINT", "srvFormat": "DXGI_FORMAT_R16_SINT",
"rtvFormat": "DXGI_FORMAT_R16_SINT", "rtvFormat": "DXGI_FORMAT_R16_SINT",
...@@ -150,7 +149,7 @@ ...@@ -150,7 +149,7 @@
"bits": { "red": 16 }, "bits": { "red": 16 },
"glInternalFormat": "GL_R16I" "glInternalFormat": "GL_R16I"
}, },
"angle::Format::R16_UINT": { "R16_UINT": {
"texFormat": "DXGI_FORMAT_R16_UINT", "texFormat": "DXGI_FORMAT_R16_UINT",
"srvFormat": "DXGI_FORMAT_R16_UINT", "srvFormat": "DXGI_FORMAT_R16_UINT",
"rtvFormat": "DXGI_FORMAT_R16_UINT", "rtvFormat": "DXGI_FORMAT_R16_UINT",
...@@ -159,7 +158,7 @@ ...@@ -159,7 +158,7 @@
"bits": { "red": 16 }, "bits": { "red": 16 },
"glInternalFormat": "GL_R16UI" "glInternalFormat": "GL_R16UI"
}, },
"angle::Format::R32_FLOAT": { "R32_FLOAT": {
"texFormat": "DXGI_FORMAT_R32_FLOAT", "texFormat": "DXGI_FORMAT_R32_FLOAT",
"srvFormat": "DXGI_FORMAT_R32_FLOAT", "srvFormat": "DXGI_FORMAT_R32_FLOAT",
"rtvFormat": "DXGI_FORMAT_R32_FLOAT", "rtvFormat": "DXGI_FORMAT_R32_FLOAT",
...@@ -168,7 +167,7 @@ ...@@ -168,7 +167,7 @@
"bits": { "red": 32 }, "bits": { "red": 32 },
"glInternalFormat": "GL_R32F" "glInternalFormat": "GL_R32F"
}, },
"angle::Format::R32_SINT": { "R32_SINT": {
"texFormat": "DXGI_FORMAT_R32_SINT", "texFormat": "DXGI_FORMAT_R32_SINT",
"srvFormat": "DXGI_FORMAT_R32_SINT", "srvFormat": "DXGI_FORMAT_R32_SINT",
"rtvFormat": "DXGI_FORMAT_R32_SINT", "rtvFormat": "DXGI_FORMAT_R32_SINT",
...@@ -177,7 +176,7 @@ ...@@ -177,7 +176,7 @@
"bits": { "red": 32 }, "bits": { "red": 32 },
"glInternalFormat": "GL_R32I" "glInternalFormat": "GL_R32I"
}, },
"angle::Format::R32_UINT": { "R32_UINT": {
"texFormat": "DXGI_FORMAT_R32_UINT", "texFormat": "DXGI_FORMAT_R32_UINT",
"srvFormat": "DXGI_FORMAT_R32_UINT", "srvFormat": "DXGI_FORMAT_R32_UINT",
"rtvFormat": "DXGI_FORMAT_R32_UINT", "rtvFormat": "DXGI_FORMAT_R32_UINT",
...@@ -186,7 +185,7 @@ ...@@ -186,7 +185,7 @@
"bits": { "red": 32 }, "bits": { "red": 32 },
"glInternalFormat": "GL_R32UI" "glInternalFormat": "GL_R32UI"
}, },
"angle::Format::R8_UNORM": { "R8_UNORM": {
"texFormat": "DXGI_FORMAT_R8_UNORM", "texFormat": "DXGI_FORMAT_R8_UNORM",
"srvFormat": "DXGI_FORMAT_R8_UNORM", "srvFormat": "DXGI_FORMAT_R8_UNORM",
"rtvFormat": "DXGI_FORMAT_R8_UNORM", "rtvFormat": "DXGI_FORMAT_R8_UNORM",
...@@ -195,7 +194,7 @@ ...@@ -195,7 +194,7 @@
"bits": { "red": 8 }, "bits": { "red": 8 },
"glInternalFormat": "GL_R8" "glInternalFormat": "GL_R8"
}, },
"angle::Format::R8_SINT": { "R8_SINT": {
"texFormat": "DXGI_FORMAT_R8_SINT", "texFormat": "DXGI_FORMAT_R8_SINT",
"srvFormat": "DXGI_FORMAT_R8_SINT", "srvFormat": "DXGI_FORMAT_R8_SINT",
"rtvFormat": "DXGI_FORMAT_R8_SINT", "rtvFormat": "DXGI_FORMAT_R8_SINT",
...@@ -204,7 +203,7 @@ ...@@ -204,7 +203,7 @@
"bits": { "red": 8 }, "bits": { "red": 8 },
"glInternalFormat": "GL_R8I" "glInternalFormat": "GL_R8I"
}, },
"angle::Format::R8_UINT": { "R8_UINT": {
"texFormat": "DXGI_FORMAT_R8_UINT", "texFormat": "DXGI_FORMAT_R8_UINT",
"srvFormat": "DXGI_FORMAT_R8_UINT", "srvFormat": "DXGI_FORMAT_R8_UINT",
"rtvFormat": "DXGI_FORMAT_R8_UINT", "rtvFormat": "DXGI_FORMAT_R8_UINT",
...@@ -213,7 +212,7 @@ ...@@ -213,7 +212,7 @@
"bits": { "red": 8 }, "bits": { "red": 8 },
"glInternalFormat": "GL_R8UI" "glInternalFormat": "GL_R8UI"
}, },
"angle::Format::R8_SNORM": { "R8_SNORM": {
"texFormat": "DXGI_FORMAT_R8_SNORM", "texFormat": "DXGI_FORMAT_R8_SNORM",
"srvFormat": "DXGI_FORMAT_R8_SNORM", "srvFormat": "DXGI_FORMAT_R8_SNORM",
"channels": "r", "channels": "r",
...@@ -221,7 +220,7 @@ ...@@ -221,7 +220,7 @@
"bits": { "red": 8 }, "bits": { "red": 8 },
"glInternalFormat": "GL_R8_SNORM" "glInternalFormat": "GL_R8_SNORM"
}, },
"angle::Format::R16G16_FLOAT": { "R16G16_FLOAT": {
"texFormat": "DXGI_FORMAT_R16G16_FLOAT", "texFormat": "DXGI_FORMAT_R16G16_FLOAT",
"srvFormat": "DXGI_FORMAT_R16G16_FLOAT", "srvFormat": "DXGI_FORMAT_R16G16_FLOAT",
"rtvFormat": "DXGI_FORMAT_R16G16_FLOAT", "rtvFormat": "DXGI_FORMAT_R16G16_FLOAT",
...@@ -230,7 +229,7 @@ ...@@ -230,7 +229,7 @@
"bits": { "red": 16, "green": 16 }, "bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16F" "glInternalFormat": "GL_RG16F"
}, },
"angle::Format::R16G16_SINT": { "R16G16_SINT": {
"texFormat": "DXGI_FORMAT_R16G16_SINT", "texFormat": "DXGI_FORMAT_R16G16_SINT",
"srvFormat": "DXGI_FORMAT_R16G16_SINT", "srvFormat": "DXGI_FORMAT_R16G16_SINT",
"rtvFormat": "DXGI_FORMAT_R16G16_SINT", "rtvFormat": "DXGI_FORMAT_R16G16_SINT",
...@@ -239,7 +238,7 @@ ...@@ -239,7 +238,7 @@
"bits": { "red": 16, "green": 16 }, "bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16I" "glInternalFormat": "GL_RG16I"
}, },
"angle::Format::R16G16_UINT": { "R16G16_UINT": {
"texFormat": "DXGI_FORMAT_R16G16_UINT", "texFormat": "DXGI_FORMAT_R16G16_UINT",
"srvFormat": "DXGI_FORMAT_R16G16_UINT", "srvFormat": "DXGI_FORMAT_R16G16_UINT",
"rtvFormat": "DXGI_FORMAT_R16G16_UINT", "rtvFormat": "DXGI_FORMAT_R16G16_UINT",
...@@ -248,7 +247,7 @@ ...@@ -248,7 +247,7 @@
"bits": { "red": 16, "green": 16 }, "bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16UI" "glInternalFormat": "GL_RG16UI"
}, },
"angle::Format::R32G32_FLOAT": { "R32G32_FLOAT": {
"texFormat": "DXGI_FORMAT_R32G32_FLOAT", "texFormat": "DXGI_FORMAT_R32G32_FLOAT",
"srvFormat": "DXGI_FORMAT_R32G32_FLOAT", "srvFormat": "DXGI_FORMAT_R32G32_FLOAT",
"rtvFormat": "DXGI_FORMAT_R32G32_FLOAT", "rtvFormat": "DXGI_FORMAT_R32G32_FLOAT",
...@@ -257,7 +256,7 @@ ...@@ -257,7 +256,7 @@
"bits": { "red": 32, "green": 32 }, "bits": { "red": 32, "green": 32 },
"glInternalFormat": "GL_RG32F" "glInternalFormat": "GL_RG32F"
}, },
"angle::Format::R32G32_SINT": { "R32G32_SINT": {
"texFormat": "DXGI_FORMAT_R32G32_SINT", "texFormat": "DXGI_FORMAT_R32G32_SINT",
"srvFormat": "DXGI_FORMAT_R32G32_SINT", "srvFormat": "DXGI_FORMAT_R32G32_SINT",
"rtvFormat": "DXGI_FORMAT_R32G32_SINT", "rtvFormat": "DXGI_FORMAT_R32G32_SINT",
...@@ -266,7 +265,7 @@ ...@@ -266,7 +265,7 @@
"bits": { "red": 32, "green": 32 }, "bits": { "red": 32, "green": 32 },
"glInternalFormat": "GL_RG32I" "glInternalFormat": "GL_RG32I"
}, },
"angle::Format::R32G32_UINT": { "R32G32_UINT": {
"texFormat": "DXGI_FORMAT_R32G32_UINT", "texFormat": "DXGI_FORMAT_R32G32_UINT",
"srvFormat": "DXGI_FORMAT_R32G32_UINT", "srvFormat": "DXGI_FORMAT_R32G32_UINT",
"rtvFormat": "DXGI_FORMAT_R32G32_UINT", "rtvFormat": "DXGI_FORMAT_R32G32_UINT",
...@@ -275,7 +274,7 @@ ...@@ -275,7 +274,7 @@
"bits": { "red": 32, "green": 32 }, "bits": { "red": 32, "green": 32 },
"glInternalFormat": "GL_RG32UI" "glInternalFormat": "GL_RG32UI"
}, },
"angle::Format::R8G8_UNORM": { "R8G8_UNORM": {
"texFormat": "DXGI_FORMAT_R8G8_UNORM", "texFormat": "DXGI_FORMAT_R8G8_UNORM",
"srvFormat": "DXGI_FORMAT_R8G8_UNORM", "srvFormat": "DXGI_FORMAT_R8G8_UNORM",
"rtvFormat": "DXGI_FORMAT_R8G8_UNORM", "rtvFormat": "DXGI_FORMAT_R8G8_UNORM",
...@@ -284,7 +283,7 @@ ...@@ -284,7 +283,7 @@
"bits": { "red": 8, "green": 8 }, "bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8" "glInternalFormat": "GL_RG8"
}, },
"angle::Format::R8G8_SINT": { "R8G8_SINT": {
"texFormat": "DXGI_FORMAT_R8G8_SINT", "texFormat": "DXGI_FORMAT_R8G8_SINT",
"srvFormat": "DXGI_FORMAT_R8G8_SINT", "srvFormat": "DXGI_FORMAT_R8G8_SINT",
"rtvFormat": "DXGI_FORMAT_R8G8_SINT", "rtvFormat": "DXGI_FORMAT_R8G8_SINT",
...@@ -293,7 +292,7 @@ ...@@ -293,7 +292,7 @@
"bits": { "red": 8, "green": 8 }, "bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8I" "glInternalFormat": "GL_RG8I"
}, },
"angle::Format::R8G8_UINT": { "R8G8_UINT": {
"texFormat": "DXGI_FORMAT_R8G8_UINT", "texFormat": "DXGI_FORMAT_R8G8_UINT",
"srvFormat": "DXGI_FORMAT_R8G8_UINT", "srvFormat": "DXGI_FORMAT_R8G8_UINT",
"rtvFormat": "DXGI_FORMAT_R8G8_UINT", "rtvFormat": "DXGI_FORMAT_R8G8_UINT",
...@@ -302,7 +301,7 @@ ...@@ -302,7 +301,7 @@
"bits": { "red": 8, "green": 8 }, "bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8UI" "glInternalFormat": "GL_RG8UI"
}, },
"angle::Format::R8G8_SNORM": { "R8G8_SNORM": {
"texFormat": "DXGI_FORMAT_R8G8_SNORM", "texFormat": "DXGI_FORMAT_R8G8_SNORM",
"srvFormat": "DXGI_FORMAT_R8G8_SNORM", "srvFormat": "DXGI_FORMAT_R8G8_SNORM",
"channels": "rg", "channels": "rg",
...@@ -310,7 +309,7 @@ ...@@ -310,7 +309,7 @@
"bits": { "red": 8, "green": 8 }, "bits": { "red": 8, "green": 8 },
"glInternalFormat": "GL_RG8_SNORM" "glInternalFormat": "GL_RG8_SNORM"
}, },
"angle::Format::R10G10B10A2_UNORM": { "R10G10B10A2_UNORM": {
"texFormat": "DXGI_FORMAT_R10G10B10A2_UNORM", "texFormat": "DXGI_FORMAT_R10G10B10A2_UNORM",
"srvFormat": "DXGI_FORMAT_R10G10B10A2_UNORM", "srvFormat": "DXGI_FORMAT_R10G10B10A2_UNORM",
"rtvFormat": "DXGI_FORMAT_R10G10B10A2_UNORM", "rtvFormat": "DXGI_FORMAT_R10G10B10A2_UNORM",
...@@ -319,7 +318,7 @@ ...@@ -319,7 +318,7 @@
"bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 }, "bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 },
"glInternalFormat": "GL_RGB10_A2" "glInternalFormat": "GL_RGB10_A2"
}, },
"angle::Format::R10G10B10A2_UINT": { "R10G10B10A2_UINT": {
"texFormat": "DXGI_FORMAT_R10G10B10A2_UINT", "texFormat": "DXGI_FORMAT_R10G10B10A2_UINT",
"srvFormat": "DXGI_FORMAT_R10G10B10A2_UINT", "srvFormat": "DXGI_FORMAT_R10G10B10A2_UINT",
"rtvFormat": "DXGI_FORMAT_R10G10B10A2_UINT", "rtvFormat": "DXGI_FORMAT_R10G10B10A2_UINT",
...@@ -328,7 +327,7 @@ ...@@ -328,7 +327,7 @@
"bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 }, "bits": { "red": 10, "green": 10, "blue": 10, "alpha": 2 },
"glInternalFormat": "GL_RGB10_A2UI" "glInternalFormat": "GL_RGB10_A2UI"
}, },
"angle::Format::R16G16B16A16_SINT": { "R16G16B16A16_SINT": {
"texFormat": "DXGI_FORMAT_R16G16B16A16_SINT", "texFormat": "DXGI_FORMAT_R16G16B16A16_SINT",
"srvFormat": "DXGI_FORMAT_R16G16B16A16_SINT", "srvFormat": "DXGI_FORMAT_R16G16B16A16_SINT",
"rtvFormat": "DXGI_FORMAT_R16G16B16A16_SINT", "rtvFormat": "DXGI_FORMAT_R16G16B16A16_SINT",
...@@ -337,7 +336,7 @@ ...@@ -337,7 +336,7 @@
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 }, "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16I" "glInternalFormat": "GL_RGBA16I"
}, },
"angle::Format::R16G16B16A16_UINT": { "R16G16B16A16_UINT": {
"texFormat": "DXGI_FORMAT_R16G16B16A16_UINT", "texFormat": "DXGI_FORMAT_R16G16B16A16_UINT",
"srvFormat": "DXGI_FORMAT_R16G16B16A16_UINT", "srvFormat": "DXGI_FORMAT_R16G16B16A16_UINT",
"rtvFormat": "DXGI_FORMAT_R16G16B16A16_UINT", "rtvFormat": "DXGI_FORMAT_R16G16B16A16_UINT",
...@@ -346,7 +345,7 @@ ...@@ -346,7 +345,7 @@
"bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 }, "bits": { "red": 16, "green": 16, "blue": 16, "alpha": 16 },
"glInternalFormat": "GL_RGBA16UI" "glInternalFormat": "GL_RGBA16UI"
}, },
"angle::Format::R32G32B32A32_SINT": { "R32G32B32A32_SINT": {
"texFormat": "DXGI_FORMAT_R32G32B32A32_SINT", "texFormat": "DXGI_FORMAT_R32G32B32A32_SINT",
"srvFormat": "DXGI_FORMAT_R32G32B32A32_SINT", "srvFormat": "DXGI_FORMAT_R32G32B32A32_SINT",
"rtvFormat": "DXGI_FORMAT_R32G32B32A32_SINT", "rtvFormat": "DXGI_FORMAT_R32G32B32A32_SINT",
...@@ -355,7 +354,7 @@ ...@@ -355,7 +354,7 @@
"bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 }, "bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
"glInternalFormat": "GL_RGBA32I" "glInternalFormat": "GL_RGBA32I"
}, },
"angle::Format::R32G32B32A32_UINT": { "R32G32B32A32_UINT": {
"texFormat": "DXGI_FORMAT_R32G32B32A32_UINT", "texFormat": "DXGI_FORMAT_R32G32B32A32_UINT",
"srvFormat": "DXGI_FORMAT_R32G32B32A32_UINT", "srvFormat": "DXGI_FORMAT_R32G32B32A32_UINT",
"rtvFormat": "DXGI_FORMAT_R32G32B32A32_UINT", "rtvFormat": "DXGI_FORMAT_R32G32B32A32_UINT",
...@@ -364,29 +363,23 @@ ...@@ -364,29 +363,23 @@
"bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 }, "bits": { "red": 32, "green": 32, "blue": 32, "alpha": 32 },
"glInternalFormat": "GL_RGBA32UI" "glInternalFormat": "GL_RGBA32UI"
}, },
"angle::Format::B5G6R5_UNORM": { "B5G6R5_UNORM": {
"texFormat": "DXGI_FORMAT_B5G6R5_UNORM", "texFormat": "DXGI_FORMAT_B5G6R5_UNORM",
"srvFormat": "DXGI_FORMAT_B5G6R5_UNORM", "srvFormat": "DXGI_FORMAT_B5G6R5_UNORM",
"rtvFormat": "DXGI_FORMAT_B5G6R5_UNORM", "rtvFormat": "DXGI_FORMAT_B5G6R5_UNORM",
"channels": "bgr", "channels": "bgr",
"componentType": "unorm", "componentType": "unorm",
"bits": { "red": 5, "green": 6, "blue": 5 }, "bits": { "red": 5, "green": 6, "blue": 5 }
"glInternalFormat": "GL_BGR565_ANGLEX",
"fboImplementationInternalFormat": "GL_RGB565",
"channelStruct": "B5G6R5"
}, },
"angle::Format::B5G5R5A1_UNORM": { "B5G5R5A1_UNORM": {
"texFormat": "DXGI_FORMAT_B5G5R5A1_UNORM", "texFormat": "DXGI_FORMAT_B5G5R5A1_UNORM",
"srvFormat": "DXGI_FORMAT_B5G5R5A1_UNORM", "srvFormat": "DXGI_FORMAT_B5G5R5A1_UNORM",
"rtvFormat": "DXGI_FORMAT_B5G5R5A1_UNORM", "rtvFormat": "DXGI_FORMAT_B5G5R5A1_UNORM",
"channels": "bgra", "channels": "bgra",
"componentType": "unorm", "componentType": "unorm",
"bits": { "red": 5, "green": 5, "blue": 5, "alpha": 1 }, "bits": { "red": 5, "green": 5, "blue": 5, "alpha": 1 }
"glInternalFormat": "GL_BGR5_A1_ANGLEX",
"fboImplementationInternalFormat": "GL_RGB5_A1",
"channelStruct": "A1R5G5B5"
}, },
"angle::Format::R8G8B8A8_SINT": { "R8G8B8A8_SINT": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_SINT", "texFormat": "DXGI_FORMAT_R8G8B8A8_SINT",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_SINT", "srvFormat": "DXGI_FORMAT_R8G8B8A8_SINT",
"rtvFormat": "DXGI_FORMAT_R8G8B8A8_SINT", "rtvFormat": "DXGI_FORMAT_R8G8B8A8_SINT",
...@@ -395,7 +388,7 @@ ...@@ -395,7 +388,7 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 }, "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8I" "glInternalFormat": "GL_RGBA8I"
}, },
"angle::Format::R8G8B8A8_UINT": { "R8G8B8A8_UINT": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_UINT", "texFormat": "DXGI_FORMAT_R8G8B8A8_UINT",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_UINT", "srvFormat": "DXGI_FORMAT_R8G8B8A8_UINT",
"rtvFormat": "DXGI_FORMAT_R8G8B8A8_UINT", "rtvFormat": "DXGI_FORMAT_R8G8B8A8_UINT",
...@@ -404,7 +397,7 @@ ...@@ -404,7 +397,7 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 }, "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8UI" "glInternalFormat": "GL_RGBA8UI"
}, },
"angle::Format::R8G8B8A8_SNORM": { "R8G8B8A8_SNORM": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_SNORM", "texFormat": "DXGI_FORMAT_R8G8B8A8_SNORM",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_SNORM", "srvFormat": "DXGI_FORMAT_R8G8B8A8_SNORM",
"channels": "rgba", "channels": "rgba",
...@@ -412,27 +405,22 @@ ...@@ -412,27 +405,22 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 }, "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8_SNORM" "glInternalFormat": "GL_RGBA8_SNORM"
}, },
"angle::Format::R9G9B9E5_SHAREDEXP": { "R9G9B9E5_SHAREDEXP": {
"texFormat": "DXGI_FORMAT_R9G9B9E5_SHAREDEXP", "texFormat": "DXGI_FORMAT_R9G9B9E5_SHAREDEXP",
"srvFormat": "DXGI_FORMAT_R9G9B9E5_SHAREDEXP", "srvFormat": "DXGI_FORMAT_R9G9B9E5_SHAREDEXP",
"channels": "rgb", "channels": "rgb",
"componentType": "float", "componentType": "float",
"bits": { "red": 9, "green": 9, "blue": 9, "shared": 5 }, "bits": { "red": 9, "green": 9, "blue": 9, "shared": 5 }
"glInternalFormat": "GL_RGB9_E5",
"channelStruct": "R9G9B9E5"
}, },
"angle::Format::B4G4R4A4_UNORM": { "B4G4R4A4_UNORM": {
"texFormat": "DXGI_FORMAT_B4G4R4A4_UNORM", "texFormat": "DXGI_FORMAT_B4G4R4A4_UNORM",
"srvFormat": "DXGI_FORMAT_B4G4R4A4_UNORM", "srvFormat": "DXGI_FORMAT_B4G4R4A4_UNORM",
"rtvFormat": "DXGI_FORMAT_B4G4R4A4_UNORM", "rtvFormat": "DXGI_FORMAT_B4G4R4A4_UNORM",
"channels": "bgra", "channels": "bgra",
"componentType": "unorm", "componentType": "unorm",
"bits": { "red": 4, "green": 4, "blue": 4, "alpha": 4 }, "bits": { "red": 4, "green": 4, "blue": 4, "alpha": 4 }
"glInternalFormat": "GL_BGRA4_ANGLEX",
"fboImplementationInternalFormat": "GL_RGBA4",
"channelStruct": "A4R4G4B4"
}, },
"angle::Format::R8G8B8A8_UNORM_SRGB": { "R8G8B8A8_UNORM_SRGB": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB", "texFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB", "srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
"rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB", "rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
...@@ -441,7 +429,7 @@ ...@@ -441,7 +429,7 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 }, "bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_SRGB8_ALPHA8" "glInternalFormat": "GL_SRGB8_ALPHA8"
}, },
"angle::Format::R16_UNORM": { "R16_UNORM": {
"texFormat": "DXGI_FORMAT_R16_UNORM", "texFormat": "DXGI_FORMAT_R16_UNORM",
"srvFormat": "DXGI_FORMAT_R16_UNORM", "srvFormat": "DXGI_FORMAT_R16_UNORM",
"rtvFormat": "DXGI_FORMAT_R16_UNORM", "rtvFormat": "DXGI_FORMAT_R16_UNORM",
...@@ -450,7 +438,7 @@ ...@@ -450,7 +438,7 @@
"bits": { "red": 16 }, "bits": { "red": 16 },
"glInternalFormat": "GL_R16_EXT" "glInternalFormat": "GL_R16_EXT"
}, },
"angle::Format::R16G16_UNORM": { "R16G16_UNORM": {
"texFormat": "DXGI_FORMAT_R16G16_UNORM", "texFormat": "DXGI_FORMAT_R16G16_UNORM",
"srvFormat": "DXGI_FORMAT_R16G16_UNORM", "srvFormat": "DXGI_FORMAT_R16G16_UNORM",
"rtvFormat": "DXGI_FORMAT_R16G16_UNORM", "rtvFormat": "DXGI_FORMAT_R16G16_UNORM",
...@@ -459,7 +447,7 @@ ...@@ -459,7 +447,7 @@
"bits": { "red": 16, "green": 16 }, "bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16_EXT" "glInternalFormat": "GL_RG16_EXT"
}, },
"angle::Format::R16_SNORM": { "R16_SNORM": {
"texFormat": "DXGI_FORMAT_R16_SNORM", "texFormat": "DXGI_FORMAT_R16_SNORM",
"srvFormat": "DXGI_FORMAT_R16_SNORM", "srvFormat": "DXGI_FORMAT_R16_SNORM",
"channels": "r", "channels": "r",
...@@ -467,7 +455,7 @@ ...@@ -467,7 +455,7 @@
"bits": { "red": 16 }, "bits": { "red": 16 },
"glInternalFormat": "GL_R16_SNORM_EXT" "glInternalFormat": "GL_R16_SNORM_EXT"
}, },
"angle::Format::R16G16_SNORM": { "R16G16_SNORM": {
"texFormat": "DXGI_FORMAT_R16G16_SNORM", "texFormat": "DXGI_FORMAT_R16G16_SNORM",
"srvFormat": "DXGI_FORMAT_R16G16_SNORM", "srvFormat": "DXGI_FORMAT_R16G16_SNORM",
"channels": "rg", "channels": "rg",
...@@ -475,7 +463,7 @@ ...@@ -475,7 +463,7 @@
"bits": { "red": 16, "green": 16 }, "bits": { "red": 16, "green": 16 },
"glInternalFormat": "GL_RG16_SNORM_EXT" "glInternalFormat": "GL_RG16_SNORM_EXT"
}, },
"angle::Format::R16G16B16A16_SNORM": { "R16G16B16A16_SNORM": {
"texFormat": "DXGI_FORMAT_R16G16B16A16_SNORM", "texFormat": "DXGI_FORMAT_R16G16B16A16_SNORM",
"srvFormat": "DXGI_FORMAT_R16G16B16A16_SNORM", "srvFormat": "DXGI_FORMAT_R16G16B16A16_SNORM",
"channels": "rgba", "channels": "rgba",
......
{ {
"GL_ALPHA": { "GL_ALPHA": {
"OnlyFL10Plus": "angle::Format::A8_UNORM", "OnlyFL10Plus": "A8_UNORM",
"OnlyFL9_3": "angle::Format::R8G8B8A8_UNORM" "OnlyFL9_3": "R8G8B8A8_UNORM"
}, },
"GL_ALPHA16F_EXT": "angle::Format::R16G16B16A16_FLOAT", "GL_ALPHA16F_EXT": "R16G16B16A16_FLOAT",
"GL_ALPHA32F_EXT": "angle::Format::R32G32B32A32_FLOAT", "GL_ALPHA32F_EXT": "R32G32B32A32_FLOAT",
"GL_ALPHA8_EXT": { "GL_ALPHA8_EXT": {
"OnlyFL10Plus": "angle::Format::A8_UNORM", "OnlyFL10Plus": "A8_UNORM",
"OnlyFL9_3": "angle::Format::R8G8B8A8_UNORM" "OnlyFL9_3": "R8G8B8A8_UNORM"
}, },
"GL_BGR565_ANGLEX": "angle::Format::B5G6R5_UNORM", "GL_BGR565_ANGLEX": "B5G6R5_UNORM",
"GL_BGR5_A1_ANGLEX": "angle::Format::B8G8R8A8_UNORM", "GL_BGR5_A1_ANGLEX": "B8G8R8A8_UNORM",
"GL_BGRA4_ANGLEX": "angle::Format::B8G8R8A8_UNORM", "GL_BGRA4_ANGLEX": "B8G8R8A8_UNORM",
"GL_BGRA8_EXT": "angle::Format::B8G8R8A8_UNORM", "GL_BGRA8_EXT": "B8G8R8A8_UNORM",
"GL_BGRA_EXT": "angle::Format::B8G8R8A8_UNORM", "GL_BGRA_EXT": "B8G8R8A8_UNORM",
"GL_COMPRESSED_R11_EAC": { "GL_COMPRESSED_R11_EAC": {
"OnlyFL10Plus": "angle::Format::R8_UNORM" "OnlyFL10Plus": "R8_UNORM"
}, },
"GL_COMPRESSED_RG11_EAC": { "GL_COMPRESSED_RG11_EAC": {
"OnlyFL10Plus": "angle::Format::R8G8_UNORM" "OnlyFL10Plus": "R8G8_UNORM"
}, },
"GL_COMPRESSED_RGB8_ETC2": { "GL_COMPRESSED_RGB8_ETC2": {
"OnlyFL10Plus": "angle::Format::R8G8B8A8_UNORM" "OnlyFL10Plus": "R8G8B8A8_UNORM"
}, },
"GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2": { "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2": {
"OnlyFL10Plus": "angle::Format::R8G8B8A8_UNORM" "OnlyFL10Plus": "R8G8B8A8_UNORM"
}, },
"GL_COMPRESSED_RGBA8_ETC2_EAC": { "GL_COMPRESSED_RGBA8_ETC2_EAC": {
"OnlyFL10Plus": "angle::Format::R8G8B8A8_UNORM" "OnlyFL10Plus": "R8G8B8A8_UNORM"
}, },
"GL_COMPRESSED_RGBA_S3TC_DXT1_EXT": "angle::Format::BC1_UNORM", "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT": "BC1_UNORM",
"GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE": "angle::Format::BC2_UNORM", "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE": "BC2_UNORM",
"GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE": "angle::Format::BC3_UNORM", "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE": "BC3_UNORM",
"GL_COMPRESSED_RGBA_ASTC_4x4_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_4x4_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_5x4_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_5x4_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_5x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_5x5_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_6x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_6x5_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_6x6_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_6x6_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_8x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_8x5_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_8x6_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_8x6_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_8x8_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_8x8_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_10x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_10x5_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_10x6_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_10x6_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_10x8_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_10x8_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_10x10_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_10x10_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_12x10_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_12x10_KHR": "NONE",
"GL_COMPRESSED_RGBA_ASTC_12x12_KHR": "angle::Format::NONE", "GL_COMPRESSED_RGBA_ASTC_12x12_KHR": "NONE",
"GL_COMPRESSED_RGB_S3TC_DXT1_EXT": "angle::Format::BC1_UNORM", "GL_COMPRESSED_RGB_S3TC_DXT1_EXT": "BC1_UNORM",
"GL_COMPRESSED_SIGNED_R11_EAC": { "GL_COMPRESSED_SIGNED_R11_EAC": {
"OnlyFL10Plus": "angle::Format::R8_SNORM" "OnlyFL10Plus": "R8_SNORM"
}, },
"GL_COMPRESSED_SIGNED_RG11_EAC": { "GL_COMPRESSED_SIGNED_RG11_EAC": {
"OnlyFL10Plus": "angle::Format::R8G8_SNORM" "OnlyFL10Plus": "R8G8_SNORM"
}, },
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR": "angle::Format::NONE", "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR": "NONE",
"GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC": { "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC": {
"OnlyFL10Plus": "angle::Format::R8G8B8A8_UNORM_SRGB" "OnlyFL10Plus": "R8G8B8A8_UNORM_SRGB"
}, },
"GL_COMPRESSED_SRGB8_ETC2": { "GL_COMPRESSED_SRGB8_ETC2": {
"OnlyFL10Plus": "angle::Format::R8G8B8A8_UNORM_SRGB" "OnlyFL10Plus": "R8G8B8A8_UNORM_SRGB"
}, },
"GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2": { "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2": {
"OnlyFL10Plus": "angle::Format::R8G8B8A8_UNORM_SRGB" "OnlyFL10Plus": "R8G8B8A8_UNORM_SRGB"
}, },
"GL_DEPTH24_STENCIL8": { "GL_DEPTH24_STENCIL8": {
"OnlyFL10Plus": "angle::Format::D24_UNORM_S8_UINT", "OnlyFL10Plus": "D24_UNORM_S8_UINT",
"OnlyFL9_3": "angle::Format::D24_UNORM_S8_UINT" "OnlyFL9_3": "D24_UNORM_S8_UINT"
}, },
"GL_DEPTH32F_STENCIL8": { "GL_DEPTH32F_STENCIL8": {
"OnlyFL10Plus": "angle::Format::D32_FLOAT_S8X24_UINT" "OnlyFL10Plus": "D32_FLOAT_S8X24_UINT"
}, },
"GL_DEPTH_COMPONENT16": { "GL_DEPTH_COMPONENT16": {
"OnlyFL10Plus": "angle::Format::D16_UNORM", "OnlyFL10Plus": "D16_UNORM",
"OnlyFL9_3": "angle::Format::D16_UNORM" "OnlyFL9_3": "D16_UNORM"
}, },
"GL_DEPTH_COMPONENT24": { "GL_DEPTH_COMPONENT24": {
"OnlyFL10Plus": "angle::Format::D24_UNORM_S8_UINT", "OnlyFL10Plus": "D24_UNORM_S8_UINT",
"OnlyFL9_3": "angle::Format::D24_UNORM_S8_UINT" "OnlyFL9_3": "D24_UNORM_S8_UINT"
}, },
"GL_DEPTH_COMPONENT32F": { "GL_DEPTH_COMPONENT32F": {
"OnlyFL10Plus": "angle::Format::D32_FLOAT" "OnlyFL10Plus": "D32_FLOAT"
}, },
"GL_DEPTH_COMPONENT32_OES": { "GL_DEPTH_COMPONENT32_OES": {
"OnlyFL10Plus": "angle::Format::D24_UNORM_S8_UINT" "OnlyFL10Plus": "D24_UNORM_S8_UINT"
}, },
"GL_ETC1_RGB8_OES": "angle::Format::R8G8B8A8_UNORM", "GL_ETC1_RGB8_OES": "R8G8B8A8_UNORM",
"GL_ETC1_RGB8_LOSSY_DECODE_ANGLE": "angle::Format::BC1_UNORM", "GL_ETC1_RGB8_LOSSY_DECODE_ANGLE": "BC1_UNORM",
"GL_LUMINANCE": "angle::Format::R8G8B8A8_UNORM", "GL_LUMINANCE": "R8G8B8A8_UNORM",
"GL_LUMINANCE16F_EXT": "angle::Format::R16G16B16A16_FLOAT", "GL_LUMINANCE16F_EXT": "R16G16B16A16_FLOAT",
"GL_LUMINANCE32F_EXT": "angle::Format::R32G32B32A32_FLOAT", "GL_LUMINANCE32F_EXT": "R32G32B32A32_FLOAT",
"GL_LUMINANCE8_ALPHA8_EXT": "angle::Format::R8G8B8A8_UNORM", "GL_LUMINANCE8_ALPHA8_EXT": "R8G8B8A8_UNORM",
"GL_LUMINANCE8_EXT": "angle::Format::R8G8B8A8_UNORM", "GL_LUMINANCE8_EXT": "R8G8B8A8_UNORM",
"GL_LUMINANCE_ALPHA": "angle::Format::R8G8B8A8_UNORM", "GL_LUMINANCE_ALPHA": "R8G8B8A8_UNORM",
"GL_LUMINANCE_ALPHA16F_EXT": "angle::Format::R16G16B16A16_FLOAT", "GL_LUMINANCE_ALPHA16F_EXT": "R16G16B16A16_FLOAT",
"GL_LUMINANCE_ALPHA32F_EXT": "angle::Format::R32G32B32A32_FLOAT", "GL_LUMINANCE_ALPHA32F_EXT": "R32G32B32A32_FLOAT",
"GL_NONE": "angle::Format::NONE", "GL_NONE": "NONE",
"GL_R11F_G11F_B10F": "angle::Format::R11G11B10_FLOAT", "GL_R11F_G11F_B10F": "R11G11B10_FLOAT",
"GL_R16F": "angle::Format::R16_FLOAT", "GL_R16F": "R16_FLOAT",
"GL_R16I": "angle::Format::R16_SINT", "GL_R16I": "R16_SINT",
"GL_R16UI": "angle::Format::R16_UINT", "GL_R16UI": "R16_UINT",
"GL_R32F": "angle::Format::R32_FLOAT", "GL_R32F": "R32_FLOAT",
"GL_R32I": "angle::Format::R32_SINT", "GL_R32I": "R32_SINT",
"GL_R32UI": "angle::Format::R32_UINT", "GL_R32UI": "R32_UINT",
"GL_R8": "angle::Format::R8_UNORM", "GL_R8": "R8_UNORM",
"GL_R8I": "angle::Format::R8_SINT", "GL_R8I": "R8_SINT",
"GL_R8UI": "angle::Format::R8_UINT", "GL_R8UI": "R8_UINT",
"GL_R8_SNORM": "angle::Format::R8_SNORM", "GL_R8_SNORM": "R8_SNORM",
"GL_RG16F": "angle::Format::R16G16_FLOAT", "GL_RG16F": "R16G16_FLOAT",
"GL_RG16I": "angle::Format::R16G16_SINT", "GL_RG16I": "R16G16_SINT",
"GL_RG16UI": "angle::Format::R16G16_UINT", "GL_RG16UI": "R16G16_UINT",
"GL_RG32F": "angle::Format::R32G32_FLOAT", "GL_RG32F": "R32G32_FLOAT",
"GL_RG32I": "angle::Format::R32G32_SINT", "GL_RG32I": "R32G32_SINT",
"GL_RG32UI": "angle::Format::R32G32_UINT", "GL_RG32UI": "R32G32_UINT",
"GL_RG8": "angle::Format::R8G8_UNORM", "GL_RG8": "R8G8_UNORM",
"GL_RG8I": "angle::Format::R8G8_SINT", "GL_RG8I": "R8G8_SINT",
"GL_RG8UI": "angle::Format::R8G8_UINT", "GL_RG8UI": "R8G8_UINT",
"GL_RG8_SNORM": "angle::Format::R8G8_SNORM", "GL_RG8_SNORM": "R8G8_SNORM",
"GL_RGB": "angle::Format::R8G8B8A8_UNORM", "GL_RGB": "R8G8B8A8_UNORM",
"GL_RGB10_A2": "angle::Format::R10G10B10A2_UNORM", "GL_RGB10_A2": "R10G10B10A2_UNORM",
"GL_RGB10_A2UI": "angle::Format::R10G10B10A2_UINT", "GL_RGB10_A2UI": "R10G10B10A2_UINT",
"GL_RGB16F": "angle::Format::R16G16B16A16_FLOAT", "GL_RGB16F": "R16G16B16A16_FLOAT",
"GL_RGB16I": "angle::Format::R16G16B16A16_SINT", "GL_RGB16I": "R16G16B16A16_SINT",
"GL_RGB16UI": "angle::Format::R16G16B16A16_UINT", "GL_RGB16UI": "R16G16B16A16_UINT",
"GL_RGB32F": "angle::Format::R32G32B32A32_FLOAT", "GL_RGB32F": "R32G32B32A32_FLOAT",
"GL_RGB32I": "angle::Format::R32G32B32A32_SINT", "GL_RGB32I": "R32G32B32A32_SINT",
"GL_RGB32UI": "angle::Format::R32G32B32A32_UINT", "GL_RGB32UI": "R32G32B32A32_UINT",
"GL_RGB565": { "GL_RGB565": {
"SupportsFormat<DXGI_FORMAT_B5G6R5_UNORM,false>": "angle::Format::R8G8B8A8_UNORM", "SupportsFormat<DXGI_FORMAT_B5G6R5_UNORM,false>": "R8G8B8A8_UNORM",
"SupportsFormat<DXGI_FORMAT_B5G6R5_UNORM,true>": "angle::Format::B5G6R5_UNORM" "SupportsFormat<DXGI_FORMAT_B5G6R5_UNORM,true>": "B5G6R5_UNORM"
}, },
"GL_RGB5_A1": { "GL_RGB5_A1": {
"SupportsFormat<DXGI_FORMAT_B5G5R5A1_UNORM,false>": "angle::Format::R8G8B8A8_UNORM", "SupportsFormat<DXGI_FORMAT_B5G5R5A1_UNORM,false>": "R8G8B8A8_UNORM",
"SupportsFormat<DXGI_FORMAT_B5G5R5A1_UNORM,true>": "angle::Format::B5G5R5A1_UNORM" "SupportsFormat<DXGI_FORMAT_B5G5R5A1_UNORM,true>": "B5G5R5A1_UNORM"
}, },
"GL_RGB8": "angle::Format::R8G8B8A8_UNORM", "GL_RGB8": "R8G8B8A8_UNORM",
"GL_RGB8I": "angle::Format::R8G8B8A8_SINT", "GL_RGB8I": "R8G8B8A8_SINT",
"GL_RGB8UI": "angle::Format::R8G8B8A8_UINT", "GL_RGB8UI": "R8G8B8A8_UINT",
"GL_RGB8_SNORM": "angle::Format::R8G8B8A8_SNORM", "GL_RGB8_SNORM": "R8G8B8A8_SNORM",
"GL_RGB9_E5": "angle::Format::R9G9B9E5_SHAREDEXP", "GL_RGB9_E5": "R9G9B9E5_SHAREDEXP",
"GL_RGBA": "angle::Format::R8G8B8A8_UNORM", "GL_RGBA": "R8G8B8A8_UNORM",
"GL_RGBA16F": "angle::Format::R16G16B16A16_FLOAT", "GL_RGBA16F": "R16G16B16A16_FLOAT",
"GL_RGBA16I": "angle::Format::R16G16B16A16_SINT", "GL_RGBA16I": "R16G16B16A16_SINT",
"GL_RGBA16UI": "angle::Format::R16G16B16A16_UINT", "GL_RGBA16UI": "R16G16B16A16_UINT",
"GL_RGBA32F": "angle::Format::R32G32B32A32_FLOAT", "GL_RGBA32F": "R32G32B32A32_FLOAT",
"GL_RGBA32I": "angle::Format::R32G32B32A32_SINT", "GL_RGBA32I": "R32G32B32A32_SINT",
"GL_RGBA32UI": "angle::Format::R32G32B32A32_UINT", "GL_RGBA32UI": "R32G32B32A32_UINT",
"GL_RGBA4": { "GL_RGBA4": {
"SupportsFormat<DXGI_FORMAT_B4G4R4A4_UNORM,false>": "angle::Format::R8G8B8A8_UNORM", "SupportsFormat<DXGI_FORMAT_B4G4R4A4_UNORM,false>": "R8G8B8A8_UNORM",
"SupportsFormat<DXGI_FORMAT_B4G4R4A4_UNORM,true>": "angle::Format::B4G4R4A4_UNORM" "SupportsFormat<DXGI_FORMAT_B4G4R4A4_UNORM,true>": "B4G4R4A4_UNORM"
}, },
"GL_RGBA8": "angle::Format::R8G8B8A8_UNORM", "GL_RGBA8": "R8G8B8A8_UNORM",
"GL_RGBA8I": "angle::Format::R8G8B8A8_SINT", "GL_RGBA8I": "R8G8B8A8_SINT",
"GL_RGBA8UI": "angle::Format::R8G8B8A8_UINT", "GL_RGBA8UI": "R8G8B8A8_UINT",
"GL_RGBA8_SNORM": "angle::Format::R8G8B8A8_SNORM", "GL_RGBA8_SNORM": "R8G8B8A8_SNORM",
"GL_SRGB8": "angle::Format::R8G8B8A8_UNORM_SRGB", "GL_SRGB8": "R8G8B8A8_UNORM_SRGB",
"GL_SRGB8_ALPHA8": "angle::Format::R8G8B8A8_UNORM_SRGB", "GL_SRGB8_ALPHA8": "R8G8B8A8_UNORM_SRGB",
"GL_STENCIL_INDEX8": { "GL_STENCIL_INDEX8": {
"OnlyFL10Plus": "angle::Format::D24_UNORM_S8_UINT", "OnlyFL10Plus": "D24_UNORM_S8_UINT",
"OnlyFL9_3": "angle::Format::D24_UNORM_S8_UINT" "OnlyFL9_3": "D24_UNORM_S8_UINT"
}, },
"GL_R16_EXT": "angle::Format::R16_UNORM", "GL_R16_EXT": "R16_UNORM",
"GL_RG16_EXT": "angle::Format::R16G16_UNORM", "GL_RG16_EXT": "R16G16_UNORM",
"GL_RGB16_EXT": "angle::Format::R16G16B16A16_UNORM", "GL_RGB16_EXT": "R16G16B16A16_UNORM",
"GL_RGBA16_EXT": "angle::Format::R16G16B16A16_UNORM", "GL_RGBA16_EXT": "R16G16B16A16_UNORM",
"GL_R16_SNORM_EXT": "angle::Format::R16_SNORM", "GL_R16_SNORM_EXT": "R16_SNORM",
"GL_RG16_SNORM_EXT": "angle::Format::R16G16_SNORM", "GL_RG16_SNORM_EXT": "R16G16_SNORM",
"GL_RGB16_SNORM_EXT": "angle::Format::R16G16B16A16_SNORM", "GL_RGB16_SNORM_EXT": "R16G16B16A16_SNORM",
"GL_RGBA16_SNORM_EXT": "angle::Format::R16G16B16A16_SNORM" "GL_RGBA16_SNORM_EXT": "R16G16B16A16_SNORM"
} }
...@@ -16,42 +16,30 @@ namespace d3d11 ...@@ -16,42 +16,30 @@ namespace d3d11
{ {
ANGLEFormatSet::ANGLEFormatSet() ANGLEFormatSet::ANGLEFormatSet()
: format(angle::Format::NONE), : format(angle::Format::Get(angle::Format::ID::NONE)),
glInternalFormat(GL_NONE),
fboImplementationInternalFormat(GL_NONE),
texFormat(DXGI_FORMAT_UNKNOWN), texFormat(DXGI_FORMAT_UNKNOWN),
srvFormat(DXGI_FORMAT_UNKNOWN), srvFormat(DXGI_FORMAT_UNKNOWN),
rtvFormat(DXGI_FORMAT_UNKNOWN), rtvFormat(DXGI_FORMAT_UNKNOWN),
dsvFormat(DXGI_FORMAT_UNKNOWN), dsvFormat(DXGI_FORMAT_UNKNOWN),
blitSRVFormat(DXGI_FORMAT_UNKNOWN), blitSRVFormat(DXGI_FORMAT_UNKNOWN),
swizzleFormat(angle::Format::NONE), swizzleFormat(angle::Format::ID::NONE)
mipGenerationFunction(nullptr),
colorReadFunction(nullptr)
{ {
} }
ANGLEFormatSet::ANGLEFormatSet(angle::Format format, ANGLEFormatSet::ANGLEFormatSet(angle::Format::ID formatID,
GLenum glInternalFormat,
GLenum fboImplementationInternalFormat,
DXGI_FORMAT texFormat, DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat, DXGI_FORMAT srvFormat,
DXGI_FORMAT rtvFormat, DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat, DXGI_FORMAT dsvFormat,
DXGI_FORMAT blitSRVFormat, DXGI_FORMAT blitSRVFormat,
angle::Format swizzleFormat, angle::Format::ID swizzleFormat)
MipGenerationFunction mipGenerationFunction, : format(angle::Format::Get(formatID)),
ColorReadFunction colorReadFunction)
: format(format),
glInternalFormat(glInternalFormat),
fboImplementationInternalFormat(fboImplementationInternalFormat),
texFormat(texFormat), texFormat(texFormat),
srvFormat(srvFormat), srvFormat(srvFormat),
rtvFormat(rtvFormat), rtvFormat(rtvFormat),
dsvFormat(dsvFormat), dsvFormat(dsvFormat),
blitSRVFormat(blitSRVFormat), blitSRVFormat(blitSRVFormat),
swizzleFormat(swizzleFormat), swizzleFormat(swizzleFormat)
mipGenerationFunction(mipGenerationFunction),
colorReadFunction(colorReadFunction)
{ {
} }
...@@ -60,16 +48,16 @@ ANGLEFormatSet::ANGLEFormatSet(angle::Format format, ...@@ -60,16 +48,16 @@ ANGLEFormatSet::ANGLEFormatSet(angle::Format format,
// This function allows querying for the DXGI texture formats to use for textures, SRVs, RTVs and // This function allows querying for the DXGI texture formats to use for textures, SRVs, RTVs and
// DSVs given a GL internal format. // DSVs given a GL internal format.
TextureFormat::TextureFormat(GLenum internalFormat, TextureFormat::TextureFormat(GLenum internalFormat,
const angle::Format angleFormat, const angle::Format::ID angleFormatID,
InitializeTextureDataFunction internalFormatInitializer, InitializeTextureDataFunction internalFormatInitializer,
const Renderer11DeviceCaps &deviceCaps) const Renderer11DeviceCaps &deviceCaps)
: internalFormat(internalFormat), : internalFormat(internalFormat),
formatSet(GetANGLEFormatSet(angleFormat, deviceCaps)), formatSet(GetANGLEFormatSet(angleFormatID, deviceCaps)),
swizzleFormatSet(GetANGLEFormatSet(formatSet.swizzleFormat, deviceCaps)), swizzleFormatSet(GetANGLEFormatSet(formatSet.swizzleFormat, deviceCaps)),
dataInitializerFunction(internalFormatInitializer), dataInitializerFunction(internalFormatInitializer),
loadFunctions(GetLoadFunctionsMap(internalFormat, formatSet.texFormat)) loadFunctions(GetLoadFunctionsMap(internalFormat, formatSet.texFormat))
{ {
ASSERT(!loadFunctions.empty() || angleFormat == angle::Format::NONE); ASSERT(!loadFunctions.empty() || angleFormatID == angle::Format::ID::NONE);
} }
} // namespace d3d11 } // namespace d3d11
......
...@@ -41,28 +41,15 @@ struct LoadImageFunctionInfo ...@@ -41,28 +41,15 @@ struct LoadImageFunctionInfo
struct ANGLEFormatSet final : angle::NonCopyable struct ANGLEFormatSet final : angle::NonCopyable
{ {
ANGLEFormatSet(); ANGLEFormatSet();
ANGLEFormatSet(angle::Format format, ANGLEFormatSet(angle::Format::ID formatID,
GLenum glInternalFormat,
GLenum fboImplementationInternalFormat,
DXGI_FORMAT texFormat, DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat, DXGI_FORMAT srvFormat,
DXGI_FORMAT rtvFormat, DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat, DXGI_FORMAT dsvFormat,
DXGI_FORMAT blitSRVFormat, DXGI_FORMAT blitSRVFormat,
angle::Format swizzleFormat, angle::Format::ID swizzleFormat);
MipGenerationFunction mipGenerationFunction,
ColorReadFunction colorReadFunction);
angle::Format format; const angle::Format &format;
// The closest matching GL internal format for the DXGI formats this format uses. Note that this
// may be a different internal format than the one this ANGLE format is used for.
GLenum glInternalFormat;
// The format we should report to the GL layer when querying implementation formats from a FBO.
// This might not be the same as the glInternalFormat, since some DXGI formats don't have
// matching GL format enums, like BGRA4, BGR5A1 and B5G6R6.
GLenum fboImplementationInternalFormat;
DXGI_FORMAT texFormat; DXGI_FORMAT texFormat;
DXGI_FORMAT srvFormat; DXGI_FORMAT srvFormat;
...@@ -71,16 +58,13 @@ struct ANGLEFormatSet final : angle::NonCopyable ...@@ -71,16 +58,13 @@ struct ANGLEFormatSet final : angle::NonCopyable
DXGI_FORMAT blitSRVFormat; DXGI_FORMAT blitSRVFormat;
angle::Format swizzleFormat; angle::Format::ID swizzleFormat;
MipGenerationFunction mipGenerationFunction;
ColorReadFunction colorReadFunction;
}; };
struct TextureFormat : public angle::NonCopyable struct TextureFormat : public angle::NonCopyable
{ {
TextureFormat(GLenum internalFormat, TextureFormat(GLenum internalFormat,
const angle::Format angleFormat, const angle::Format::ID angleFormatID,
InitializeTextureDataFunction internalFormatInitializer, InitializeTextureDataFunction internalFormatInitializer,
const Renderer11DeviceCaps &deviceCaps); const Renderer11DeviceCaps &deviceCaps);
...@@ -94,7 +78,7 @@ struct TextureFormat : public angle::NonCopyable ...@@ -94,7 +78,7 @@ struct TextureFormat : public angle::NonCopyable
LoadFunctionMap loadFunctions; LoadFunctionMap loadFunctions;
}; };
const ANGLEFormatSet &GetANGLEFormatSet(angle::Format angleFormat, const ANGLEFormatSet &GetANGLEFormatSet(angle::Format::ID angleFormat,
const Renderer11DeviceCaps &deviceCaps); const Renderer11DeviceCaps &deviceCaps);
const TextureFormat &GetTextureFormatInfo(GLenum internalformat, const TextureFormat &GetTextureFormatInfo(GLenum internalformat,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -24,10 +24,6 @@ struct FormatType; ...@@ -24,10 +24,6 @@ struct FormatType;
namespace rx namespace rx
{ {
typedef void (*MipGenerationFunction)(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
uint8_t *destData, size_t destRowPitch, size_t destDepthPitch);
typedef void (*LoadImageFunction)(size_t width, size_t height, size_t depth, typedef void (*LoadImageFunction)(size_t width, size_t height, size_t depth,
const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch, const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch); uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
......
#!/usr/bin/python
# Copyright 2016 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.
#
# gen_angle_format_table.py:
# Code generation for ANGLE format map.
#
from datetime import date
import json
import math
import pprint
import re
import sys
template_autogen_h = """// GENERATED FILE - DO NOT EDIT.
// Generated by gen_angle_format_table.py using data from angle_format_data.json
//
// Copyright {copyright_year} 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.
//
// ANGLE format enumeration.
namespace angle
{{
enum class Format::ID
{{
{angle_format_enum}
}};
}} // namespace angle
"""
template_autogen_cpp = """// GENERATED FILE - DO NOT EDIT.
// Generated by gen_angle_format_table.py using data from angle_format_data.json
//
// Copyright {copyright_year} 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.
//
// ANGLE Format table:
// Queries for typed format information from the ANGLE format enum.
#include "libANGLE/renderer/Format.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
namespace angle
{{
// static
const Format &Format::Get(ID id)
{{
// clang-format off
switch (id)
{{
{angle_format_info_cases}
default:
UNREACHABLE();
break;
}}
// clang-format on
static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr);
return noneInfo;
}}
}} // namespace angle
"""
def get_channel_struct(angle_format):
if 'bits' not in angle_format:
return None
bits = angle_format['bits']
if 'depth' in bits or 'stencil' in bits:
return None
if 'channelStruct' in angle_format:
return angle_format['channelStruct']
struct_name = ''
for channel in angle_format['channels']:
if channel == 'r':
struct_name += 'R{}'.format(bits['red'])
if channel == 'g':
struct_name += 'G{}'.format(bits['green'])
if channel == 'b':
struct_name += 'B{}'.format(bits['blue'])
if channel == 'a':
struct_name += 'A{}'.format(bits['alpha'])
if angle_format['componentType'] == 'float':
struct_name += 'F'
if angle_format['componentType'] == 'int' or angle_format['componentType'] == 'snorm':
struct_name += 'S'
return struct_name
def get_mip_generation_function(angle_format):
channel_struct = get_channel_struct(angle_format)
if channel_struct == None:
return 'nullptr'
return 'GenerateMip<' + channel_struct + '>'
def get_color_read_function(angle_format):
channel_struct = get_channel_struct(angle_format)
if channel_struct == None:
return 'nullptr'
component_type_map = {
'uint': 'GLuint',
'int': 'GLint',
'unorm': 'GLfloat',
'snorm': 'GLfloat',
'float': 'GLfloat'
}
return 'ReadColor<' + channel_struct + ', '+ component_type_map[angle_format['componentType']] + '>'
format_entry_template = """{space}{{
{space} static const Format info(ID::{id},
{space} {glInternalFormat},
{space} {fboImplementationInternalFormat},
{space} {mipGenerationFunction},
{space} {colorReadFunction});
{space} return info;
{space}}}
"""
def json_to_table_data(format_id, json):
table_data = ""
parsed = {
"space": " ",
"id": format_id,
"glInternalFormat": "GL_NONE",
}
for k, v in json.iteritems():
parsed[k] = v
if (format_id != "NONE") and (parsed["glInternalFormat"] == "GL_NONE"):
print("Missing 'glInternalFormat' from " + format_id)
sys.exit(1)
if "fboImplementationInternalFormat" not in parsed:
parsed["fboImplementationInternalFormat"] = parsed["glInternalFormat"]
# Derived values.
parsed["mipGenerationFunction"] = get_mip_generation_function(parsed)
parsed["colorReadFunction"] = get_color_read_function(parsed)
return format_entry_template.format(**parsed)
def parse_json_into_angle_format_switch_string(json_data):
table_data = ''
for format_id, angle_format in sorted(json_data.iteritems()):
table_data += ' case ID::' + format_id + ':\n'
table_data += json_to_table_data(format_id, angle_format)
return table_data
def parse_json_into_angle_format_enum_string(json_data):
enum_data = ' NONE'
for format_id, _ in sorted(json_data.iteritems()):
if format_id == 'NONE':
continue
enum_data += ',\n ' + format_id
return enum_data
def reject_duplicate_keys(pairs):
found_keys = {}
for key, value in pairs:
if key in found_keys:
raise ValueError("duplicate key: %r" % (key,))
else:
found_keys[key] = value
return found_keys
with open('angle_format_data.json') as format_json_file:
format_data = format_json_file.read()
format_json_file.close()
json_data = json.loads(format_data, object_pairs_hook=reject_duplicate_keys)
angle_format_cases = parse_json_into_angle_format_switch_string(json_data)
output_cpp = template_autogen_cpp.format(
copyright_year=date.today().year,
angle_format_info_cases=angle_format_cases)
with open('Format_autogen.cpp', 'wt') as out_file:
out_file.write(output_cpp)
out_file.close()
enum_data = parse_json_into_angle_format_enum_string(json_data)
output_h = template_autogen_h.format(
copyright_year=date.today().year,
angle_format_enum=enum_data)
with open('Format_ID_autogen.inl', 'wt') as out_file:
out_file.write(output_h)
out_file.close()
...@@ -25,6 +25,16 @@ struct InternalFormat; ...@@ -25,6 +25,16 @@ struct InternalFormat;
namespace rx namespace rx
{ {
using MipGenerationFunction = void (*)(size_t sourceWidth,
size_t sourceHeight,
size_t sourceDepth,
const uint8_t *sourceData,
size_t sourceRowPitch,
size_t sourceDepthPitch,
uint8_t *destData,
size_t destRowPitch,
size_t destDepthPitch);
typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest); typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest);
typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest); typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest);
typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest); typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest);
......
...@@ -169,6 +169,8 @@ ...@@ -169,6 +169,8 @@
'libANGLE/renderer/EGLImplFactory.h', 'libANGLE/renderer/EGLImplFactory.h',
'libANGLE/renderer/FenceNVImpl.h', 'libANGLE/renderer/FenceNVImpl.h',
'libANGLE/renderer/FenceSyncImpl.h', 'libANGLE/renderer/FenceSyncImpl.h',
'libANGLE/renderer/Format_ID_autogen.inl',
'libANGLE/renderer/Format_autogen.cpp',
'libANGLE/renderer/Format.h', 'libANGLE/renderer/Format.h',
'libANGLE/renderer/FramebufferAttachmentObjectImpl.h', 'libANGLE/renderer/FramebufferAttachmentObjectImpl.h',
'libANGLE/renderer/FramebufferImpl.h', 'libANGLE/renderer/FramebufferImpl.h',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment