Commit 7b62cf97 by Jamie Madill Committed by Commit Bot

Refactor TextureFormatMap to store an array.

std::map lookups are already showing up as a hot spot during some profile trace analysis. We can elimintate these by only doing a single switch at the entry point level to convert the GL internal format to an internal identifier or type info pointer. This change doesn't completely fix the hot spot, since now we are doing multiple switch statements, but it does remove the std::map storage in TextureCapsMap. It replaces it with a flat std::array indexed by angle::Format::ID, and gives us the option in the future to eliminate all by one switch statement. This should allow for a faster texture caps implementation in Vulkan. This also fixes the missing ANGLE format entries for ETC1 compressed formats. BUG=angleproject:2207 Change-Id: I74ea2082e582a6790d5fde90e33246a618a2da0e Reviewed-on: https://chromium-review.googlesource.com/742375 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 0741c0f1
...@@ -84,59 +84,55 @@ TextureCaps GenerateMinimumTextureCaps(GLenum sizedInternalFormat, ...@@ -84,59 +84,55 @@ TextureCaps GenerateMinimumTextureCaps(GLenum sizedInternalFormat,
return caps; return caps;
} }
void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps) TextureCapsMap::TextureCapsMap()
{ {
mCapsMap[internalFormat] = caps;
} }
void TextureCapsMap::remove(GLenum internalFormat) TextureCapsMap::~TextureCapsMap()
{ {
InternalFormatToCapsMap::iterator i = mCapsMap.find(internalFormat); }
if (i != mCapsMap.end())
{ void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
mCapsMap.erase(i); {
} angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat);
get(formatID) = caps;
} }
void TextureCapsMap::clear() void TextureCapsMap::clear()
{ {
mCapsMap.clear(); mFormatData.fill(TextureCaps());
} }
const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const
{ {
static TextureCaps defaultUnsupportedTexture; angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat);
InternalFormatToCapsMap::const_iterator iter = mCapsMap.find(internalFormat); return get(formatID);
return (iter != mCapsMap.end()) ? iter->second : defaultUnsupportedTexture;
} }
TextureCapsMap::const_iterator TextureCapsMap::begin() const const TextureCaps &TextureCapsMap::get(angle::Format::ID formatID) const
{ {
return mCapsMap.begin(); return mFormatData[static_cast<size_t>(formatID)];
} }
TextureCapsMap::const_iterator TextureCapsMap::end() const TextureCaps &TextureCapsMap::get(angle::Format::ID formatID)
{ {
return mCapsMap.end(); return mFormatData[static_cast<size_t>(formatID)];
} }
size_t TextureCapsMap::size() const void TextureCapsMap::set(angle::Format::ID formatID, const TextureCaps &caps)
{ {
return mCapsMap.size(); get(formatID) = caps;
} }
TextureCapsMap GenerateMinimumTextureCapsMap(const Version &clientVersion, void InitMinimumTextureCapsMap(const Version &clientVersion,
const Extensions &extensions) const Extensions &extensions,
TextureCapsMap *capsMap)
{ {
TextureCapsMap capsMap;
for (GLenum internalFormat : GetAllSizedInternalFormats()) for (GLenum internalFormat : GetAllSizedInternalFormats())
{ {
capsMap.insert(internalFormat, capsMap->insert(internalFormat,
GenerateMinimumTextureCaps(internalFormat, clientVersion, extensions)); GenerateMinimumTextureCaps(internalFormat, clientVersion, extensions));
} }
return capsMap;
} }
Extensions::Extensions() Extensions::Extensions()
......
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
#define LIBANGLE_CAPS_H_ #define LIBANGLE_CAPS_H_
#include "angle_gl.h" #include "angle_gl.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/Version.h" #include "libANGLE/Version.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/Format.h"
#include <map> #include <map>
#include <set> #include <set>
...@@ -52,29 +53,32 @@ TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat, ...@@ -52,29 +53,32 @@ TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
const Version &clientVersion, const Version &clientVersion,
const Extensions &extensions); const Extensions &extensions);
class TextureCapsMap class TextureCapsMap final : angle::NonCopyable
{ {
public: public:
typedef std::map<GLenum, TextureCaps>::const_iterator const_iterator; TextureCapsMap();
~TextureCapsMap();
// These methods are deprecated. Please use angle::Format for new features.
void insert(GLenum internalFormat, const TextureCaps &caps); void insert(GLenum internalFormat, const TextureCaps &caps);
void remove(GLenum internalFormat);
void clear();
const TextureCaps &get(GLenum internalFormat) const; const TextureCaps &get(GLenum internalFormat) const;
const_iterator begin() const; void clear();
const_iterator end() const;
size_t size() const; // Prefer using angle::Format methods.
const TextureCaps &get(angle::Format::ID formatID) const;
void set(angle::Format::ID formatID, const TextureCaps &caps);
private: private:
typedef std::map<GLenum, TextureCaps> InternalFormatToCapsMap; TextureCaps &get(angle::Format::ID formatID);
InternalFormatToCapsMap mCapsMap;
// Indexed by angle::Format::ID
std::array<TextureCaps, angle::kNumANGLEFormats> mFormatData;
}; };
TextureCapsMap GenerateMinimumTextureCapsMap(const Version &clientVersion, void InitMinimumTextureCapsMap(const Version &clientVersion,
const Extensions &extensions); const Extensions &extensions,
TextureCapsMap *capsMap);
struct Extensions struct Extensions
{ {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "libANGLE/queryutils.h" #include "libANGLE/queryutils.h"
#include "libANGLE/renderer/ContextImpl.h" #include "libANGLE/renderer/ContextImpl.h"
#include "libANGLE/renderer/EGLImplFactory.h" #include "libANGLE/renderer/EGLImplFactory.h"
#include "libANGLE/renderer/Format.h"
#include "libANGLE/validationES.h" #include "libANGLE/validationES.h"
namespace namespace
...@@ -2738,11 +2739,9 @@ void Context::updateCaps() ...@@ -2738,11 +2739,9 @@ void Context::updateCaps()
mCaps.compressedTextureFormats.clear(); mCaps.compressedTextureFormats.clear();
mTextureCaps.clear(); mTextureCaps.clear();
for (auto capsIt : mImplementation->getNativeTextureCaps()) for (GLenum sizedInternalFormat : GetAllSizedInternalFormats())
{ {
GLenum sizedInternalFormat = capsIt.first; TextureCaps formatCaps = mImplementation->getNativeTextureCaps().get(sizedInternalFormat);
TextureCaps formatCaps = capsIt.second;
const InternalFormat &formatInfo = GetSizedInternalFormatInfo(sizedInternalFormat); const InternalFormat &formatInfo = GetSizedInternalFormatInfo(sizedInternalFormat);
// Update the format caps based on the client version and extensions. // Update the format caps based on the client version and extensions.
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#ifndef LIBANGLE_RENDERER_FORMAT_H_ #ifndef LIBANGLE_RENDERER_FORMAT_H_
#define LIBANGLE_RENDERER_FORMAT_H_ #define LIBANGLE_RENDERER_FORMAT_H_
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/renderer_utils.h" #include "libANGLE/renderer/renderer_utils.h"
namespace angle namespace angle
......
...@@ -67,6 +67,8 @@ enum class Format::ID ...@@ -67,6 +67,8 @@ enum class Format::ID
EAC_R11G11_UNORM_BLOCK, EAC_R11G11_UNORM_BLOCK,
EAC_R11_SNORM_BLOCK, EAC_R11_SNORM_BLOCK,
EAC_R11_UNORM_BLOCK, EAC_R11_UNORM_BLOCK,
ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK,
ETC1_R8G8B8_UNORM_BLOCK,
ETC2_R8G8B8A1_SRGB_BLOCK, ETC2_R8G8B8A1_SRGB_BLOCK,
ETC2_R8G8B8A1_UNORM_BLOCK, ETC2_R8G8B8A1_UNORM_BLOCK,
ETC2_R8G8B8A8_SRGB_BLOCK, ETC2_R8G8B8A8_SRGB_BLOCK,
...@@ -139,6 +141,6 @@ enum class Format::ID ...@@ -139,6 +141,6 @@ enum class Format::ID
S8_UINT S8_UINT
}; };
constexpr uint32_t kNumANGLEFormats = 125; constexpr uint32_t kNumANGLEFormats = 127;
} // namespace angle } // namespace angle
...@@ -79,6 +79,8 @@ constexpr Format g_formatInfoTable[] = { ...@@ -79,6 +79,8 @@ constexpr Format g_formatInfoTable[] = {
{ Format::ID::EAC_R11G11_UNORM_BLOCK, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0 }, { Format::ID::EAC_R11G11_UNORM_BLOCK, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0 },
{ Format::ID::EAC_R11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 }, { Format::ID::EAC_R11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 },
{ Format::ID::EAC_R11_UNORM_BLOCK, GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 }, { Format::ID::EAC_R11_UNORM_BLOCK, GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 },
{ Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 },
{ Format::ID::ETC1_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_OES, GL_ETC1_RGB8_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 },
{ Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 }, { Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 },
{ Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 }, { Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 },
{ Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, { Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
...@@ -160,7 +162,7 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat) ...@@ -160,7 +162,7 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
case GL_RGBA16_EXT: case GL_RGBA16_EXT:
return Format::ID::R16G16B16A16_UNORM; return Format::ID::R16G16B16A16_UNORM;
case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE: case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
return Format::ID::NONE; return Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK;
case GL_RG8I: case GL_RG8I:
return Format::ID::R8G8_SINT; return Format::ID::R8G8_SINT;
case GL_R16F: case GL_R16F:
...@@ -338,7 +340,7 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat) ...@@ -338,7 +340,7 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
case GL_RGBA: case GL_RGBA:
return Format::ID::R8G8B8A8_UNORM; return Format::ID::R8G8B8A8_UNORM;
case GL_ETC1_RGB8_OES: case GL_ETC1_RGB8_OES:
return Format::ID::NONE; return Format::ID::ETC1_R8G8B8_UNORM_BLOCK;
case GL_DEPTH24_STENCIL8: case GL_DEPTH24_STENCIL8:
return Format::ID::D24_UNORM_S8_UINT; return Format::ID::D24_UNORM_S8_UINT;
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
......
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
[ "GL_DEPTH_COMPONENT24", "D24_UNORM" ], [ "GL_DEPTH_COMPONENT24", "D24_UNORM" ],
[ "GL_DEPTH_COMPONENT32F", "D32_FLOAT" ], [ "GL_DEPTH_COMPONENT32F", "D32_FLOAT" ],
[ "GL_DEPTH_COMPONENT32_OES", "D32_UNORM" ], [ "GL_DEPTH_COMPONENT32_OES", "D32_UNORM" ],
[ "GL_ETC1_RGB8_OES", "NONE" ], [ "GL_ETC1_RGB8_OES", "ETC1_R8G8B8_UNORM_BLOCK" ],
[ "GL_ETC1_RGB8_LOSSY_DECODE_ANGLE", "NONE" ], [ "GL_ETC1_RGB8_LOSSY_DECODE_ANGLE", "ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK" ],
[ "GL_LUMINANCE16F_EXT", "L16_FLOAT" ], [ "GL_LUMINANCE16F_EXT", "L16_FLOAT" ],
[ "GL_LUMINANCE32F_EXT", "L32_FLOAT" ], [ "GL_LUMINANCE32F_EXT", "L32_FLOAT" ],
[ "GL_LUMINANCE8_ALPHA8_EXT", "L8A8_UNORM" ], [ "GL_LUMINANCE8_ALPHA8_EXT", "L8A8_UNORM" ],
......
...@@ -88,7 +88,7 @@ ContextNULL::ContextNULL(const gl::ContextState &state, AllocationTrackerNULL *a ...@@ -88,7 +88,7 @@ ContextNULL::ContextNULL(const gl::ContextState &state, AllocationTrackerNULL *a
const gl::Version maxClientVersion(3, 1); const gl::Version maxClientVersion(3, 1);
mCaps = GenerateMinimumCaps(maxClientVersion, mExtensions); mCaps = GenerateMinimumCaps(maxClientVersion, mExtensions);
mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions); InitMinimumTextureCapsMap(maxClientVersion, mExtensions, &mTextureCaps);
} }
ContextNULL::~ContextNULL() ContextNULL::~ContextNULL()
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "libANGLE/renderer/vulkan/formatutilsvk.h" #include "libANGLE/renderer/vulkan/formatutilsvk.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/load_functions_table.h" #include "libANGLE/renderer/load_functions_table.h"
namespace rx namespace rx
......
...@@ -442,6 +442,14 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an ...@@ -442,6 +442,14 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break; break;
} }
case angle::Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::ETC1_R8G8B8_UNORM_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK: case angle::Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK:
{ {
internalFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2; internalFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
......
...@@ -70,7 +70,7 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -70,7 +70,7 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
UINT texSupport = 0; 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) << "for 0x" << std::hex << internalFormat;
// Bits for mipmap auto-gen. // Bits for mipmap auto-gen.
bool expectedMipGen = texSuccess && ((texSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0); bool expectedMipGen = texSuccess && ((texSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
...@@ -78,15 +78,16 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -78,15 +78,16 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
const auto &dxgiSupport = rx::d3d11::GetDXGISupport(formatInfo.texFormat, featureLevel); const auto &dxgiSupport = rx::d3d11::GetDXGISupport(formatInfo.texFormat, featureLevel);
bool actualMipGen = bool actualMipGen =
((dxgiSupport.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0); ((dxgiSupport.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
EXPECT_EQ(0u, dxgiSupport.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN); EXPECT_EQ(0u, dxgiSupport.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN)
EXPECT_EQ(expectedMipGen, actualMipGen); << "for 0x" << std::hex << internalFormat;
EXPECT_EQ(expectedMipGen, actualMipGen) << "for 0x" << std::hex << internalFormat;
// Bits for filtering // Bits for filtering
UINT filterSupport = 0; 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);
EXPECT_EQ(filterable, textureInfo.filterable); EXPECT_EQ(filterable, textureInfo.filterable) << "for 0x" << std::hex << internalFormat;
// Bits for renderable // Bits for renderable
bool renderable = false; bool renderable = false;
...@@ -101,7 +102,8 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -101,7 +102,8 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
depthSuccess && ((renderSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL) != 0); depthSuccess && ((renderSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL) != 0);
if (renderable) if (renderable)
{ {
EXPECT_NE(DXGI_FORMAT_UNKNOWN, formatInfo.dsvFormat); EXPECT_NE(DXGI_FORMAT_UNKNOWN, formatInfo.dsvFormat)
<< "for 0x" << std::hex << internalFormat;
} }
} }
else else
...@@ -112,13 +114,14 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -112,13 +114,14 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
renderable = rtSuccess && ((renderSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0); renderable = rtSuccess && ((renderSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0);
if (renderable) if (renderable)
{ {
EXPECT_NE(DXGI_FORMAT_UNKNOWN, formatInfo.rtvFormat); EXPECT_NE(DXGI_FORMAT_UNKNOWN, formatInfo.rtvFormat)
<< "for 0x" << std::hex << internalFormat;
} }
} }
EXPECT_EQ(renderable, textureInfo.renderable); EXPECT_EQ(renderable, textureInfo.renderable) << "for 0x" << std::hex << internalFormat;
if (!textureInfo.sampleCounts.empty()) if (!textureInfo.sampleCounts.empty())
{ {
EXPECT_TRUE(renderable); EXPECT_TRUE(renderable) << "for 0x" << std::hex << internalFormat;
} }
// Multisample counts // Multisample counts
...@@ -134,12 +137,14 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -134,12 +137,14 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
bool sampleSuccess = SUCCEEDED(device->CheckMultisampleQualityLevels( bool sampleSuccess = SUCCEEDED(device->CheckMultisampleQualityLevels(
renderFormat, sampleCount, &qualityCount)); renderFormat, sampleCount, &qualityCount));
GLuint expectedCount = (!sampleSuccess || qualityCount == 0) ? 0 : 1; GLuint expectedCount = (!sampleSuccess || qualityCount == 0) ? 0 : 1;
EXPECT_EQ(expectedCount, textureInfo.sampleCounts.count(sampleCount)); EXPECT_EQ(expectedCount, textureInfo.sampleCounts.count(sampleCount))
<< "for 0x" << std::hex << internalFormat;
} }
} }
else else
{ {
EXPECT_TRUE(textureInfo.sampleCounts.empty()); EXPECT_TRUE(textureInfo.sampleCounts.empty())
<< "for 0x" << std::hex << internalFormat;
} }
} }
} }
......
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