Commit b7fe49db by Jamie Madill Committed by Commit Bot

D3D11: Fold mipmap gen caps into the support table.

This change is two-fold: first it allows us to remove the std::map for D3D11 format info, which was only being used in a single place. Secondly, it fixed the support table to use the correct 9_3 caps for texture support, determined by running the D3D11FormatTablesTest. This should reduce the number of format queries we need to run on 9_3 startup. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: I2435a47fc221e73c96337bc7c1c4ed37b527bc1f Reviewed-on: https://chromium-review.googlesource.com/392210Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent e0548ad2
...@@ -110,9 +110,7 @@ DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat, ...@@ -110,9 +110,7 @@ DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat,
const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps); const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
if (renderTarget && levels > 1) if (renderTarget && levels > 1)
{ {
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(formatInfo.texFormat); if (d3d11::SupportsMipGen(formatInfo.texFormat, renderer11DeviceCaps.featureLevel))
if (dxgiFormatInfo.nativeMipmapSupport(renderer11DeviceCaps.featureLevel))
{ {
miscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS; miscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/d3d11/copyvertex.h" #include "libANGLE/renderer/d3d/d3d11/copyvertex.h"
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
...@@ -24,149 +25,11 @@ namespace rx ...@@ -24,149 +25,11 @@ namespace rx
namespace d3d11 namespace d3d11
{ {
typedef std::map<DXGI_FORMAT, DXGIFormat> DXGIFormatInfoMap; bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
DXGIFormat::DXGIFormat() : nativeMipmapSupport(NULL)
{
}
static bool NeverSupported(D3D_FEATURE_LEVEL)
{
return false;
}
template <D3D_FEATURE_LEVEL requiredFeatureLevel>
static bool RequiresFeatureLevel(D3D_FEATURE_LEVEL featureLevel)
{
return featureLevel >= requiredFeatureLevel;
}
void AddDXGIFormat(DXGIFormatInfoMap *map,
DXGI_FORMAT dxgiFormat,
NativeMipmapGenerationSupportFunction nativeMipmapSupport)
{
DXGIFormat info;
info.nativeMipmapSupport = nativeMipmapSupport;
map->insert(std::make_pair(dxgiFormat, info));
}
// A map to determine the color read function and mipmap generation function of a given DXGI format
static DXGIFormatInfoMap BuildDXGIFormatInfoMap()
{
DXGIFormatInfoMap map;
// clang-format off
// | 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, 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;
}
const DXGIFormat &GetDXGIFormatInfo(DXGI_FORMAT format)
{ {
static const DXGIFormatInfoMap infoMap = BuildDXGIFormatInfoMap(); const auto &support = GetDXGISupport(dxgiFormat, featureLevel);
DXGIFormatInfoMap::const_iterator iter = infoMap.find(format); ASSERT((support.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) == 0);
if (iter != infoMap.end()) return ((support.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
{
return iter->second;
}
else
{
static DXGIFormat defaultInfo;
return defaultInfo;
}
} }
DXGIFormatSize::DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight) DXGIFormatSize::DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight)
......
...@@ -25,20 +25,11 @@ struct Renderer11DeviceCaps; ...@@ -25,20 +25,11 @@ struct Renderer11DeviceCaps;
namespace d3d11 namespace d3d11
{ {
typedef bool (*NativeMipmapGenerationSupportFunction)(D3D_FEATURE_LEVEL); // A texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components,
struct DXGIFormat
{
DXGIFormat();
NativeMipmapGenerationSupportFunction nativeMipmapSupport;
};
// This structure is problematic because a resource is associated with multiple DXGI formats.
// For example, a texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components,
// which are accessed through an DXGI_FORMAT_R16_SINT view. It's easy to write code which queries // which are accessed through an DXGI_FORMAT_R16_SINT view. It's easy to write code which queries
// information about the wrong format. Therefore, use of this should be avoided where possible. // information about the wrong format. Therefore, use of this should be avoided where possible.
const DXGIFormat &GetDXGIFormatInfo(DXGI_FORMAT format);
bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel);
struct DXGIFormatSize struct DXGIFormatSize
{ {
......
...@@ -46,25 +46,38 @@ namespace d3d11 ...@@ -46,25 +46,38 @@ namespace d3d11
#define {prefix}RT D3D11_FORMAT_SUPPORT_RENDER_TARGET #define {prefix}RT D3D11_FORMAT_SUPPORT_RENDER_TARGET
#define {prefix}MS D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET #define {prefix}MS D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET
#define {prefix}DS D3D11_FORMAT_SUPPORT_DEPTH_STENCIL #define {prefix}DS D3D11_FORMAT_SUPPORT_DEPTH_STENCIL
#define {prefix}MIPGEN D3D11_FORMAT_SUPPORT_MIP_AUTOGEN
namespace namespace
{{ {{
const DXGISupport &GetDefaultSupport() const DXGISupport &GetDefaultSupport()
{{ {{
static UINT AllSupportFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D | static UINT AllSupportFlags =
D3D11_FORMAT_SUPPORT_TEXTURE3D | D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURE3D |
D3D11_FORMAT_SUPPORT_TEXTURECUBE | D3D11_FORMAT_SUPPORT_TEXTURECUBE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE |
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE | D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_DEPTH_STENCIL | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN;
D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
D3D11_FORMAT_SUPPORT_DEPTH_STENCIL;
static const DXGISupport defaultSupport(0, 0, AllSupportFlags); static const DXGISupport defaultSupport(0, 0, AllSupportFlags);
return defaultSupport; return defaultSupport;
}} }}
const DXGISupport &GetDXGISupport_9_3(DXGI_FORMAT dxgiFormat)
{{
// clang-format off
switch (dxgiFormat)
{{
{table_data_9_3}
default:
UNREACHABLE();
return GetDefaultSupport();
}}
// clang-format on
}}
const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat) const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
{{ {{
// clang-format off
switch (dxgiFormat) switch (dxgiFormat)
{{ {{
{table_data_10_0} {table_data_10_0}
...@@ -72,10 +85,12 @@ const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat) ...@@ -72,10 +85,12 @@ const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
UNREACHABLE(); UNREACHABLE();
return GetDefaultSupport(); return GetDefaultSupport();
}} }}
// clang-format on
}} }}
const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat) const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
{{ {{
// clang-format off
switch (dxgiFormat) switch (dxgiFormat)
{{ {{
{table_data_10_1} {table_data_10_1}
...@@ -83,10 +98,12 @@ const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat) ...@@ -83,10 +98,12 @@ const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
UNREACHABLE(); UNREACHABLE();
return GetDefaultSupport(); return GetDefaultSupport();
}} }}
// clang-format on
}} }}
const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat) const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
{{ {{
// clang-format off
switch (dxgiFormat) switch (dxgiFormat)
{{ {{
{table_data_11_0} {table_data_11_0}
...@@ -94,6 +111,7 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat) ...@@ -94,6 +111,7 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
UNREACHABLE(); UNREACHABLE();
return GetDefaultSupport(); return GetDefaultSupport();
}} }}
// clang-format on
}} }}
}} }}
...@@ -105,11 +123,14 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat) ...@@ -105,11 +123,14 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
#undef {prefix}RT #undef {prefix}RT
#undef {prefix}MS #undef {prefix}MS
#undef {prefix}DS #undef {prefix}DS
#undef {prefix}MIPGEN
const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel) const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
{{ {{
switch (featureLevel) switch (featureLevel)
{{ {{
case D3D_FEATURE_LEVEL_9_3:
return GetDXGISupport_9_3(dxgiFormat);
case D3D_FEATURE_LEVEL_10_0: case D3D_FEATURE_LEVEL_10_0:
return GetDXGISupport_10_0(dxgiFormat); return GetDXGISupport_10_0(dxgiFormat);
case D3D_FEATURE_LEVEL_10_1: case D3D_FEATURE_LEVEL_10_1:
...@@ -129,7 +150,7 @@ const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL feat ...@@ -129,7 +150,7 @@ const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL feat
table_init = "" table_init = ""
def do_format(format_data): def do_format(format_data):
table_data = {'10_0': '', '10_1': '', '11_0': ''} table_data = {'9_3': '', '10_0': '', '10_1': '', '11_0': ''}
json_flag_to_d3d = { json_flag_to_d3d = {
'texture2D': macro_prefix + '2D', 'texture2D': macro_prefix + '2D',
...@@ -138,7 +159,8 @@ def do_format(format_data): ...@@ -138,7 +159,8 @@ def do_format(format_data):
'shaderSample': macro_prefix + 'SAMPLE', 'shaderSample': macro_prefix + 'SAMPLE',
'renderTarget': macro_prefix + 'RT', 'renderTarget': macro_prefix + 'RT',
'multisampleRT': macro_prefix + 'MS', 'multisampleRT': macro_prefix + 'MS',
'depthStencil': macro_prefix + 'DS' 'depthStencil': macro_prefix + 'DS',
'mipAutoGen': macro_prefix + 'MIPGEN'
} }
for format_name, format_support in sorted(format_data.iteritems()): for format_name, format_support in sorted(format_data.iteritems()):
...@@ -146,6 +168,9 @@ def do_format(format_data): ...@@ -146,6 +168,9 @@ def do_format(format_data):
always_supported = set() always_supported = set()
never_supported = set() never_supported = set()
optionally_supported = set() optionally_supported = set()
fl_9_3_supported = set()
fl_9_3_check = set()
fl_10_0_supported = set()
fl_10_1_supported = set() fl_10_1_supported = set()
fl_11_0_supported = set() fl_11_0_supported = set()
fl_11_0_check = set() fl_11_0_check = set()
...@@ -163,8 +188,7 @@ def do_format(format_data): ...@@ -163,8 +188,7 @@ def do_format(format_data):
elif support == 'never': elif support == 'never':
never_supported.update(d3d_flag) never_supported.update(d3d_flag)
elif support == '10_0': elif support == '10_0':
# TODO(jmadill): FL 9_3 handling fl_10_0_supported.update(d3d_flag)
always_supported.update(d3d_flag)
elif support == '10_1': elif support == '10_1':
fl_10_1_supported.update(d3d_flag) fl_10_1_supported.update(d3d_flag)
elif support == '11_0': elif support == '11_0':
...@@ -181,21 +205,33 @@ def do_format(format_data): ...@@ -181,21 +205,33 @@ def do_format(format_data):
fl_10_0_check_11_0_supported.update(d3d_flag) fl_10_0_check_11_0_supported.update(d3d_flag)
elif support == '11_0check': elif support == '11_0check':
fl_11_0_check.update(d3d_flag) fl_11_0_check.update(d3d_flag)
elif support == '9_3always_10_0check11_0always':
fl_9_3_supported.update(d3d_flag)
fl_10_0_check_11_0_supported.update(d3d_flag)
elif support == '9_3check_10_0always':
fl_9_3_check.update(d3d_flag)
fl_10_0_supported.update(d3d_flag)
else: else:
print("Data specification error: " + support) print("Data specification error: " + support)
sys.exit(1) sys.exit(1)
for feature_level in ['10_0', '10_1', '11_0']: for feature_level in ['9_3', '10_0', '10_1', '11_0']:
always_for_fl = always_supported always_for_fl = always_supported
optional_for_fl = optionally_supported optional_for_fl = optionally_supported
if feature_level == '10_0': if feature_level == '9_3':
always_for_fl = fl_9_3_supported.union(always_for_fl)
optional_for_fl = fl_9_3_check.union(optional_for_fl)
elif feature_level == '10_0':
always_for_fl = fl_10_0_supported.union(always_for_fl)
optional_for_fl = fl_10_0_check_10_1_supported.union(optional_for_fl) optional_for_fl = fl_10_0_check_10_1_supported.union(optional_for_fl)
optional_for_fl = fl_10_0_check_11_0_supported.union(optional_for_fl) optional_for_fl = fl_10_0_check_11_0_supported.union(optional_for_fl)
if feature_level == '10_1': elif feature_level == '10_1':
always_for_fl = fl_10_0_supported.union(always_for_fl)
always_for_fl = fl_10_1_supported.union(always_for_fl) always_for_fl = fl_10_1_supported.union(always_for_fl)
always_for_fl = fl_10_0_check_10_1_supported.union(always_for_fl) always_for_fl = fl_10_0_check_10_1_supported.union(always_for_fl)
optional_for_fl = fl_10_0_check_11_0_supported.union(optional_for_fl) optional_for_fl = fl_10_0_check_11_0_supported.union(optional_for_fl)
elif feature_level == '11_0': elif feature_level == '11_0':
always_for_fl = fl_10_0_supported.union(always_for_fl)
always_for_fl = fl_10_0_check_10_1_supported.union(always_for_fl) always_for_fl = fl_10_0_check_10_1_supported.union(always_for_fl)
always_for_fl = fl_10_0_check_11_0_supported.union(always_for_fl) always_for_fl = fl_10_0_check_11_0_supported.union(always_for_fl)
always_for_fl = fl_10_1_supported.union(always_for_fl) always_for_fl = fl_10_1_supported.union(always_for_fl)
...@@ -218,7 +254,8 @@ def do_format(format_data): ...@@ -218,7 +254,8 @@ def do_format(format_data):
return table_data return table_data
def join_table_data(table_data_1, table_data_2): def join_table_data(table_data_1, table_data_2):
return {'10_0': table_data_1['10_0'] + table_data_2['10_0'], return {'9_3': table_data_1['9_3'] + table_data_2['9_3'],
'10_0': table_data_1['10_0'] + table_data_2['10_0'],
'10_1': table_data_1['10_1'] + table_data_2['10_1'], '10_1': table_data_1['10_1'] + table_data_2['10_1'],
'11_0': table_data_1['11_0'] + table_data_2['11_0']} '11_0': table_data_1['11_0'] + table_data_2['11_0']}
...@@ -227,12 +264,13 @@ with open('dxgi_support_data.json') as dxgi_file: ...@@ -227,12 +264,13 @@ with open('dxgi_support_data.json') as dxgi_file:
dxgi_file.close() dxgi_file.close()
json_data = json.loads(file_data) json_data = json.loads(file_data)
table_data = {'10_0': '', '10_1': '', '11_0': ''} table_data = {'9_3': '', '10_0': '', '10_1': '', '11_0': ''}
for format_data in json_data: for format_data in json_data:
table_data = join_table_data(table_data, do_format(format_data)) table_data = join_table_data(table_data, do_format(format_data))
out_data = template.format(prefix=macro_prefix, out_data = template.format(prefix=macro_prefix,
table_data_9_3=table_data['9_3'],
table_data_10_0=table_data['10_0'], table_data_10_0=table_data['10_0'],
table_data_10_1=table_data['10_1'], table_data_10_1=table_data['10_1'],
table_data_11_0=table_data['11_0']) table_data_11_0=table_data['11_0'])
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/d3d11/Context11.h" #include "libANGLE/renderer/d3d/d3d11/Context11.h"
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h" #include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h" #include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
...@@ -65,13 +66,22 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -65,13 +66,22 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
} }
} }
UINT texSupport; UINT texSupport = 0;
bool texSuccess = SUCCEEDED(device->CheckFormatSupport(formatInfo.texFormat, &texSupport)); bool texSuccess = SUCCEEDED(device->CheckFormatSupport(formatInfo.texFormat, &texSupport));
bool textureable = texSuccess && ((texSupport & texSupportMask) == texSupportMask); bool textureable = texSuccess && ((texSupport & texSupportMask) == texSupportMask);
EXPECT_EQ(textureable, textureInfo.texturable); EXPECT_EQ(textureable, textureInfo.texturable);
// Bits for mipmap auto-gen.
bool expectedMipGen = texSuccess && ((texSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
auto featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
const auto &dxgiSupport = rx::d3d11::GetDXGISupport(formatInfo.texFormat, featureLevel);
bool actualMipGen =
((dxgiSupport.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
EXPECT_EQ(0u, dxgiSupport.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN);
EXPECT_EQ(expectedMipGen, actualMipGen);
// Bits for filtering // Bits for filtering
UINT filterSupport; UINT filterSupport = 0;
bool filterSuccess = bool filterSuccess =
SUCCEEDED(device->CheckFormatSupport(formatInfo.srvFormat, &filterSupport)); SUCCEEDED(device->CheckFormatSupport(formatInfo.srvFormat, &filterSupport));
bool filterable = filterSuccess && ((filterSupport & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) != 0); bool filterable = filterSuccess && ((filterSupport & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) != 0);
......
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