Commit e0548ad2 by Jamie Madill

D3D11: Split off DXGI component type query.

This query is currently a part of a std::map. Split it off to its own switch using auto-generation based on the format string. Also introduce a DXGI-to-angle format map. This map is not totally complete because some more esoteric formats don't have corresponding ANGLE formats yet. We should add these other formats (EG NV12) if we need them. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: I49e045bdc04a52166299c9e22a4c4d3f24069dbc Reviewed-on: https://chromium-review.googlesource.com/392209Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 65c79dbc
......@@ -48,6 +48,7 @@ Format::Format(ID id,
GLenum fboFormat,
MipGenerationFunction mipGen,
ColorReadFunction colorRead,
GLenum componentType,
GLuint redBits,
GLuint greenBits,
GLuint blueBits,
......@@ -60,6 +61,7 @@ Format::Format(ID id,
mipGenerationFunction(mipGen),
colorReadFunction(colorRead),
fastCopyFunctions(GetFastCopyFunctionsMap(id)),
componentType(componentType),
redBits(redBits),
greenBits(greenBits),
blueBits(blueBits),
......
......@@ -27,6 +27,7 @@ struct Format final : angle::NonCopyable
GLenum fboFormat,
rx::MipGenerationFunction mipGen,
rx::ColorReadFunction colorRead,
GLenum componentType,
GLuint redBits,
GLuint greenBits,
GLuint blueBits,
......@@ -53,6 +54,8 @@ struct Format final : angle::NonCopyable
// A map from a gl::FormatType to a fast pixel copy function for this format.
rx::FastCopyFunctionMap fastCopyFunctions;
GLenum componentType;
GLuint redBits;
GLuint greenBits;
GLuint blueBits;
......
......@@ -30,6 +30,7 @@ const Format &Format::Get(ID id)
GL_ALPHA16F_EXT,
GenerateMip<A16F>,
ReadColor<A16F, GLfloat>,
GL_FLOAT,
0, 0, 0, 16, 0, 0);
return info;
}
......@@ -40,6 +41,7 @@ const Format &Format::Get(ID id)
GL_ALPHA32F_EXT,
GenerateMip<A32F>,
ReadColor<A32F, GLfloat>,
GL_FLOAT,
0, 0, 0, 32, 0, 0);
return info;
}
......@@ -50,6 +52,7 @@ const Format &Format::Get(ID id)
GL_ALPHA8_EXT,
GenerateMip<A8>,
ReadColor<A8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 8, 0, 0);
return info;
}
......@@ -60,6 +63,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -70,6 +74,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -80,6 +85,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -90,6 +96,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -100,6 +107,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -110,6 +118,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -120,6 +129,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -130,6 +140,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -140,6 +151,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -150,6 +162,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -160,6 +173,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -170,6 +184,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -180,6 +195,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -190,6 +206,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -200,6 +217,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -210,6 +228,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -220,6 +239,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -230,6 +250,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -240,6 +261,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -250,6 +272,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -260,6 +283,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -270,6 +294,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -280,6 +305,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -290,6 +316,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -300,6 +327,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -310,6 +338,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -320,6 +349,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -330,6 +360,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -340,6 +371,7 @@ const Format &Format::Get(ID id)
GL_RGBA4,
GenerateMip<A4R4G4B4>,
ReadColor<A4R4G4B4, GLfloat>,
GL_UNSIGNED_NORMALIZED,
4, 4, 4, 4, 0, 0);
return info;
}
......@@ -350,6 +382,7 @@ const Format &Format::Get(ID id)
GL_RGB5_A1,
GenerateMip<A1R5G5B5>,
ReadColor<A1R5G5B5, GLfloat>,
GL_UNSIGNED_NORMALIZED,
5, 5, 5, 1, 0, 0);
return info;
}
......@@ -360,6 +393,7 @@ const Format &Format::Get(ID id)
GL_RGB565,
GenerateMip<B5G6R5>,
ReadColor<B5G6R5, GLfloat>,
GL_UNSIGNED_NORMALIZED,
5, 6, 5, 0, 0, 0);
return info;
}
......@@ -370,6 +404,7 @@ const Format &Format::Get(ID id)
GL_BGRA8_EXT,
GenerateMip<B8G8R8A8>,
ReadColor<B8G8R8A8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -380,6 +415,7 @@ const Format &Format::Get(ID id)
GL_BGRA8_EXT,
GenerateMip<B8G8R8X8>,
ReadColor<B8G8R8X8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -390,6 +426,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -400,6 +437,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -410,6 +448,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -420,6 +459,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -430,6 +470,7 @@ const Format &Format::Get(ID id)
GL_DEPTH_COMPONENT16,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 16, 0);
return info;
}
......@@ -440,6 +481,7 @@ const Format &Format::Get(ID id)
GL_DEPTH_COMPONENT24,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 24, 0);
return info;
}
......@@ -450,6 +492,7 @@ const Format &Format::Get(ID id)
GL_DEPTH24_STENCIL8,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 24, 8);
return info;
}
......@@ -460,6 +503,7 @@ const Format &Format::Get(ID id)
GL_DEPTH_COMPONENT32F,
nullptr,
nullptr,
GL_FLOAT,
0, 0, 0, 0, 32, 0);
return info;
}
......@@ -470,6 +514,7 @@ const Format &Format::Get(ID id)
GL_DEPTH32F_STENCIL8,
nullptr,
nullptr,
GL_FLOAT,
0, 0, 0, 0, 32, 8);
return info;
}
......@@ -480,6 +525,7 @@ const Format &Format::Get(ID id)
GL_DEPTH_COMPONENT32_OES,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 32, 0);
return info;
}
......@@ -490,6 +536,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SIGNED_RG11_EAC,
nullptr,
nullptr,
GL_SIGNED_NORMALIZED,
11, 11, 0, 0, 0, 0);
return info;
}
......@@ -500,6 +547,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RG11_EAC,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
11, 11, 0, 0, 0, 0);
return info;
}
......@@ -510,6 +558,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SIGNED_R11_EAC,
nullptr,
nullptr,
GL_SIGNED_NORMALIZED,
11, 0, 0, 0, 0, 0);
return info;
}
......@@ -520,6 +569,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_R11_EAC,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
11, 0, 0, 0, 0, 0);
return info;
}
......@@ -530,6 +580,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 1, 0, 0);
return info;
}
......@@ -540,6 +591,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 1, 0, 0);
return info;
}
......@@ -550,6 +602,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -560,6 +613,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGBA8_ETC2_EAC,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -570,6 +624,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_SRGB8_ETC2,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -580,6 +635,7 @@ const Format &Format::Get(ID id)
GL_COMPRESSED_RGB8_ETC2,
nullptr,
nullptr,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -590,6 +646,7 @@ const Format &Format::Get(ID id)
GL_LUMINANCE_ALPHA16F_EXT,
GenerateMip<L16A16F>,
ReadColor<L16A16F, GLfloat>,
GL_FLOAT,
0, 0, 0, 16, 0, 0);
return info;
}
......@@ -600,6 +657,7 @@ const Format &Format::Get(ID id)
GL_LUMINANCE16F_EXT,
GenerateMip<L16F>,
ReadColor<L16F, GLfloat>,
GL_FLOAT,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -610,6 +668,7 @@ const Format &Format::Get(ID id)
GL_LUMINANCE_ALPHA32F_EXT,
GenerateMip<L32A32F>,
ReadColor<L32A32F, GLfloat>,
GL_FLOAT,
0, 0, 0, 32, 0, 0);
return info;
}
......@@ -620,6 +679,7 @@ const Format &Format::Get(ID id)
GL_LUMINANCE32F_EXT,
GenerateMip<L32F>,
ReadColor<L32F, GLfloat>,
GL_FLOAT,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -630,6 +690,7 @@ const Format &Format::Get(ID id)
GL_LUMINANCE8_ALPHA8_EXT,
GenerateMip<L8A8>,
ReadColor<L8A8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 8, 0, 0);
return info;
}
......@@ -640,6 +701,7 @@ const Format &Format::Get(ID id)
GL_LUMINANCE8_EXT,
GenerateMip<L8>,
ReadColor<L8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -650,6 +712,7 @@ const Format &Format::Get(ID id)
GL_NONE,
nullptr,
nullptr,
GL_NONE,
0, 0, 0, 0, 0, 0);
return info;
}
......@@ -660,6 +723,7 @@ const Format &Format::Get(ID id)
GL_RGB10_A2UI,
GenerateMip<R10G10B10A2>,
ReadColor<R10G10B10A2, GLuint>,
GL_UNSIGNED_INT,
10, 10, 10, 2, 0, 0);
return info;
}
......@@ -670,6 +734,7 @@ const Format &Format::Get(ID id)
GL_RGB10_A2,
GenerateMip<R10G10B10A2>,
ReadColor<R10G10B10A2, GLfloat>,
GL_UNSIGNED_NORMALIZED,
10, 10, 10, 2, 0, 0);
return info;
}
......@@ -680,6 +745,7 @@ const Format &Format::Get(ID id)
GL_R11F_G11F_B10F,
GenerateMip<R11G11B10F>,
ReadColor<R11G11B10F, GLfloat>,
GL_FLOAT,
11, 11, 10, 0, 0, 0);
return info;
}
......@@ -690,6 +756,7 @@ const Format &Format::Get(ID id)
GL_RGBA16F,
GenerateMip<R16G16B16A16F>,
ReadColor<R16G16B16A16F, GLfloat>,
GL_FLOAT,
16, 16, 16, 16, 0, 0);
return info;
}
......@@ -700,6 +767,7 @@ const Format &Format::Get(ID id)
GL_RGBA16I,
GenerateMip<R16G16B16A16S>,
ReadColor<R16G16B16A16S, GLint>,
GL_INT,
16, 16, 16, 16, 0, 0);
return info;
}
......@@ -710,6 +778,7 @@ const Format &Format::Get(ID id)
GL_RGBA16_SNORM_EXT,
GenerateMip<R16G16B16A16S>,
ReadColor<R16G16B16A16S, GLfloat>,
GL_SIGNED_NORMALIZED,
16, 16, 16, 16, 0, 0);
return info;
}
......@@ -720,6 +789,7 @@ const Format &Format::Get(ID id)
GL_RGBA16UI,
GenerateMip<R16G16B16A16>,
ReadColor<R16G16B16A16, GLuint>,
GL_UNSIGNED_INT,
16, 16, 16, 16, 0, 0);
return info;
}
......@@ -730,6 +800,7 @@ const Format &Format::Get(ID id)
GL_RGBA16_EXT,
GenerateMip<R16G16B16A16>,
ReadColor<R16G16B16A16, GLfloat>,
GL_UNSIGNED_NORMALIZED,
16, 16, 16, 16, 0, 0);
return info;
}
......@@ -740,6 +811,7 @@ const Format &Format::Get(ID id)
GL_RGB16F,
GenerateMip<R16G16B16F>,
ReadColor<R16G16B16F, GLfloat>,
GL_FLOAT,
16, 16, 16, 0, 0, 0);
return info;
}
......@@ -750,6 +822,7 @@ const Format &Format::Get(ID id)
GL_RGB16I,
GenerateMip<R16G16B16S>,
ReadColor<R16G16B16S, GLint>,
GL_INT,
16, 16, 16, 0, 0, 0);
return info;
}
......@@ -760,6 +833,7 @@ const Format &Format::Get(ID id)
GL_RGB16_SNORM_EXT,
GenerateMip<R16G16B16S>,
ReadColor<R16G16B16S, GLfloat>,
GL_SIGNED_NORMALIZED,
16, 16, 16, 0, 0, 0);
return info;
}
......@@ -770,6 +844,7 @@ const Format &Format::Get(ID id)
GL_RGB16UI,
GenerateMip<R16G16B16>,
ReadColor<R16G16B16, GLuint>,
GL_UNSIGNED_INT,
16, 16, 16, 0, 0, 0);
return info;
}
......@@ -780,6 +855,7 @@ const Format &Format::Get(ID id)
GL_RGB16_EXT,
GenerateMip<R16G16B16>,
ReadColor<R16G16B16, GLfloat>,
GL_UNSIGNED_NORMALIZED,
16, 16, 16, 0, 0, 0);
return info;
}
......@@ -790,6 +866,7 @@ const Format &Format::Get(ID id)
GL_RG16F,
GenerateMip<R16G16F>,
ReadColor<R16G16F, GLfloat>,
GL_FLOAT,
16, 16, 0, 0, 0, 0);
return info;
}
......@@ -800,6 +877,7 @@ const Format &Format::Get(ID id)
GL_RG16I,
GenerateMip<R16G16S>,
ReadColor<R16G16S, GLint>,
GL_INT,
16, 16, 0, 0, 0, 0);
return info;
}
......@@ -810,6 +888,7 @@ const Format &Format::Get(ID id)
GL_RG16_SNORM_EXT,
GenerateMip<R16G16S>,
ReadColor<R16G16S, GLfloat>,
GL_SIGNED_NORMALIZED,
16, 16, 0, 0, 0, 0);
return info;
}
......@@ -820,6 +899,7 @@ const Format &Format::Get(ID id)
GL_RG16UI,
GenerateMip<R16G16>,
ReadColor<R16G16, GLuint>,
GL_UNSIGNED_INT,
16, 16, 0, 0, 0, 0);
return info;
}
......@@ -830,6 +910,7 @@ const Format &Format::Get(ID id)
GL_RG16_EXT,
GenerateMip<R16G16>,
ReadColor<R16G16, GLfloat>,
GL_UNSIGNED_NORMALIZED,
16, 16, 0, 0, 0, 0);
return info;
}
......@@ -840,6 +921,7 @@ const Format &Format::Get(ID id)
GL_R16F,
GenerateMip<R16F>,
ReadColor<R16F, GLfloat>,
GL_FLOAT,
16, 0, 0, 0, 0, 0);
return info;
}
......@@ -850,6 +932,7 @@ const Format &Format::Get(ID id)
GL_R16I,
GenerateMip<R16S>,
ReadColor<R16S, GLint>,
GL_INT,
16, 0, 0, 0, 0, 0);
return info;
}
......@@ -860,6 +943,7 @@ const Format &Format::Get(ID id)
GL_R16_SNORM_EXT,
GenerateMip<R16S>,
ReadColor<R16S, GLfloat>,
GL_SIGNED_NORMALIZED,
16, 0, 0, 0, 0, 0);
return info;
}
......@@ -870,6 +954,7 @@ const Format &Format::Get(ID id)
GL_R16UI,
GenerateMip<R16>,
ReadColor<R16, GLuint>,
GL_UNSIGNED_INT,
16, 0, 0, 0, 0, 0);
return info;
}
......@@ -880,6 +965,7 @@ const Format &Format::Get(ID id)
GL_R16_EXT,
GenerateMip<R16>,
ReadColor<R16, GLfloat>,
GL_UNSIGNED_NORMALIZED,
16, 0, 0, 0, 0, 0);
return info;
}
......@@ -890,6 +976,7 @@ const Format &Format::Get(ID id)
GL_RGBA32F,
GenerateMip<R32G32B32A32F>,
ReadColor<R32G32B32A32F, GLfloat>,
GL_FLOAT,
32, 32, 32, 32, 0, 0);
return info;
}
......@@ -900,6 +987,7 @@ const Format &Format::Get(ID id)
GL_RGBA32I,
GenerateMip<R32G32B32A32S>,
ReadColor<R32G32B32A32S, GLint>,
GL_INT,
32, 32, 32, 32, 0, 0);
return info;
}
......@@ -910,6 +998,7 @@ const Format &Format::Get(ID id)
GL_RGBA32UI,
GenerateMip<R32G32B32A32>,
ReadColor<R32G32B32A32, GLuint>,
GL_UNSIGNED_INT,
32, 32, 32, 32, 0, 0);
return info;
}
......@@ -920,6 +1009,7 @@ const Format &Format::Get(ID id)
GL_RGB32F,
GenerateMip<R32G32B32F>,
ReadColor<R32G32B32F, GLfloat>,
GL_FLOAT,
32, 32, 32, 0, 0, 0);
return info;
}
......@@ -930,6 +1020,7 @@ const Format &Format::Get(ID id)
GL_RGB32I,
GenerateMip<R32G32B32S>,
ReadColor<R32G32B32S, GLint>,
GL_INT,
32, 32, 32, 0, 0, 0);
return info;
}
......@@ -940,6 +1031,7 @@ const Format &Format::Get(ID id)
GL_RGB32UI,
GenerateMip<R32G32B32>,
ReadColor<R32G32B32, GLuint>,
GL_UNSIGNED_INT,
32, 32, 32, 0, 0, 0);
return info;
}
......@@ -950,6 +1042,7 @@ const Format &Format::Get(ID id)
GL_RG32F,
GenerateMip<R32G32F>,
ReadColor<R32G32F, GLfloat>,
GL_FLOAT,
32, 32, 0, 0, 0, 0);
return info;
}
......@@ -960,6 +1053,7 @@ const Format &Format::Get(ID id)
GL_RG32I,
GenerateMip<R32G32S>,
ReadColor<R32G32S, GLint>,
GL_INT,
32, 32, 0, 0, 0, 0);
return info;
}
......@@ -970,6 +1064,7 @@ const Format &Format::Get(ID id)
GL_RG32UI,
GenerateMip<R32G32>,
ReadColor<R32G32, GLuint>,
GL_UNSIGNED_INT,
32, 32, 0, 0, 0, 0);
return info;
}
......@@ -980,6 +1075,7 @@ const Format &Format::Get(ID id)
GL_R32F,
GenerateMip<R32F>,
ReadColor<R32F, GLfloat>,
GL_FLOAT,
32, 0, 0, 0, 0, 0);
return info;
}
......@@ -990,6 +1086,7 @@ const Format &Format::Get(ID id)
GL_R32I,
GenerateMip<R32S>,
ReadColor<R32S, GLint>,
GL_INT,
32, 0, 0, 0, 0, 0);
return info;
}
......@@ -1000,6 +1097,7 @@ const Format &Format::Get(ID id)
GL_R32UI,
GenerateMip<R32>,
ReadColor<R32, GLuint>,
GL_UNSIGNED_INT,
32, 0, 0, 0, 0, 0);
return info;
}
......@@ -1010,6 +1108,7 @@ const Format &Format::Get(ID id)
GL_RGBA4,
GenerateMip<R4G4B4A4>,
ReadColor<R4G4B4A4, GLfloat>,
GL_UNSIGNED_NORMALIZED,
4, 4, 4, 4, 0, 0);
return info;
}
......@@ -1020,6 +1119,7 @@ const Format &Format::Get(ID id)
GL_RGB5_A1,
GenerateMip<R5G5B5A1>,
ReadColor<R5G5B5A1, GLfloat>,
GL_UNSIGNED_NORMALIZED,
5, 5, 5, 1, 0, 0);
return info;
}
......@@ -1030,6 +1130,7 @@ const Format &Format::Get(ID id)
GL_RGB565,
GenerateMip<R5G6B5>,
ReadColor<R5G6B5, GLfloat>,
GL_UNSIGNED_NORMALIZED,
5, 6, 5, 0, 0, 0);
return info;
}
......@@ -1040,6 +1141,7 @@ const Format &Format::Get(ID id)
GL_RGBA8I,
GenerateMip<R8G8B8A8S>,
ReadColor<R8G8B8A8S, GLint>,
GL_INT,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -1050,6 +1152,7 @@ const Format &Format::Get(ID id)
GL_RGBA8_SNORM,
GenerateMip<R8G8B8A8S>,
ReadColor<R8G8B8A8S, GLfloat>,
GL_SIGNED_NORMALIZED,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -1060,6 +1163,7 @@ const Format &Format::Get(ID id)
GL_RGBA8UI,
GenerateMip<R8G8B8A8>,
ReadColor<R8G8B8A8, GLuint>,
GL_UNSIGNED_INT,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -1070,6 +1174,7 @@ const Format &Format::Get(ID id)
GL_RGBA8,
GenerateMip<R8G8B8A8>,
ReadColor<R8G8B8A8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -1080,6 +1185,7 @@ const Format &Format::Get(ID id)
GL_SRGB8_ALPHA8,
GenerateMip<R8G8B8A8>,
ReadColor<R8G8B8A8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 8, 0, 0);
return info;
}
......@@ -1090,6 +1196,7 @@ const Format &Format::Get(ID id)
GL_RGB8I,
GenerateMip<R8G8B8S>,
ReadColor<R8G8B8S, GLint>,
GL_INT,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -1100,6 +1207,7 @@ const Format &Format::Get(ID id)
GL_RGB8_SNORM,
GenerateMip<R8G8B8S>,
ReadColor<R8G8B8S, GLfloat>,
GL_SIGNED_NORMALIZED,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -1110,6 +1218,7 @@ const Format &Format::Get(ID id)
GL_RGB8UI,
GenerateMip<R8G8B8>,
ReadColor<R8G8B8, GLuint>,
GL_UNSIGNED_INT,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -1120,6 +1229,7 @@ const Format &Format::Get(ID id)
GL_RGB8,
GenerateMip<R8G8B8>,
ReadColor<R8G8B8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -1130,6 +1240,7 @@ const Format &Format::Get(ID id)
GL_SRGB8,
GenerateMip<R8G8B8>,
ReadColor<R8G8B8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 8, 0, 0, 0);
return info;
}
......@@ -1140,6 +1251,7 @@ const Format &Format::Get(ID id)
GL_RG8I,
GenerateMip<R8G8S>,
ReadColor<R8G8S, GLint>,
GL_INT,
8, 8, 0, 0, 0, 0);
return info;
}
......@@ -1150,6 +1262,7 @@ const Format &Format::Get(ID id)
GL_RG8_SNORM,
GenerateMip<R8G8S>,
ReadColor<R8G8S, GLfloat>,
GL_SIGNED_NORMALIZED,
8, 8, 0, 0, 0, 0);
return info;
}
......@@ -1160,6 +1273,7 @@ const Format &Format::Get(ID id)
GL_RG8UI,
GenerateMip<R8G8>,
ReadColor<R8G8, GLuint>,
GL_UNSIGNED_INT,
8, 8, 0, 0, 0, 0);
return info;
}
......@@ -1170,6 +1284,7 @@ const Format &Format::Get(ID id)
GL_RG8,
GenerateMip<R8G8>,
ReadColor<R8G8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 8, 0, 0, 0, 0);
return info;
}
......@@ -1180,6 +1295,7 @@ const Format &Format::Get(ID id)
GL_R8I,
GenerateMip<R8S>,
ReadColor<R8S, GLint>,
GL_INT,
8, 0, 0, 0, 0, 0);
return info;
}
......@@ -1190,6 +1306,7 @@ const Format &Format::Get(ID id)
GL_R8_SNORM,
GenerateMip<R8S>,
ReadColor<R8S, GLfloat>,
GL_SIGNED_NORMALIZED,
8, 0, 0, 0, 0, 0);
return info;
}
......@@ -1200,6 +1317,7 @@ const Format &Format::Get(ID id)
GL_R8UI,
GenerateMip<R8>,
ReadColor<R8, GLuint>,
GL_UNSIGNED_INT,
8, 0, 0, 0, 0, 0);
return info;
}
......@@ -1210,6 +1328,7 @@ const Format &Format::Get(ID id)
GL_R8,
GenerateMip<R8>,
ReadColor<R8, GLfloat>,
GL_UNSIGNED_NORMALIZED,
8, 0, 0, 0, 0, 0);
return info;
}
......@@ -1220,6 +1339,7 @@ const Format &Format::Get(ID id)
GL_RGB9_E5,
GenerateMip<R9G9B9E5>,
ReadColor<R9G9B9E5, GLfloat>,
GL_FLOAT,
9, 9, 9, 0, 0, 0);
return info;
}
......@@ -1230,6 +1350,7 @@ const Format &Format::Get(ID id)
GL_STENCIL_INDEX8,
nullptr,
nullptr,
GL_UNSIGNED_INT,
0, 0, 0, 0, 0, 8);
return info;
}
......@@ -1240,7 +1361,8 @@ const Format &Format::Get(ID id)
}
// clang-format on
static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr, 0, 0, 0, 0, 0, 0);
static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr, GL_NONE, 0, 0, 0, 0,
0, 0);
return noneInfo;
}
......
......@@ -1022,8 +1022,7 @@ gl::Error Blit11::swizzleTexture(ID3D11ShaderResourceView *source,
D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
source->GetDesc(&sourceSRVDesc);
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(sourceSRVDesc.Format);
GLenum componentType = dxgiFormatInfo.componentType;
GLenum componentType = d3d11::GetComponentType(sourceSRVDesc.Format);
if (componentType == GL_NONE)
{
// We're swizzling the depth component of a depth-stencil texture.
......@@ -1183,8 +1182,7 @@ gl::Error Blit11::copyTexture(ID3D11ShaderResourceView *source,
D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
source->GetDesc(&sourceSRVDesc);
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(sourceSRVDesc.Format);
GLenum componentType = dxgiFormatInfo.componentType;
GLenum componentType = d3d11::GetComponentType(sourceSRVDesc.Format);
ASSERT(componentType != GL_NONE);
ASSERT(componentType != GL_SIGNED_NORMALIZED);
......
......@@ -4174,7 +4174,9 @@ VertexConversionType Renderer11::getVertexConversionType(gl::VertexFormatType ve
GLenum Renderer11::getVertexComponentType(gl::VertexFormatType vertexFormatType) const
{
return d3d11::GetDXGIFormatInfo(d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel).nativeFormat).componentType;
const auto &format =
d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel);
return d3d11::GetComponentType(format.nativeFormat);
}
gl::ErrorOrResult<unsigned int> Renderer11::getVertexSpaceRequired(
......
......@@ -2403,8 +2403,8 @@ gl::Error TextureStorage11_Cube::createSRV(int baseLevel,
// Unnormalized integer cube maps are not supported by DX11; we emulate them as an array of six
// 2D textures
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(format);
if (dxgiFormatInfo.componentType == GL_INT || dxgiFormatInfo.componentType == GL_UNSIGNED_INT)
const GLenum componentType = d3d11::GetComponentType(format);
if (componentType == GL_INT || componentType == GL_UNSIGNED_INT)
{
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
......
{
"UNKNOWN": "NONE",
"R32G32B32A32_TYPELESS": "",
"R32G32B32A32_FLOAT": "",
"R32G32B32A32_UINT": "",
"R32G32B32A32_SINT": "",
"R32G32B32_TYPELESS": "",
"R32G32B32_FLOAT": "",
"R32G32B32_UINT": "",
"R32G32B32_SINT": "",
"R16G16B16A16_TYPELESS": "",
"R16G16B16A16_FLOAT": "",
"R16G16B16A16_UNORM": "",
"R16G16B16A16_UINT": "",
"R16G16B16A16_SNORM": "",
"R16G16B16A16_SINT": "",
"R32G32_TYPELESS": "",
"R32G32_FLOAT": "",
"R32G32_UINT": "",
"R32G32_SINT": "",
"R32G8X24_TYPELESS": "",
"D32_FLOAT_S8X24_UINT": "",
"R32_FLOAT_X8X24_TYPELESS": "",
"X32_TYPELESS_G8X24_UINT": "",
"R10G10B10A2_TYPELESS": "",
"R10G10B10A2_UNORM": "",
"R10G10B10A2_UINT": "",
"R11G11B10_FLOAT": "",
"R8G8B8A8_TYPELESS": "",
"R8G8B8A8_UNORM": "",
"R8G8B8A8_UNORM_SRGB": "",
"R8G8B8A8_UINT": "",
"R8G8B8A8_SNORM": "",
"R8G8B8A8_SINT": "",
"R16G16_TYPELESS": "",
"R16G16_FLOAT": "",
"R16G16_UNORM": "",
"R16G16_UINT": "",
"R16G16_SNORM": "",
"R16G16_SINT": "",
"R32_TYPELESS": "",
"D32_FLOAT": "",
"R32_FLOAT": "",
"R32_UINT": "",
"R32_SINT": "",
"R24G8_TYPELESS": "",
"D24_UNORM_S8_UINT": "",
"R24_UNORM_X8_TYPELESS": "",
"X24_TYPELESS_G8_UINT": "",
"R8G8_TYPELESS": "",
"R8G8_UNORM": "",
"R8G8_UINT": "",
"R8G8_SNORM": "",
"R8G8_SINT": "",
"R16_TYPELESS": "",
"R16_FLOAT": "",
"D16_UNORM": "",
"R16_UNORM": "",
"R16_UINT": "",
"R16_SNORM": "",
"R16_SINT": "",
"R8_TYPELESS": "",
"R8_UNORM": "",
"R8_UINT": "",
"R8_SNORM": "",
"R8_SINT": "",
"A8_UNORM": "",
"R1_UNORM": "",
"R9G9B9E5_SHAREDEXP": "",
"R8G8_B8G8_UNORM": "",
"G8R8_G8B8_UNORM": "",
"BC1_TYPELESS": "",
"BC1_UNORM": "BC1_RGBA_UNORM_BLOCK",
"BC1_UNORM_SRGB": "",
"BC2_TYPELESS": "",
"BC2_UNORM": "BC2_RGBA_UNORM_BLOCK",
"BC2_UNORM_SRGB": "",
"BC3_TYPELESS": "",
"BC3_UNORM": "BC3_RGBA_UNORM_BLOCK",
"BC3_UNORM_SRGB": "",
"BC4_TYPELESS": "",
"BC4_UNORM": "",
"BC4_SNORM": "",
"BC5_TYPELESS": "",
"BC5_UNORM": "",
"BC5_SNORM": "",
"B5G6R5_UNORM": "",
"B5G5R5A1_UNORM": "",
"B8G8R8A8_UNORM": "",
"B8G8R8X8_UNORM": "",
"R10G10B10_XR_BIAS_A2_UNORM": "",
"B8G8R8A8_TYPELESS": "",
"B8G8R8A8_UNORM_SRGB": "",
"B8G8R8X8_TYPELESS": "",
"B8G8R8X8_UNORM_SRGB": "",
"BC6H_TYPELESS": "",
"BC6H_UF16": "",
"BC6H_SF16": "",
"BC7_TYPELESS": "",
"BC7_UNORM": "",
"BC7_UNORM_SRGB": "",
"AYUV": "",
"Y410": "",
"Y416": "",
"NV12": "",
"P010": "",
"P016": "",
"420_OPAQUE": "",
"YUY2": "",
"Y210": "",
"Y216": "",
"NV11": "",
"AI44": "",
"IA44": "",
"P8": "",
"A8P8": "",
"B4G4R4A4_UNORM": ""
}
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_dxgi_format_table.py using data from dxgi_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.
//
// DXGI format info:
// Determining metadata about a DXGI format.
#include "libANGLE/renderer/Format.h"
using namespace angle;
namespace rx
{
namespace d3d11
{
GLenum GetComponentType(DXGI_FORMAT dxgiFormat)
{
switch (dxgiFormat)
{
case DXGI_FORMAT_420_OPAQUE:
break;
case DXGI_FORMAT_A8P8:
break;
case DXGI_FORMAT_A8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_AI44:
break;
case DXGI_FORMAT_AYUV:
break;
case DXGI_FORMAT_B4G4R4A4_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_B5G5R5A1_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_B5G6R5_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
break;
case DXGI_FORMAT_B8G8R8A8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
break;
case DXGI_FORMAT_B8G8R8X8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC1_TYPELESS:
break;
case DXGI_FORMAT_BC1_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC1_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC2_TYPELESS:
break;
case DXGI_FORMAT_BC2_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC2_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC3_TYPELESS:
break;
case DXGI_FORMAT_BC3_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC3_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC4_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_BC4_TYPELESS:
break;
case DXGI_FORMAT_BC4_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC5_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_BC5_TYPELESS:
break;
case DXGI_FORMAT_BC5_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC6H_SF16:
break;
case DXGI_FORMAT_BC6H_TYPELESS:
break;
case DXGI_FORMAT_BC6H_UF16:
break;
case DXGI_FORMAT_BC7_TYPELESS:
break;
case DXGI_FORMAT_BC7_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_BC7_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_D16_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_D24_UNORM_S8_UINT:
break;
case DXGI_FORMAT_D32_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
break;
case DXGI_FORMAT_G8R8_G8B8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_IA44:
break;
case DXGI_FORMAT_NV11:
break;
case DXGI_FORMAT_NV12:
break;
case DXGI_FORMAT_P010:
break;
case DXGI_FORMAT_P016:
break;
case DXGI_FORMAT_P8:
break;
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
break;
case DXGI_FORMAT_R10G10B10A2_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R10G10B10A2_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R11G11B10_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R16G16B16A16_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R16G16B16A16_SINT:
return GL_INT;
case DXGI_FORMAT_R16G16B16A16_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
break;
case DXGI_FORMAT_R16G16B16A16_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R16G16B16A16_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R16G16_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R16G16_SINT:
return GL_INT;
case DXGI_FORMAT_R16G16_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_R16G16_TYPELESS:
break;
case DXGI_FORMAT_R16G16_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R16G16_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R16_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R16_SINT:
return GL_INT;
case DXGI_FORMAT_R16_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_R16_TYPELESS:
break;
case DXGI_FORMAT_R16_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R16_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R1_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R24G8_TYPELESS:
break;
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R32G32B32A32_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R32G32B32A32_SINT:
return GL_INT;
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
break;
case DXGI_FORMAT_R32G32B32A32_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R32G32B32_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R32G32B32_SINT:
return GL_INT;
case DXGI_FORMAT_R32G32B32_TYPELESS:
break;
case DXGI_FORMAT_R32G32B32_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R32G32_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R32G32_SINT:
return GL_INT;
case DXGI_FORMAT_R32G32_TYPELESS:
break;
case DXGI_FORMAT_R32G32_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R32G8X24_TYPELESS:
break;
case DXGI_FORMAT_R32_FLOAT:
return GL_FLOAT;
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
return GL_FLOAT;
case DXGI_FORMAT_R32_SINT:
return GL_INT;
case DXGI_FORMAT_R32_TYPELESS:
break;
case DXGI_FORMAT_R32_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R8G8B8A8_SINT:
return GL_INT;
case DXGI_FORMAT_R8G8B8A8_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
break;
case DXGI_FORMAT_R8G8B8A8_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R8G8B8A8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R8G8_B8G8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R8G8_SINT:
return GL_INT;
case DXGI_FORMAT_R8G8_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_R8G8_TYPELESS:
break;
case DXGI_FORMAT_R8G8_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R8G8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R8_SINT:
return GL_INT;
case DXGI_FORMAT_R8_SNORM:
return GL_SIGNED_NORMALIZED;
case DXGI_FORMAT_R8_TYPELESS:
break;
case DXGI_FORMAT_R8_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_R8_UNORM:
return GL_UNSIGNED_NORMALIZED;
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
return GL_FLOAT;
case DXGI_FORMAT_UNKNOWN:
break;
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
return GL_UNSIGNED_INT;
case DXGI_FORMAT_Y210:
break;
case DXGI_FORMAT_Y216:
break;
case DXGI_FORMAT_Y410:
break;
case DXGI_FORMAT_Y416:
break;
case DXGI_FORMAT_YUY2:
break;
default:
break;
}
UNREACHABLE();
return GL_NONE;
}
} // namespace d3d11
namespace d3d11_angle
{
const Format &GetFormat(DXGI_FORMAT dxgiFormat)
{
switch (dxgiFormat)
{
case DXGI_FORMAT_420_OPAQUE:
break;
case DXGI_FORMAT_A8P8:
break;
case DXGI_FORMAT_A8_UNORM:
return Format::Get(Format::ID::A8_UNORM);
case DXGI_FORMAT_AI44:
break;
case DXGI_FORMAT_AYUV:
break;
case DXGI_FORMAT_B4G4R4A4_UNORM:
return Format::Get(Format::ID::B4G4R4A4_UNORM);
case DXGI_FORMAT_B5G5R5A1_UNORM:
return Format::Get(Format::ID::B5G5R5A1_UNORM);
case DXGI_FORMAT_B5G6R5_UNORM:
return Format::Get(Format::ID::B5G6R5_UNORM);
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
break;
case DXGI_FORMAT_B8G8R8A8_UNORM:
return Format::Get(Format::ID::B8G8R8A8_UNORM);
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
break;
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
break;
case DXGI_FORMAT_B8G8R8X8_UNORM:
return Format::Get(Format::ID::B8G8R8X8_UNORM);
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
break;
case DXGI_FORMAT_BC1_TYPELESS:
break;
case DXGI_FORMAT_BC1_UNORM:
return Format::Get(Format::ID::BC1_RGBA_UNORM_BLOCK);
case DXGI_FORMAT_BC1_UNORM_SRGB:
break;
case DXGI_FORMAT_BC2_TYPELESS:
break;
case DXGI_FORMAT_BC2_UNORM:
return Format::Get(Format::ID::BC2_RGBA_UNORM_BLOCK);
case DXGI_FORMAT_BC2_UNORM_SRGB:
break;
case DXGI_FORMAT_BC3_TYPELESS:
break;
case DXGI_FORMAT_BC3_UNORM:
return Format::Get(Format::ID::BC3_RGBA_UNORM_BLOCK);
case DXGI_FORMAT_BC3_UNORM_SRGB:
break;
case DXGI_FORMAT_BC4_SNORM:
break;
case DXGI_FORMAT_BC4_TYPELESS:
break;
case DXGI_FORMAT_BC4_UNORM:
break;
case DXGI_FORMAT_BC5_SNORM:
break;
case DXGI_FORMAT_BC5_TYPELESS:
break;
case DXGI_FORMAT_BC5_UNORM:
break;
case DXGI_FORMAT_BC6H_SF16:
break;
case DXGI_FORMAT_BC6H_TYPELESS:
break;
case DXGI_FORMAT_BC6H_UF16:
break;
case DXGI_FORMAT_BC7_TYPELESS:
break;
case DXGI_FORMAT_BC7_UNORM:
break;
case DXGI_FORMAT_BC7_UNORM_SRGB:
break;
case DXGI_FORMAT_D16_UNORM:
return Format::Get(Format::ID::D16_UNORM);
case DXGI_FORMAT_D24_UNORM_S8_UINT:
return Format::Get(Format::ID::D24_UNORM_S8_UINT);
case DXGI_FORMAT_D32_FLOAT:
return Format::Get(Format::ID::D32_FLOAT);
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
return Format::Get(Format::ID::D32_FLOAT_S8X24_UINT);
case DXGI_FORMAT_G8R8_G8B8_UNORM:
break;
case DXGI_FORMAT_IA44:
break;
case DXGI_FORMAT_NV11:
break;
case DXGI_FORMAT_NV12:
break;
case DXGI_FORMAT_P010:
break;
case DXGI_FORMAT_P016:
break;
case DXGI_FORMAT_P8:
break;
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
break;
case DXGI_FORMAT_R10G10B10A2_UINT:
return Format::Get(Format::ID::R10G10B10A2_UINT);
case DXGI_FORMAT_R10G10B10A2_UNORM:
return Format::Get(Format::ID::R10G10B10A2_UNORM);
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
break;
case DXGI_FORMAT_R11G11B10_FLOAT:
return Format::Get(Format::ID::R11G11B10_FLOAT);
case DXGI_FORMAT_R16G16B16A16_FLOAT:
return Format::Get(Format::ID::R16G16B16A16_FLOAT);
case DXGI_FORMAT_R16G16B16A16_SINT:
return Format::Get(Format::ID::R16G16B16A16_SINT);
case DXGI_FORMAT_R16G16B16A16_SNORM:
return Format::Get(Format::ID::R16G16B16A16_SNORM);
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
break;
case DXGI_FORMAT_R16G16B16A16_UINT:
return Format::Get(Format::ID::R16G16B16A16_UINT);
case DXGI_FORMAT_R16G16B16A16_UNORM:
return Format::Get(Format::ID::R16G16B16A16_UNORM);
case DXGI_FORMAT_R16G16_FLOAT:
return Format::Get(Format::ID::R16G16_FLOAT);
case DXGI_FORMAT_R16G16_SINT:
return Format::Get(Format::ID::R16G16_SINT);
case DXGI_FORMAT_R16G16_SNORM:
return Format::Get(Format::ID::R16G16_SNORM);
case DXGI_FORMAT_R16G16_TYPELESS:
break;
case DXGI_FORMAT_R16G16_UINT:
return Format::Get(Format::ID::R16G16_UINT);
case DXGI_FORMAT_R16G16_UNORM:
return Format::Get(Format::ID::R16G16_UNORM);
case DXGI_FORMAT_R16_FLOAT:
return Format::Get(Format::ID::R16_FLOAT);
case DXGI_FORMAT_R16_SINT:
return Format::Get(Format::ID::R16_SINT);
case DXGI_FORMAT_R16_SNORM:
return Format::Get(Format::ID::R16_SNORM);
case DXGI_FORMAT_R16_TYPELESS:
break;
case DXGI_FORMAT_R16_UINT:
return Format::Get(Format::ID::R16_UINT);
case DXGI_FORMAT_R16_UNORM:
return Format::Get(Format::ID::R16_UNORM);
case DXGI_FORMAT_R1_UNORM:
break;
case DXGI_FORMAT_R24G8_TYPELESS:
break;
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
break;
case DXGI_FORMAT_R32G32B32A32_FLOAT:
return Format::Get(Format::ID::R32G32B32A32_FLOAT);
case DXGI_FORMAT_R32G32B32A32_SINT:
return Format::Get(Format::ID::R32G32B32A32_SINT);
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
break;
case DXGI_FORMAT_R32G32B32A32_UINT:
return Format::Get(Format::ID::R32G32B32A32_UINT);
case DXGI_FORMAT_R32G32B32_FLOAT:
return Format::Get(Format::ID::R32G32B32_FLOAT);
case DXGI_FORMAT_R32G32B32_SINT:
return Format::Get(Format::ID::R32G32B32_SINT);
case DXGI_FORMAT_R32G32B32_TYPELESS:
break;
case DXGI_FORMAT_R32G32B32_UINT:
return Format::Get(Format::ID::R32G32B32_UINT);
case DXGI_FORMAT_R32G32_FLOAT:
return Format::Get(Format::ID::R32G32_FLOAT);
case DXGI_FORMAT_R32G32_SINT:
return Format::Get(Format::ID::R32G32_SINT);
case DXGI_FORMAT_R32G32_TYPELESS:
break;
case DXGI_FORMAT_R32G32_UINT:
return Format::Get(Format::ID::R32G32_UINT);
case DXGI_FORMAT_R32G8X24_TYPELESS:
break;
case DXGI_FORMAT_R32_FLOAT:
return Format::Get(Format::ID::R32_FLOAT);
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
break;
case DXGI_FORMAT_R32_SINT:
return Format::Get(Format::ID::R32_SINT);
case DXGI_FORMAT_R32_TYPELESS:
break;
case DXGI_FORMAT_R32_UINT:
return Format::Get(Format::ID::R32_UINT);
case DXGI_FORMAT_R8G8B8A8_SINT:
return Format::Get(Format::ID::R8G8B8A8_SINT);
case DXGI_FORMAT_R8G8B8A8_SNORM:
return Format::Get(Format::ID::R8G8B8A8_SNORM);
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
break;
case DXGI_FORMAT_R8G8B8A8_UINT:
return Format::Get(Format::ID::R8G8B8A8_UINT);
case DXGI_FORMAT_R8G8B8A8_UNORM:
return Format::Get(Format::ID::R8G8B8A8_UNORM);
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
return Format::Get(Format::ID::R8G8B8A8_UNORM_SRGB);
case DXGI_FORMAT_R8G8_B8G8_UNORM:
break;
case DXGI_FORMAT_R8G8_SINT:
return Format::Get(Format::ID::R8G8_SINT);
case DXGI_FORMAT_R8G8_SNORM:
return Format::Get(Format::ID::R8G8_SNORM);
case DXGI_FORMAT_R8G8_TYPELESS:
break;
case DXGI_FORMAT_R8G8_UINT:
return Format::Get(Format::ID::R8G8_UINT);
case DXGI_FORMAT_R8G8_UNORM:
return Format::Get(Format::ID::R8G8_UNORM);
case DXGI_FORMAT_R8_SINT:
return Format::Get(Format::ID::R8_SINT);
case DXGI_FORMAT_R8_SNORM:
return Format::Get(Format::ID::R8_SNORM);
case DXGI_FORMAT_R8_TYPELESS:
break;
case DXGI_FORMAT_R8_UINT:
return Format::Get(Format::ID::R8_UINT);
case DXGI_FORMAT_R8_UNORM:
return Format::Get(Format::ID::R8_UNORM);
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
return Format::Get(Format::ID::R9G9B9E5_SHAREDEXP);
case DXGI_FORMAT_UNKNOWN:
return Format::Get(Format::ID::NONE);
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
break;
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
break;
case DXGI_FORMAT_Y210:
break;
case DXGI_FORMAT_Y216:
break;
case DXGI_FORMAT_Y410:
break;
case DXGI_FORMAT_Y416:
break;
case DXGI_FORMAT_YUY2:
break;
default:
break;
}
UNREACHABLE();
return Format::Get(Format::ID::NONE);
}
} // namespace d3d11_angle
} // namespace rx
......@@ -26,7 +26,7 @@ namespace d3d11
typedef std::map<DXGI_FORMAT, DXGIFormat> DXGIFormatInfoMap;
DXGIFormat::DXGIFormat() : componentType(GL_NONE), nativeMipmapSupport(NULL)
DXGIFormat::DXGIFormat() : nativeMipmapSupport(NULL)
{
}
......@@ -43,12 +43,10 @@ static bool RequiresFeatureLevel(D3D_FEATURE_LEVEL featureLevel)
void AddDXGIFormat(DXGIFormatInfoMap *map,
DXGI_FORMAT dxgiFormat,
GLenum componentType,
NativeMipmapGenerationSupportFunction nativeMipmapSupport)
{
DXGIFormat info;
info.componentType = componentType;
info.nativeMipmapSupport = nativeMipmapSupport;
map->insert(std::make_pair(dxgiFormat, info));
......@@ -60,97 +58,97 @@ static DXGIFormatInfoMap BuildDXGIFormatInfoMap()
DXGIFormatInfoMap map;
// clang-format off
// | DXGI format | Component Type | Color read function | Native mipmap function
AddDXGIFormat(&map, DXGI_FORMAT_UNKNOWN, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_A8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_B8G8R8A8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8_SNORM, GL_SIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16_SNORM, GL_SIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SNORM, GL_SIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SNORM, GL_SIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SNORM, GL_SIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SNORM, GL_SIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_SINT, GL_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_FLOAT, GL_FLOAT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_3>);
AddDXGIFormat(&map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, GL_FLOAT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R11G11B10_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R8_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R24G8_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G8X24_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, GL_NONE, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D24_UNORM_S8_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, GL_UNSIGNED_INT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT, GL_FLOAT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_BC1_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_BC2_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_BC3_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
// | DXGI format | Native mipmap function
AddDXGIFormat(&map, DXGI_FORMAT_UNKNOWN, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_A8_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R8_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_B8G8R8A8_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8_SNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16_SNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_SINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_FLOAT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_3>);
AddDXGIFormat(&map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R11G11B10_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
AddDXGIFormat(&map, DXGI_FORMAT_R8_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R24G8_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32G8X24_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D16_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D24_UNORM_S8_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_BC1_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_BC2_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_BC3_UNORM, NeverSupported);
// B5G6R5 in D3D11 is treated the same as R5G6B5 in D3D9, so reuse the R5G6B5 functions used by the D3D9 renderer.
// The same applies to B4G4R4A4 and B5G5R5A1 with A4R4G4B4 and A1R5G5B5 respectively.
AddDXGIFormat(&map, DXGI_FORMAT_B5G6R5_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_B4G4R4A4_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_B5G5R5A1_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_B5G6R5_UNORM, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
AddDXGIFormat(&map, DXGI_FORMAT_B4G4R4A4_UNORM, NeverSupported);
AddDXGIFormat(&map, DXGI_FORMAT_B5G5R5A1_UNORM, NeverSupported);
// clang-format on
return map;
......
......@@ -31,8 +31,6 @@ struct DXGIFormat
{
DXGIFormat();
GLenum componentType;
NativeMipmapGenerationSupportFunction nativeMipmapSupport;
};
......@@ -66,6 +64,9 @@ struct VertexFormat
const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType,
D3D_FEATURE_LEVEL featureLevel);
// Auto-generated in dxgi_format_map_autogen.cpp.
GLenum GetComponentType(DXGI_FORMAT dxgiFormat);
} // namespace d3d11
} // namespace rx
......
#!/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_dxgi_format_table.py:
# Code generation for DXGI format map.
from datetime import date
import sys
sys.path.append('../..')
import angle_format
template_cpp = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
// 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.
//
// DXGI format info:
// Determining metadata about a DXGI format.
#include "libANGLE/renderer/Format.h"
using namespace angle;
namespace rx
{{
namespace d3d11
{{
GLenum GetComponentType(DXGI_FORMAT dxgiFormat)
{{
switch (dxgiFormat)
{{
{component_type_cases} default:
break;
}}
UNREACHABLE();
return GL_NONE;
}}
}} // namespace d3d11
namespace d3d11_angle
{{
const Format &GetFormat(DXGI_FORMAT dxgiFormat)
{{
switch (dxgiFormat)
{{
{format_cases} default:
break;
}}
UNREACHABLE();
return Format::Get(Format::ID::NONE);
}}
}} // namespace d3d11_angle
}} // namespace rx
"""
template_format_case = """ case DXGI_FORMAT_{dxgi_format}:
return {result};
"""
template_undefined_case = """ case DXGI_FORMAT_{dxgi_format}:
break;
"""
def format_case(dxgi_format, result):
return template_format_case.format(
dxgi_format = dxgi_format,
result = result)
def undefined_case(dxgi_format):
return template_undefined_case.format(dxgi_format = dxgi_format)
component_cases = ""
format_cases = ""
input_data = 'dxgi_format_data.json'
dxgi_map = angle_format.load_json(input_data)
types = {
'SNORM': 'GL_SIGNED_NORMALIZED',
'UNORM': 'GL_UNSIGNED_NORMALIZED',
'SINT': 'GL_INT',
'UINT': 'GL_UNSIGNED_INT',
'FLOAT': 'GL_FLOAT',
'SHAREDEXP': 'GL_FLOAT'
}
angle_to_gl = angle_format.load_inverse_table('../../angle_format_map.json')
all_angle = angle_to_gl.keys()
for dxgi_format, angle_format in sorted(dxgi_map.iteritems()):
found = [ctype in dxgi_format for ctype in types.keys()]
count = reduce((lambda a, b: int(a) + int(b)), found)
component_type = 'GL_NONE'
if count == 1:
gltype = next(gltype for ctype, gltype in types.iteritems() if ctype in dxgi_format)
component_cases += format_case(dxgi_format, gltype)
else:
component_cases += undefined_case(dxgi_format)
if angle_format == "":
angle_format = dxgi_format
if angle_format in all_angle:
angle_format = "Format::Get(Format::ID::" + angle_format + ")"
format_cases += format_case(dxgi_format, angle_format)
else:
format_cases += undefined_case(dxgi_format)
with open('dxgi_format_map_autogen.cpp', 'wt') as out_file:
output_cpp = template_cpp.format(
script_name = sys.argv[0],
data_source_name = input_data,
copyright_year = date.today().year,
component_type_cases = component_cases,
format_cases = format_cases)
out_file.write(output_cpp)
out_file.close()
......@@ -67,7 +67,7 @@ const Format &Format::Get(ID id)
}}
// clang-format on
static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr, 0, 0, 0, 0, 0, 0);
static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0);
return noneInfo;
}}
......@@ -129,6 +129,7 @@ format_entry_template = """{space}{{
{space} {fboImplementationInternalFormat},
{space} {mipGenerationFunction},
{space} {colorReadFunction},
{space} {namedComponentType},
{space} {R}, {G}, {B}, {A}, {D}, {S});
{space} return info;
{space}}}
......@@ -175,6 +176,22 @@ def get_bits(format_id):
bits[token[0]] = int(token[1:])
return bits
def get_named_component_type(component_type):
if component_type == "snorm":
return "GL_SIGNED_NORMALIZED"
elif component_type == "unorm":
return "GL_UNSIGNED_NORMALIZED"
elif component_type == "float":
return "GL_FLOAT"
elif component_type == "uint":
return "GL_UNSIGNED_INT"
elif component_type == "int":
return "GL_INT"
elif component_type == "none":
return "GL_NONE"
else:
raise ValueError("Unknown component type for " + component_type)
def json_to_table_data(format_id, json, angle_to_gl):
table_data = ""
......@@ -212,6 +229,8 @@ def json_to_table_data(format_id, json, angle_to_gl):
else:
parsed[channel] = "0"
parsed["namedComponentType"] = get_named_component_type(parsed["componentType"])
return format_entry_template.format(**parsed)
def parse_json_into_angle_format_switch_string(all_angle, json_data, angle_to_gl):
......
......@@ -330,6 +330,7 @@
'libANGLE/renderer/d3d/d3d11/copyvertex.inl',
'libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp',
'libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h',
'libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp',
'libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp',
'libANGLE/renderer/d3d/d3d11/dxgi_support_table.h',
'libANGLE/renderer/d3d/d3d11/Fence11.cpp',
......
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