mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
GN: Componentize D3D format tables.
These tables are used by both the GL and D3D11 back-ends. Also moves them to renderer_utils to be in a shared place. Bug: angleproject:3943 Change-Id: I1f5d79842396a87e795547fa03c6855d6f9c5e9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2405805 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
23
BUILD.gn
23
BUILD.gn
@@ -619,6 +619,27 @@ if (angle_enable_vulkan || angle_enable_metal) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
angle_source_set("angle_d3d_format_tables") {
|
||||
sources = [
|
||||
"src/libANGLE/renderer/dxgi_format_map.h",
|
||||
"src/libANGLE/renderer/dxgi_format_map_autogen.cpp",
|
||||
"src/libANGLE/renderer/dxgi_support_table.h",
|
||||
"src/libANGLE/renderer/dxgi_support_table_autogen.cpp",
|
||||
]
|
||||
|
||||
if (!angle_is_winuwp) {
|
||||
sources += [
|
||||
"src/libANGLE/renderer/d3d_format.cpp",
|
||||
"src/libANGLE/renderer/d3d_format.h",
|
||||
]
|
||||
}
|
||||
|
||||
public_deps = [ ":libANGLE_headers" ]
|
||||
configs += [ ":angle_backend_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
angle_source_set("libANGLE_base") {
|
||||
sources = libangle_sources
|
||||
|
||||
@@ -700,7 +721,7 @@ angle_source_set("libANGLE_base") {
|
||||
}
|
||||
|
||||
if (is_win && (angle_enable_gl || angle_enable_d3d11)) {
|
||||
sources += libangle_gl_wgl_d3d11_common_sources
|
||||
public_deps += [ ":angle_d3d_format_tables" ]
|
||||
}
|
||||
|
||||
if (angle_enable_gl) {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"32ba71942c0fd00e6807104f1bb80a3c",
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
"aa4a0d3463b76858a75787b9cdec8e98",
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json":
|
||||
"src/libANGLE/renderer/dxgi_format_data.json":
|
||||
"3428e4761ccd05f960adffd6ccbd86c5",
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp":
|
||||
"src/libANGLE/renderer/dxgi_format_map_autogen.cpp":
|
||||
"974308ca798476dfaa076fb864478310",
|
||||
"src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py":
|
||||
"411e6064b916d570fa76949820d34a45"
|
||||
"src/libANGLE/renderer/gen_dxgi_format_table.py":
|
||||
"40ec74c693a846d2a180ff801a3845b9"
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json":
|
||||
"src/libANGLE/renderer/dxgi_support_data.json":
|
||||
"861037ff2340dd52e713c7b7283609bd",
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp":
|
||||
"3f32eabe4360e35d076265a6a14d9aa5",
|
||||
"src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py":
|
||||
"b464f153f15d60df1c6536adbfafb072"
|
||||
"src/libANGLE/renderer/dxgi_support_table_autogen.cpp":
|
||||
"220fadac8434f87259bc47c1473a309d",
|
||||
"src/libANGLE/renderer/gen_dxgi_support_tables.py":
|
||||
"c6a42175680fc5ac6fd62ba3c5e8a2f9"
|
||||
}
|
||||
@@ -82,9 +82,9 @@ generators = {
|
||||
'D3D11 format':
|
||||
'src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py',
|
||||
'DXGI format':
|
||||
'src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py',
|
||||
'src/libANGLE/renderer/gen_dxgi_format_table.py',
|
||||
'DXGI format support':
|
||||
'src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py',
|
||||
'src/libANGLE/renderer/gen_dxgi_support_tables.py',
|
||||
'Emulated HLSL functions':
|
||||
'src/compiler/translator/gen_emulated_builtin_function_tables.py',
|
||||
'GL copy conversion table':
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
#include "libANGLE/renderer/d3d/d3d11/Trim11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/VertexArray11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/VertexBuffer11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
|
||||
#include "libANGLE/renderer/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/renderer_utils.h"
|
||||
#include "libANGLE/trace.h"
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/copyvertex.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
|
||||
#include "libANGLE/renderer/dxgi_support_table.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/copyvertex.h"
|
||||
#include "libANGLE/renderer/d3d/formatutilsD3D.h"
|
||||
#include "libANGLE/renderer/dxgi_format_map.h"
|
||||
#include "libANGLE/renderer/renderer_utils.h"
|
||||
|
||||
namespace rx
|
||||
@@ -56,17 +57,8 @@ struct VertexFormat : private angle::NonCopyable
|
||||
|
||||
const VertexFormat &GetVertexFormatInfo(angle::FormatID vertexFormatID,
|
||||
D3D_FEATURE_LEVEL featureLevel);
|
||||
|
||||
// Auto-generated in dxgi_format_map_autogen.cpp.
|
||||
GLenum GetComponentType(DXGI_FORMAT dxgiFormat);
|
||||
|
||||
} // namespace d3d11
|
||||
|
||||
namespace d3d11_angle
|
||||
{
|
||||
const angle::Format &GetFormat(DXGI_FORMAT dxgiFormat);
|
||||
}
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include "libANGLE/renderer/d3d/d3d11/Context11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
|
||||
#include "libANGLE/renderer/driver_utils.h"
|
||||
#include "libANGLE/renderer/dxgi_support_table.h"
|
||||
#include "platform/FeaturesD3D.h"
|
||||
#include "platform/PlatformMethods.h"
|
||||
|
||||
|
||||
@@ -31,190 +31,6 @@ constexpr D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N', 'U', 'L', 'L')));
|
||||
// A map to determine the pixel size and mip generation function of a given D3D format
|
||||
typedef std::map<D3DFORMAT, D3DFormat> D3D9FormatInfoMap;
|
||||
|
||||
D3DFormat::D3DFormat()
|
||||
: pixelBytes(0),
|
||||
blockWidth(0),
|
||||
blockHeight(0),
|
||||
redBits(0),
|
||||
greenBits(0),
|
||||
blueBits(0),
|
||||
alphaBits(0),
|
||||
luminanceBits(0),
|
||||
depthBits(0),
|
||||
stencilBits(0),
|
||||
formatID(angle::FormatID::NONE)
|
||||
{}
|
||||
|
||||
D3DFormat::D3DFormat(GLuint bits,
|
||||
GLuint blockWidth,
|
||||
GLuint blockHeight,
|
||||
GLuint redBits,
|
||||
GLuint greenBits,
|
||||
GLuint blueBits,
|
||||
GLuint alphaBits,
|
||||
GLuint lumBits,
|
||||
GLuint depthBits,
|
||||
GLuint stencilBits,
|
||||
FormatID formatID)
|
||||
: pixelBytes(bits / 8),
|
||||
blockWidth(blockWidth),
|
||||
blockHeight(blockHeight),
|
||||
redBits(redBits),
|
||||
greenBits(greenBits),
|
||||
blueBits(blueBits),
|
||||
alphaBits(alphaBits),
|
||||
luminanceBits(lumBits),
|
||||
depthBits(depthBits),
|
||||
stencilBits(stencilBits),
|
||||
formatID(formatID)
|
||||
{}
|
||||
|
||||
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format)
|
||||
{
|
||||
if (format == D3DFMT_NULL)
|
||||
{
|
||||
static const D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FormatID::NONE);
|
||||
return info;
|
||||
}
|
||||
|
||||
if (format == D3DFMT_INTZ)
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8, FormatID::D24_UNORM_S8_UINT);
|
||||
return info;
|
||||
}
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case D3DFMT_UNKNOWN:
|
||||
{
|
||||
static const D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FormatID::NONE);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_L8:
|
||||
{
|
||||
static const D3DFormat info(8, 1, 1, 0, 0, 0, 0, 8, 0, 0, FormatID::L8_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A8:
|
||||
{
|
||||
static const D3DFormat info(8, 1, 1, 0, 0, 0, 8, 0, 0, 0, FormatID::A8_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A8L8:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 0, 0, 0, 8, 8, 0, 0, FormatID::L8A8_UNORM);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_A4R4G4B4:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 4, 4, 4, 4, 0, 0, 0, FormatID::B4G4R4A4_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A1R5G5B5:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 5, 5, 5, 1, 0, 0, 0, FormatID::B5G5R5A1_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_R5G6B5:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 5, 6, 5, 0, 0, 0, 0, FormatID::R5G6B5_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_X8R8G8B8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 8, 8, 8, 0, 0, 0, 0, FormatID::B8G8R8X8_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 8, 8, 8, 8, 0, 0, 0, FormatID::B8G8R8A8_UNORM);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_R16F:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 16, 0, 0, 0, 0, 0, 0, FormatID::R16_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_G16R16F:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 16, 16, 0, 0, 0, 0, 0, FormatID::R16G16_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
{
|
||||
static const D3DFormat info(64, 1, 1, 16, 16, 16, 16, 0, 0, 0,
|
||||
FormatID::R16G16B16A16_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_R32F:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 32, 0, 0, 0, 0, 0, 0, FormatID::R32_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_G32R32F:
|
||||
{
|
||||
static const D3DFormat info(64, 1, 1, 32, 32, 0, 0, 0, 0, 0, FormatID::R32G32_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
{
|
||||
static const D3DFormat info(128, 1, 1, 32, 32, 32, 32, 0, 0, 0,
|
||||
FormatID::R32G32B32A32_FLOAT);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_D16:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 0, 0, 0, 0, 0, 16, 0, FormatID::D16_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_D24S8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8,
|
||||
FormatID::D24_UNORM_S8_UINT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_D24X8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 0, FormatID::D16_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_D32:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 32, 0, FormatID::D32_UNORM);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_DXT1:
|
||||
{
|
||||
static const D3DFormat info(64, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
FormatID::BC1_RGBA_UNORM_BLOCK);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_DXT3:
|
||||
{
|
||||
static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
FormatID::BC2_RGBA_UNORM_BLOCK);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_DXT5:
|
||||
{
|
||||
static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
FormatID::BC3_RGBA_UNORM_BLOCK);
|
||||
return info;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
static const D3DFormat defaultInfo;
|
||||
return defaultInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::pair<GLint, InitializeTextureDataFunction> InternalFormatInitialzerPair;
|
||||
typedef std::map<GLint, InitializeTextureDataFunction> InternalFormatInitialzerMap;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "libANGLE/renderer/Format.h"
|
||||
#include "libANGLE/renderer/copyvertex.h"
|
||||
#include "libANGLE/renderer/d3d/formatutilsD3D.h"
|
||||
#include "libANGLE/renderer/d3d_format.h"
|
||||
#include "libANGLE/renderer/renderer_utils.h"
|
||||
|
||||
namespace rx
|
||||
@@ -28,41 +29,6 @@ class Renderer9;
|
||||
namespace d3d9
|
||||
{
|
||||
|
||||
struct D3DFormat
|
||||
{
|
||||
D3DFormat();
|
||||
D3DFormat(GLuint pixelBytes,
|
||||
GLuint blockWidth,
|
||||
GLuint blockHeight,
|
||||
GLuint redBits,
|
||||
GLuint greenBits,
|
||||
GLuint blueBits,
|
||||
GLuint alphaBits,
|
||||
GLuint luminanceBits,
|
||||
GLuint depthBits,
|
||||
GLuint stencilBits,
|
||||
angle::FormatID formatID);
|
||||
|
||||
const angle::Format &info() const { return angle::Format::Get(formatID); }
|
||||
|
||||
GLuint pixelBytes;
|
||||
GLuint blockWidth;
|
||||
GLuint blockHeight;
|
||||
|
||||
GLuint redBits;
|
||||
GLuint greenBits;
|
||||
GLuint blueBits;
|
||||
GLuint alphaBits;
|
||||
GLuint luminanceBits;
|
||||
|
||||
GLuint depthBits;
|
||||
GLuint stencilBits;
|
||||
|
||||
angle::FormatID formatID;
|
||||
};
|
||||
|
||||
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format);
|
||||
|
||||
struct VertexFormat
|
||||
{
|
||||
VertexFormat();
|
||||
|
||||
206
src/libANGLE/renderer/d3d_format.cpp
Normal file
206
src/libANGLE/renderer/d3d_format.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// Copyright 2020 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.
|
||||
//
|
||||
// d3d_format: Describes a D3D9 format. Used by the D3D9 and GL back-ends.
|
||||
|
||||
#include "libANGLE/renderer/d3d_format.h"
|
||||
|
||||
using namespace angle;
|
||||
|
||||
namespace rx
|
||||
{
|
||||
namespace d3d9
|
||||
{
|
||||
namespace
|
||||
{
|
||||
constexpr D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I', 'N', 'T', 'Z')));
|
||||
constexpr D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N', 'U', 'L', 'L')));
|
||||
} // anonymous namespace
|
||||
|
||||
D3DFormat::D3DFormat()
|
||||
: pixelBytes(0),
|
||||
blockWidth(0),
|
||||
blockHeight(0),
|
||||
redBits(0),
|
||||
greenBits(0),
|
||||
blueBits(0),
|
||||
alphaBits(0),
|
||||
luminanceBits(0),
|
||||
depthBits(0),
|
||||
stencilBits(0),
|
||||
formatID(angle::FormatID::NONE)
|
||||
{}
|
||||
|
||||
D3DFormat::D3DFormat(GLuint bits,
|
||||
GLuint blockWidth,
|
||||
GLuint blockHeight,
|
||||
GLuint redBits,
|
||||
GLuint greenBits,
|
||||
GLuint blueBits,
|
||||
GLuint alphaBits,
|
||||
GLuint lumBits,
|
||||
GLuint depthBits,
|
||||
GLuint stencilBits,
|
||||
FormatID formatID)
|
||||
: pixelBytes(bits / 8),
|
||||
blockWidth(blockWidth),
|
||||
blockHeight(blockHeight),
|
||||
redBits(redBits),
|
||||
greenBits(greenBits),
|
||||
blueBits(blueBits),
|
||||
alphaBits(alphaBits),
|
||||
luminanceBits(lumBits),
|
||||
depthBits(depthBits),
|
||||
stencilBits(stencilBits),
|
||||
formatID(formatID)
|
||||
{}
|
||||
|
||||
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format)
|
||||
{
|
||||
if (format == D3DFMT_NULL)
|
||||
{
|
||||
static const D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FormatID::NONE);
|
||||
return info;
|
||||
}
|
||||
|
||||
if (format == D3DFMT_INTZ)
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8, FormatID::D24_UNORM_S8_UINT);
|
||||
return info;
|
||||
}
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case D3DFMT_UNKNOWN:
|
||||
{
|
||||
static const D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FormatID::NONE);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_L8:
|
||||
{
|
||||
static const D3DFormat info(8, 1, 1, 0, 0, 0, 0, 8, 0, 0, FormatID::L8_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A8:
|
||||
{
|
||||
static const D3DFormat info(8, 1, 1, 0, 0, 0, 8, 0, 0, 0, FormatID::A8_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A8L8:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 0, 0, 0, 8, 8, 0, 0, FormatID::L8A8_UNORM);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_A4R4G4B4:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 4, 4, 4, 4, 0, 0, 0, FormatID::B4G4R4A4_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A1R5G5B5:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 5, 5, 5, 1, 0, 0, 0, FormatID::B5G5R5A1_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_R5G6B5:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 5, 6, 5, 0, 0, 0, 0, FormatID::R5G6B5_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_X8R8G8B8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 8, 8, 8, 0, 0, 0, 0, FormatID::B8G8R8X8_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 8, 8, 8, 8, 0, 0, 0, FormatID::B8G8R8A8_UNORM);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_R16F:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 16, 0, 0, 0, 0, 0, 0, FormatID::R16_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_G16R16F:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 16, 16, 0, 0, 0, 0, 0, FormatID::R16G16_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
{
|
||||
static const D3DFormat info(64, 1, 1, 16, 16, 16, 16, 0, 0, 0,
|
||||
FormatID::R16G16B16A16_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_R32F:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 32, 0, 0, 0, 0, 0, 0, FormatID::R32_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_G32R32F:
|
||||
{
|
||||
static const D3DFormat info(64, 1, 1, 32, 32, 0, 0, 0, 0, 0, FormatID::R32G32_FLOAT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
{
|
||||
static const D3DFormat info(128, 1, 1, 32, 32, 32, 32, 0, 0, 0,
|
||||
FormatID::R32G32B32A32_FLOAT);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_D16:
|
||||
{
|
||||
static const D3DFormat info(16, 1, 1, 0, 0, 0, 0, 0, 16, 0, FormatID::D16_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_D24S8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8,
|
||||
FormatID::D24_UNORM_S8_UINT);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_D24X8:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 0, FormatID::D16_UNORM);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_D32:
|
||||
{
|
||||
static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 32, 0, FormatID::D32_UNORM);
|
||||
return info;
|
||||
}
|
||||
|
||||
case D3DFMT_DXT1:
|
||||
{
|
||||
static const D3DFormat info(64, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
FormatID::BC1_RGBA_UNORM_BLOCK);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_DXT3:
|
||||
{
|
||||
static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
FormatID::BC2_RGBA_UNORM_BLOCK);
|
||||
return info;
|
||||
}
|
||||
case D3DFMT_DXT5:
|
||||
{
|
||||
static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
FormatID::BC3_RGBA_UNORM_BLOCK);
|
||||
return info;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
static const D3DFormat defaultInfo;
|
||||
return defaultInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace d3d9
|
||||
} // namespace rx
|
||||
55
src/libANGLE/renderer/d3d_format.h
Normal file
55
src/libANGLE/renderer/d3d_format.h
Normal file
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright 2020 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.
|
||||
//
|
||||
// d3d_format: Describes a D3D9 format. Used by the D3D9 and GL back-ends.
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_D3D_FORMAT_H_
|
||||
#define LIBANGLE_RENDERER_D3D_FORMAT_H_
|
||||
|
||||
#include "libANGLE/renderer/Format.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
namespace d3d9
|
||||
{
|
||||
struct D3DFormat
|
||||
{
|
||||
D3DFormat();
|
||||
D3DFormat(GLuint pixelBytes,
|
||||
GLuint blockWidth,
|
||||
GLuint blockHeight,
|
||||
GLuint redBits,
|
||||
GLuint greenBits,
|
||||
GLuint blueBits,
|
||||
GLuint alphaBits,
|
||||
GLuint luminanceBits,
|
||||
GLuint depthBits,
|
||||
GLuint stencilBits,
|
||||
angle::FormatID formatID);
|
||||
|
||||
const angle::Format &info() const { return angle::Format::Get(formatID); }
|
||||
|
||||
GLuint pixelBytes;
|
||||
GLuint blockWidth;
|
||||
GLuint blockHeight;
|
||||
|
||||
GLuint redBits;
|
||||
GLuint greenBits;
|
||||
GLuint blueBits;
|
||||
GLuint alphaBits;
|
||||
GLuint luminanceBits;
|
||||
|
||||
GLuint depthBits;
|
||||
GLuint stencilBits;
|
||||
|
||||
angle::FormatID formatID;
|
||||
};
|
||||
|
||||
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format);
|
||||
|
||||
} // namespace d3d9
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_D3D_FORMAT_H_
|
||||
27
src/libANGLE/renderer/dxgi_format_map.h
Normal file
27
src/libANGLE/renderer/dxgi_format_map.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright 2020 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.
|
||||
//
|
||||
// DXGI format info:
|
||||
// Determining metadata about a DXGI format.
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_DXGI_FORMAT_MAP_H_
|
||||
#define LIBANGLE_RENDERER_DXGI_FORMAT_MAP_H_
|
||||
|
||||
#include "common/platform.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
namespace d3d11
|
||||
{
|
||||
GLenum GetComponentType(DXGI_FORMAT dxgiFormat);
|
||||
} // namespace d3d11
|
||||
|
||||
namespace d3d11_angle
|
||||
{
|
||||
const angle::Format &GetFormat(DXGI_FORMAT dxgiFormat);
|
||||
} // namespace d3d11_angle
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_DXGI_FORMAT_MAP_H_
|
||||
@@ -8,8 +8,8 @@
|
||||
// version, D3D feature level, and is sometimes guaranteed or optional.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_D3D_D3D11_DXGI_SUPPORT_TABLE_H_
|
||||
#define LIBANGLE_RENDERER_D3D_D3D11_DXGI_SUPPORT_TABLE_H_
|
||||
#ifndef LIBANGLE_RENDERER_DXGI_SUPPORT_TABLE_H_
|
||||
#define LIBANGLE_RENDERER_DXGI_SUPPORT_TABLE_H_
|
||||
|
||||
#include "common/platform.h"
|
||||
|
||||
@@ -40,4 +40,4 @@ const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL feat
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_D3D_D3D11_DXGI_SUPPORT_TABLE_H_
|
||||
#endif // LIBANGLE_RENDERER_DXGI_SUPPORT_TABLE_H_
|
||||
@@ -9,7 +9,7 @@
|
||||
// version, D3D feature level, and is sometimes guaranteed or optional.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/dxgi_support_table.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
from datetime import date
|
||||
import sys
|
||||
|
||||
sys.path.append('../..')
|
||||
import angle_format
|
||||
|
||||
template_cpp = """// GENERATED FILE - DO NOT EDIT.
|
||||
@@ -89,8 +87,8 @@ def main():
|
||||
# auto_script parameters.
|
||||
if len(sys.argv) > 1:
|
||||
inputs = [
|
||||
'../../angle_format.py',
|
||||
'../../angle_format_map.json',
|
||||
'angle_format.py',
|
||||
'angle_format_map.json',
|
||||
'dxgi_format_data.json',
|
||||
]
|
||||
outputs = ['dxgi_format_map_autogen.cpp']
|
||||
@@ -35,7 +35,7 @@ template = """// GENERATED FILE - DO NOT EDIT. See dxgi_support_data.json.
|
||||
// version, D3D feature level, and is sometimes guaranteed or optional.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/dxgi_support_table.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h"
|
||||
|
||||
#include "libANGLE/Surface.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
|
||||
#include "libANGLE/renderer/d3d_format.h"
|
||||
#include "libANGLE/renderer/dxgi_format_map.h"
|
||||
#include "libANGLE/renderer/gl/FramebufferGL.h"
|
||||
#include "libANGLE/renderer/gl/RendererGL.h"
|
||||
#include "libANGLE/renderer/gl/StateManagerGL.h"
|
||||
|
||||
@@ -802,12 +802,6 @@ libangle_gl_wgl_sources = [
|
||||
"src/third_party/khronos/GL/wglext.h",
|
||||
]
|
||||
|
||||
libangle_gl_wgl_d3d11_common_sources = [
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp",
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h",
|
||||
"src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp",
|
||||
]
|
||||
|
||||
libangle_gl_glx_sources = [
|
||||
"src/libANGLE/renderer/gl/glx/DisplayGLX.cpp",
|
||||
"src/libANGLE/renderer/gl/glx/DisplayGLX.h",
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/Context11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
|
||||
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
|
||||
#include "libANGLE/renderer/dxgi_support_table.h"
|
||||
#include "test_utils/ANGLETest.h"
|
||||
#include "test_utils/angle_test_instantiate.h"
|
||||
#include "util/EGLWindow.h"
|
||||
|
||||
Reference in New Issue
Block a user