Commit 96bd8fdf by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Fix format properties queries

When querying format properties (in vk::GetFormatProperties), the mandatory feature support table was consulted to check whether a number of texture features are present. If so, the entry from that table was returned. The goal had been to speed up initialization by not issuing device queries if possible. That is, when vk::GetFormatProperties was called on a format, if it supported that select few texture features, the VkFormatProperties entry from the mandatory table would be returned. However, that function found its way to other uses (such as querying buffer format properties, or other image properties beyond the select few). As a result, when the VkFormatProperties from the mandatory table was returned, actual support for these other features was often not tested and assumed false (unless they happened to be mandatory as well). This commit reworks the format feature query functions such that the specific features to be tested are provided when querying the format properties. The mandatory table is consulted as before, and if the entry doesn't contain those features, the device is queried and the results cached. Bug: angleproject:2958 Change-Id: I28d046eb63c3bd5173468aa4cb3e4c63c83e67b1 Reviewed-on: https://chromium-review.googlesource.com/c/1357152Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 81a880aa
......@@ -49,23 +49,16 @@ bool ClipToRenderTarget(const gl::Rectangle &area,
return ClipRectangle(area, renderTargetRect, rectOut);
}
bool HasSrcAndDstBlitProperties(const VkPhysicalDevice &physicalDevice,
bool HasSrcAndDstBlitProperties(RendererVk *renderer,
RenderTargetVk *srcRenderTarget,
RenderTargetVk *dstRenderTarget)
{
VkFormatProperties drawImageProperties;
vk::GetFormatProperties(physicalDevice, srcRenderTarget->getImageFormat().vkTextureFormat,
&drawImageProperties);
VkFormatProperties readImageProperties;
vk::GetFormatProperties(physicalDevice, dstRenderTarget->getImageFormat().vkTextureFormat,
&readImageProperties);
const VkFormat srcFormat = srcRenderTarget->getImageFormat().vkTextureFormat;
const VkFormat dstFormat = dstRenderTarget->getImageFormat().vkTextureFormat;
// Verifies if the draw and read images have the necessary prerequisites for blitting.
return (IsMaskFlagSet<VkFormatFeatureFlags>(drawImageProperties.optimalTilingFeatures,
VK_FORMAT_FEATURE_BLIT_DST_BIT) &&
IsMaskFlagSet<VkFormatFeatureFlags>(readImageProperties.optimalTilingFeatures,
VK_FORMAT_FEATURE_BLIT_SRC_BIT));
return renderer->hasTextureFormatFeatureBits(srcFormat, VK_FORMAT_FEATURE_BLIT_SRC_BIT) &&
renderer->hasTextureFormatFeatureBits(dstFormat, VK_FORMAT_FEATURE_BLIT_DST_BIT);
}
// Special rules apply to VkBufferImageCopy with depth/stencil. The components are tightly packed
......@@ -577,8 +570,7 @@ angle::Result FramebufferVk::blit(const gl::Context *context,
{
RenderTargetVk *drawRenderTarget = mRenderTargetCache.getColors()[colorAttachment];
ASSERT(drawRenderTarget);
ASSERT(HasSrcAndDstBlitProperties(renderer->getPhysicalDevice(), readRenderTarget,
drawRenderTarget));
ASSERT(HasSrcAndDstBlitProperties(renderer, readRenderTarget, drawRenderTarget));
gl::Rectangle drawRenderTargetRect;
if (!ClipToRenderTarget(drawRect, drawRenderTarget, &drawRenderTargetRect))
......@@ -615,8 +607,7 @@ angle::Result FramebufferVk::blit(const gl::Context *context,
ASSERT(readRenderTargetRect == drawRenderTargetRect);
ASSERT(filter == GL_NEAREST);
if (HasSrcAndDstBlitProperties(renderer->getPhysicalDevice(), readRenderTarget,
drawRenderTarget))
if (HasSrcAndDstBlitProperties(renderer, readRenderTarget, drawRenderTarget))
{
ANGLE_TRY(blitWithCommand(contextVk, readRenderTargetRect, drawRenderTargetRect,
readRenderTarget, drawRenderTarget, filter, false,
......
......@@ -38,6 +38,7 @@ const uint32_t kMockVendorID = 0xba5eba11;
const uint32_t kMockDeviceID = 0xf005ba11;
constexpr char kMockDeviceName[] = "Vulkan Mock Device";
constexpr size_t kInFlightCommandsLimit = 100u;
constexpr VkFormatFeatureFlags kInvalidFormatFeatureFlags = static_cast<VkFormatFeatureFlags>(-1);
} // anonymous namespace
namespace rx
......@@ -314,7 +315,10 @@ RendererVk::RendererVk()
mGpuEventsEnabled(false),
mGpuClockSync{std::numeric_limits<double>::max(), std::numeric_limits<double>::max()},
mGpuEventTimestampOrigin(0)
{}
{
VkFormatProperties invalid = {0, 0, kInvalidFormatFeatureFlags};
mFormatProperties.fill(invalid);
}
RendererVk::~RendererVk() {}
......@@ -542,8 +546,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
GlslangWrapper::Initialize();
// Initialize the format table.
mFormatTable.initialize(mPhysicalDevice, mPhysicalDeviceProperties, mFeatures,
&mNativeTextureCaps, &mNativeCaps.compressedTextureFormats);
mFormatTable.initialize(this, &mNativeTextureCaps, &mNativeCaps.compressedTextureFormats);
return angle::Result::Continue();
}
......@@ -1365,6 +1368,25 @@ angle::Result RendererVk::getTimestamp(vk::Context *context, uint64_t *timestamp
return angle::Result::Continue();
}
// These functions look at the mandatory format for support, and fallback to querying the device (if
// necessary) to test the availability of the bits.
bool RendererVk::hasLinearTextureFormatFeatureBits(VkFormat format,
const VkFormatFeatureFlags featureBits)
{
return hasFormatFeatureBits<&VkFormatProperties::linearTilingFeatures>(format, featureBits);
}
bool RendererVk::hasTextureFormatFeatureBits(VkFormat format,
const VkFormatFeatureFlags featureBits)
{
return hasFormatFeatureBits<&VkFormatProperties::optimalTilingFeatures>(format, featureBits);
}
bool RendererVk::hasBufferFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits)
{
return hasFormatFeatureBits<&VkFormatProperties::bufferFeatures>(format, featureBits);
}
angle::Result RendererVk::synchronizeCpuGpuTime(vk::Context *context)
{
ASSERT(mGpuEventsEnabled);
......@@ -1710,6 +1732,29 @@ void RendererVk::flushGpuEvents(double nextSyncGpuTimestampS, double nextSyncCpu
mGpuEvents.clear();
}
template <VkFormatFeatureFlags VkFormatProperties::*features>
bool RendererVk::hasFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits)
{
ASSERT(static_cast<uint32_t>(format) < vk::kNumVkFormats);
VkFormatProperties &deviceProperties = mFormatProperties[format];
if (deviceProperties.bufferFeatures == kInvalidFormatFeatureFlags)
{
// If we don't have the actual device features, see if the requested features are mandatory.
// If so, there's no need to query the device.
const VkFormatProperties &mandatoryProperties = vk::GetMandatoryFormatSupport(format);
if (IsMaskFlagSet(mandatoryProperties.*features, featureBits))
{
return true;
}
// Otherwise query the format features and cache it.
vkGetPhysicalDeviceFormatProperties(mPhysicalDevice, format, &deviceProperties);
}
return IsMaskFlagSet(deviceProperties.*features, featureBits);
}
uint32_t GetUniformBufferDescriptorCount()
{
return kUniformBufferDescriptorsPerDescriptorSet;
......
......@@ -183,6 +183,13 @@ class RendererVk : angle::NonCopyable
const vk::PipelineCache &getPipelineCache() const { return mPipelineCache; }
// Query the format properties for select bits (linearTilingFeatures, optimalTilingFeatures and
// bufferFeatures). Looks through mandatory features first, and falls back to querying the
// device (first time only).
bool hasLinearTextureFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits);
bool hasTextureFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits);
bool hasBufferFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits);
private:
// Number of semaphores for external entities to renderer to issue a wait, such as surface's
// image acquire.
......@@ -214,6 +221,9 @@ class RendererVk : angle::NonCopyable
angle::Result checkCompletedGpuEvents(vk::Context *context);
void flushGpuEvents(double nextSyncGpuTimestampS, double nextSyncCpuTimestampS);
template <VkFormatFeatureFlags VkFormatProperties::*features>
bool hasFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits);
egl::Display *mDisplay;
mutable bool mCapsInitialized;
......@@ -268,6 +278,9 @@ class RendererVk : angle::NonCopyable
egl::BlobCache::Key mPipelineCacheVkBlobKey;
uint32_t mPipelineCacheVkUpdateTimeout;
// A cache of VkFormatProperties as queried from the device over time.
std::array<VkFormatProperties, vk::kNumVkFormats> mFormatProperties;
// mSubmitWaitSemaphores is a list of specifically requested semaphores to be waited on before a
// command buffer submission, for example, semaphores signaled by vkAcquireNextImageKHR.
// After first use, the list is automatically cleared. This is a vector to support concurrent
......
......@@ -854,13 +854,11 @@ angle::Result TextureVk::generateMipmap(const gl::Context *context)
}
RendererVk *renderer = contextVk->getRenderer();
VkFormatProperties imageProperties;
vk::GetFormatProperties(renderer->getPhysicalDevice(), mImage.getFormat().vkTextureFormat,
&imageProperties);
// Check if the image supports blit. If it does, we can do the mipmap generation on the gpu
// only.
if (IsMaskFlagSet(kBlitFeatureFlags, imageProperties.linearTilingFeatures))
if (renderer->hasTextureFormatFeatureBits(mImage.getFormat().vkTextureFormat,
kBlitFeatureFlags))
{
ANGLE_TRY(ensureImageInitialized(contextVk));
ANGLE_TRY(mImage.generateMipmapsWithBlit(contextVk, mState.getMipmapMaxLevel()));
......
......@@ -41,9 +41,8 @@ namespace rx
namespace vk
{{
void Format::initialize(VkPhysicalDevice physicalDevice,
const angle::Format &angleFormat,
const angle::FeaturesVk &featuresVk)
void Format::initialize(RendererVk *renderer,
const angle::Format &angleFormat)
{{
switch (angleFormat.id)
{{
......@@ -79,7 +78,7 @@ texture_struct_template="{{{texture}, {vk_texture_format}, {texture_initializer}
texture_fallback_template = """{{
static constexpr TextureFormatInitInfo kInfo[] = {{{texture_list}}};
initTextureFallback(physicalDevice, kInfo, ArraySize(kInfo), featuresVk);
initTextureFallback(renderer, kInfo, ArraySize(kInfo));
}}"""
buffer_basic_template = """bufferFormatID = {buffer};
......@@ -93,7 +92,7 @@ buffer_struct_template="""{{{buffer}, {vk_buffer_format}, {vk_buffer_format_is_p
buffer_fallback_template = """{{
static constexpr BufferFormatInitInfo kInfo[] = {{{buffer_list}}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}}"""
def is_packed(format_id):
......
......@@ -31,19 +31,20 @@ template_table_autogen_cpp = """// GENERATED FILE - DO NOT EDIT.
using namespace angle;
namespace
{{
constexpr std::array<VkFormatProperties, {num_formats}> kFormatProperties = {{{{
{format_case_data}
}}}};
}} // anonymous namespace
namespace rx
{{
namespace vk
{{
namespace
{{
static_assert({num_formats} == kNumVkFormats, "Update kNumVkFormats");
constexpr std::array<VkFormatProperties, kNumVkFormats> kFormatProperties = {{{{
{format_case_data}
}}}};
}} // anonymous namespace
const VkFormatProperties& GetMandatoryFormatSupport(VkFormat vkFormat)
{{
ASSERT(static_cast<uint64_t>(vkFormat) < sizeof(kFormatProperties));
......@@ -58,7 +59,7 @@ const VkFormatProperties& GetMandatoryFormatSupport(VkFormat vkFormat)
template_format_property = """
/* {vk_format} */
{{{{}}, {optimal_features}, {buffer_features}}}"""
{{0, {optimal_features}, {buffer_features}}}"""
def script_relative(path):
......
......@@ -22,9 +22,7 @@ namespace rx
namespace vk
{
void Format::initialize(VkPhysicalDevice physicalDevice,
const angle::Format &angleFormat,
const angle::FeaturesVk &featuresVk)
void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
{
switch (angleFormat.id)
{
......@@ -539,7 +537,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr},
{angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr},
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr}};
initTextureFallback(physicalDevice, kInfo, ArraySize(kInfo), featuresVk);
initTextureFallback(renderer, kInfo, ArraySize(kInfo));
}
bufferFormatID = angle::FormatID::D24_UNORM_S8_UINT;
vkBufferFormat = VK_FORMAT_D24_UNORM_S8_UINT;
......@@ -555,7 +553,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr},
{angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr},
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr}};
initTextureFallback(physicalDevice, kInfo, ArraySize(kInfo), featuresVk);
initTextureFallback(renderer, kInfo, ArraySize(kInfo));
}
bufferFormatID = angle::FormatID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
......@@ -583,7 +581,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
{angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr},
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr},
{angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr}};
initTextureFallback(physicalDevice, kInfo, ArraySize(kInfo), featuresVk);
initTextureFallback(renderer, kInfo, ArraySize(kInfo));
}
bufferFormatID = angle::FormatID::D32_FLOAT_S8X24_UINT;
vkBufferFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
......@@ -823,7 +821,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 4, 4, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -838,7 +836,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 4, 4, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -865,7 +863,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 4, 4, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -880,7 +878,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 4, 4, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -919,7 +917,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 3, 3, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -934,7 +932,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 3, 3, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -961,7 +959,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 3, 3, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -976,7 +974,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 3, 3, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1015,7 +1013,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 2, 2, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1030,7 +1028,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 2, 2, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1057,7 +1055,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 2, 2, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1072,7 +1070,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 2, 2, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1111,7 +1109,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 1, 1, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1126,7 +1124,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLshort, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLshort, 1, 1, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1153,7 +1151,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 1, 1, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1168,7 +1166,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLushort, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLushort, 1, 1, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1479,7 +1477,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 4, 4, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1494,7 +1492,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 4, 4, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1529,7 +1527,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 4, 4, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1548,7 +1546,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 4, 4, 0>, false},
{angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 4, 4, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1575,7 +1573,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 3, 3, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1590,7 +1588,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 3, 3, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1617,7 +1615,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 3, 3, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1636,7 +1634,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 3, 3, 0>, false},
{angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 3, 3, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1663,7 +1661,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 2, 2, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1678,7 +1676,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 2, 2, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1705,7 +1703,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 2, 2, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1720,7 +1718,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 2, 2, 0>, false},
{angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 2, 2, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1747,7 +1745,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 1, 1, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1762,7 +1760,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLbyte, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLbyte, 1, 1, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1789,7 +1787,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 1, 1, true>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1804,7 +1802,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
CopyNativeVertexData<GLubyte, 1, 1, 0>, false},
{angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false,
CopyTo32FVertexData<GLubyte, 1, 1, false>, true}};
initBufferFallback(physicalDevice, kInfo, ArraySize(kInfo));
initBufferFallback(renderer, kInfo, ArraySize(kInfo));
}
break;
......@@ -1820,7 +1818,7 @@ void Format::initialize(VkPhysicalDevice physicalDevice,
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr},
{angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr},
{angle::FormatID::S8_UINT, VK_FORMAT_S8_UINT, nullptr}};
initTextureFallback(physicalDevice, kInfo, ArraySize(kInfo), featuresVk);
initTextureFallback(renderer, kInfo, ArraySize(kInfo));
}
bufferFormatID = angle::FormatID::S8_UINT;
vkBufferFormat = VK_FORMAT_S8_UINT;
......
......@@ -10,25 +10,13 @@
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/load_functions_table.h"
#include "libANGLE/renderer/vulkan/RendererVk.h"
#include "libANGLE/renderer/vulkan/vk_caps_utils.h"
namespace rx
{
namespace
{
constexpr VkFormatFeatureFlags kNecessaryBitsFullSupportDepthStencil =
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
constexpr VkFormatFeatureFlags kNecessaryBitsFullSupportColor =
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
bool HasFormatFeatureBits(const VkFormatFeatureFlags featureBits,
const VkFormatProperties &formatProperties)
{
return IsMaskFlagSet(formatProperties.optimalTilingFeatures, featureBits);
}
void AddSampleCounts(VkSampleCountFlags sampleCounts, gl::SupportedSampleSet *outSet)
{
// The possible bits are VK_SAMPLE_COUNT_n_BIT = n, with n = 1 << b. At the time of this
......@@ -42,27 +30,31 @@ void AddSampleCounts(VkSampleCountFlags sampleCounts, gl::SupportedSampleSet *ou
}
}
void FillTextureFormatCaps(const VkPhysicalDeviceLimits &physicalDeviceLimits,
const VkFormatProperties &formatProperties,
gl::TextureCaps *outTextureCaps)
void FillTextureFormatCaps(RendererVk *renderer, VkFormat format, gl::TextureCaps *outTextureCaps)
{
const VkPhysicalDeviceLimits &physicalDeviceLimits =
renderer->getPhysicalDeviceProperties().limits;
bool hasColorAttachmentFeatureBit =
renderer->hasTextureFormatFeatureBits(format, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
bool hasDepthAttachmentFeatureBit = renderer->hasTextureFormatFeatureBits(
format, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);
outTextureCaps->texturable =
HasFormatFeatureBits(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT, formatProperties);
outTextureCaps->filterable =
HasFormatFeatureBits(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, formatProperties);
renderer->hasTextureFormatFeatureBits(format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
outTextureCaps->filterable = renderer->hasTextureFormatFeatureBits(
format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT);
outTextureCaps->textureAttachment =
HasFormatFeatureBits(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT, formatProperties) ||
HasFormatFeatureBits(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT, formatProperties);
hasColorAttachmentFeatureBit || hasDepthAttachmentFeatureBit;
outTextureCaps->renderbuffer = outTextureCaps->textureAttachment;
if (outTextureCaps->renderbuffer)
{
if (HasFormatFeatureBits(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT, formatProperties))
if (hasColorAttachmentFeatureBit)
{
AddSampleCounts(physicalDeviceLimits.framebufferColorSampleCounts,
&outTextureCaps->sampleCounts);
}
if (HasFormatFeatureBits(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT, formatProperties))
if (hasDepthAttachmentFeatureBit)
{
AddSampleCounts(physicalDeviceLimits.framebufferDepthSampleCounts,
&outTextureCaps->sampleCounts);
......@@ -72,31 +64,26 @@ void FillTextureFormatCaps(const VkPhysicalDeviceLimits &physicalDeviceLimits,
}
}
bool HasFullTextureFormatSupport(VkPhysicalDevice physicalDevice, VkFormat vkFormat)
bool HasFullTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat)
{
VkFormatProperties formatProperties;
vk::GetFormatProperties(physicalDevice, vkFormat, &formatProperties);
constexpr uint32_t kBitsColor =
(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
constexpr uint32_t kBitsDepth = (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);
constexpr uint32_t kBitsColor = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
constexpr uint32_t kBitsDepth = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
return HasFormatFeatureBits(kBitsColor, formatProperties) ||
HasFormatFeatureBits(kBitsDepth, formatProperties);
return renderer->hasTextureFormatFeatureBits(vkFormat, kBitsColor) ||
renderer->hasTextureFormatFeatureBits(vkFormat, kBitsDepth);
}
bool HasFullBufferFormatSupport(VkPhysicalDevice physicalDevice, VkFormat vkFormat)
bool HasFullBufferFormatSupport(RendererVk *renderer, VkFormat vkFormat)
{
VkFormatProperties formatProperties;
vk::GetFormatProperties(physicalDevice, vkFormat, &formatProperties);
return formatProperties.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
return renderer->hasBufferFormatFeatureBits(vkFormat, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT);
}
using SupportTest = bool (*)(VkPhysicalDevice physicalDevice, VkFormat vkFormat);
using SupportTest = bool (*)(RendererVk *renderer, VkFormat vkFormat);
template <class FormatInitInfo>
int FindSupportedFormat(VkPhysicalDevice physicalDevice,
int FindSupportedFormat(RendererVk *renderer,
const FormatInitInfo *info,
int numInfo,
SupportTest hasSupport)
......@@ -107,13 +94,13 @@ int FindSupportedFormat(VkPhysicalDevice physicalDevice,
for (int i = 0; i < last; ++i)
{
ASSERT(info[i].format != angle::FormatID::NONE);
if (hasSupport(physicalDevice, info[i].vkFormat))
if (hasSupport(renderer, info[i].vkFormat))
return i;
}
// List must contain a supported item. We failed on all the others so the last one must be it.
ASSERT(info[last].format != angle::FormatID::NONE);
ASSERT(hasSupport(physicalDevice, info[last].vkFormat));
ASSERT(hasSupport(renderer, info[last].vkFormat));
return last;
}
......@@ -122,29 +109,6 @@ int FindSupportedFormat(VkPhysicalDevice physicalDevice,
namespace vk
{
void GetFormatProperties(VkPhysicalDevice physicalDevice,
VkFormat vkFormat,
VkFormatProperties *propertiesOut)
{
// Try filling out the info from our hard coded format data, if we can't find the
// information we need, we'll make the call to Vulkan.
const VkFormatProperties &formatProperties = vk::GetMandatoryFormatSupport(vkFormat);
// Once we filled what we could with the mandatory texture caps, we verify if
// all the bits we need to satify all our checks are present, and if so we can
// skip the device call.
if (!IsMaskFlagSet(formatProperties.optimalTilingFeatures, kNecessaryBitsFullSupportColor) &&
!IsMaskFlagSet(formatProperties.optimalTilingFeatures,
kNecessaryBitsFullSupportDepthStencil))
{
vkGetPhysicalDeviceFormatProperties(physicalDevice, vkFormat, propertiesOut);
}
else
{
*propertiesOut = formatProperties;
}
}
// Format implementation.
Format::Format()
: angleFormatID(angle::FormatID::NONE),
......@@ -153,19 +117,18 @@ Format::Format()
vkTextureFormat(VK_FORMAT_UNDEFINED),
bufferFormatID(angle::FormatID::NONE),
vkBufferFormat(VK_FORMAT_UNDEFINED),
vkBufferFormatIsPacked(false),
textureInitializerFunction(nullptr),
textureLoadFunctions()
textureLoadFunctions(),
vertexLoadRequiresConversion(false),
vkBufferFormatIsPacked(false)
{}
void Format::initTextureFallback(VkPhysicalDevice physicalDevice,
void Format::initTextureFallback(RendererVk *renderer,
const TextureFormatInitInfo *info,
int numInfo,
const angle::FeaturesVk &featuresVk)
int numInfo)
{
size_t skip = featuresVk.forceFallbackFormat ? 1 : 0;
int i = FindSupportedFormat(physicalDevice, info + skip, numInfo - skip,
HasFullTextureFormatSupport);
size_t skip = renderer->getFeatures().forceFallbackFormat ? 1 : 0;
int i = FindSupportedFormat(renderer, info + skip, numInfo - skip, HasFullTextureFormatSupport);
i += skip;
textureFormatID = info[i].format;
......@@ -173,11 +136,9 @@ void Format::initTextureFallback(VkPhysicalDevice physicalDevice,
textureInitializerFunction = info[i].initializer;
}
void Format::initBufferFallback(VkPhysicalDevice physicalDevice,
const BufferFormatInitInfo *info,
int numInfo)
void Format::initBufferFallback(RendererVk *renderer, const BufferFormatInitInfo *info, int numInfo)
{
int i = FindSupportedFormat(physicalDevice, info, numInfo, HasFullBufferFormatSupport);
int i = FindSupportedFormat(renderer, info, numInfo, HasFullBufferFormatSupport);
bufferFormatID = info[i].format;
vkBufferFormat = info[i].vkFormat;
vkBufferFormatIsPacked = info[i].vkFormatIsPacked;
......@@ -215,35 +176,28 @@ FormatTable::FormatTable() {}
FormatTable::~FormatTable() {}
void FormatTable::initialize(VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceProperties &physicalDeviceProperties,
const angle::FeaturesVk &featuresVk,
void FormatTable::initialize(RendererVk *renderer,
gl::TextureCapsMap *outTextureCapsMap,
std::vector<GLenum> *outCompressedTextureFormats)
{
for (size_t formatIndex = 0; formatIndex < angle::kNumANGLEFormats; ++formatIndex)
{
vk::Format &format = mFormatData[formatIndex];
const auto formatID = static_cast<angle::FormatID>(formatIndex);
const angle::Format &angleFormat = angle::Format::Get(formatID);
mFormatData[formatIndex].initialize(physicalDevice, angleFormat, featuresVk);
const GLenum internalFormat = mFormatData[formatIndex].internalFormat;
mFormatData[formatIndex].textureLoadFunctions =
GetLoadFunctionsMap(internalFormat, mFormatData[formatIndex].textureFormatID);
mFormatData[formatIndex].angleFormatID = formatID;
if (!mFormatData[formatIndex].valid())
format.initialize(renderer, angleFormat);
const GLenum internalFormat = format.internalFormat;
format.textureLoadFunctions = GetLoadFunctionsMap(internalFormat, format.textureFormatID);
format.angleFormatID = formatID;
if (!format.valid())
{
continue;
}
const VkFormat vkFormat = mFormatData[formatIndex].vkTextureFormat;
// Try filling out the info from our hard coded format data, if we can't find the
// information we need, we'll make the call to Vulkan.
VkFormatProperties formatProperties;
GetFormatProperties(physicalDevice, vkFormat, &formatProperties);
gl::TextureCaps textureCaps;
FillTextureFormatCaps(physicalDeviceProperties.limits, formatProperties, &textureCaps);
FillTextureFormatCaps(renderer, format.vkTextureFormat, &textureCaps);
outTextureCapsMap->set(formatID, textureCaps);
if (angleFormat.isBlock)
......
......@@ -26,13 +26,12 @@ class TextureCapsMap;
namespace rx
{
class RendererVk;
namespace vk
{
void GetFormatProperties(VkPhysicalDevice physicalDevice,
VkFormat vkFormat,
VkFormatProperties *propertiesOut);
// VkFormat values in range [0, kNumVkFormats) are used as indices in various tables.
constexpr uint32_t kNumVkFormats = 185;
struct TextureFormatInitInfo final
{
......@@ -57,17 +56,10 @@ struct Format final : private angle::NonCopyable
bool valid() const { return internalFormat != 0; }
// This is an auto-generated method in vk_format_table_autogen.cpp.
void initialize(VkPhysicalDevice physicalDevice,
const angle::Format &angleFormat,
const angle::FeaturesVk &featuresVk);
void initTextureFallback(VkPhysicalDevice physicalDevice,
const TextureFormatInitInfo *info,
int numInfo,
const angle::FeaturesVk &featuresVk);
void initBufferFallback(VkPhysicalDevice physicalDevice,
const BufferFormatInitInfo *info,
int numInfo);
void initialize(RendererVk *renderer, const angle::Format &angleFormat);
void initTextureFallback(RendererVk *renderer, const TextureFormatInitInfo *info, int numInfo);
void initBufferFallback(RendererVk *renderer, const BufferFormatInitInfo *info, int numInfo);
const angle::Format &angleFormat() const;
const angle::Format &textureFormat() const;
......@@ -79,11 +71,12 @@ struct Format final : private angle::NonCopyable
VkFormat vkTextureFormat;
angle::FormatID bufferFormatID;
VkFormat vkBufferFormat;
bool vkBufferFormatIsPacked;
InitializeTextureDataFunction textureInitializerFunction;
LoadFunctionMap textureLoadFunctions;
VertexCopyFunction vertexLoadFunction;
bool vertexLoadRequiresConversion;
bool vkBufferFormatIsPacked;
};
bool operator==(const Format &lhs, const Format &rhs);
......@@ -96,9 +89,7 @@ class FormatTable final : angle::NonCopyable
~FormatTable();
// Also initializes the TextureCapsMap and the compressedTextureCaps in the Caps instance.
void initialize(VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceProperties &physicalDeviceProperties,
const angle::FeaturesVk &featuresVk,
void initialize(RendererVk *renderer,
gl::TextureCapsMap *outTextureCapsMap,
std::vector<GLenum> *outCompressedTextureFormats);
......
......@@ -14,127 +14,134 @@
using namespace angle;
namespace rx
{
namespace vk
{
namespace
{
constexpr std::array<VkFormatProperties, 185> kFormatProperties = {{
static_assert(185 == kNumVkFormats, "Update kNumVkFormats");
constexpr std::array<VkFormatProperties, kNumVkFormats> kFormatProperties = {{
/* VK_FORMAT_UNDEFINED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R4G4_UNORM_PACK8 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R4G4B4A4_UNORM_PACK16 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B4G4R4A4_UNORM_PACK16 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
0},
/* VK_FORMAT_R5G6B5_UNORM_PACK16 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
0},
/* VK_FORMAT_B5G6R5_UNORM_PACK16 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R5G5B5A1_UNORM_PACK16 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B5G5R5A1_UNORM_PACK16 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A1R5G5B5_UNORM_PACK16 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
0},
/* VK_FORMAT_R8_UNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8_SNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8_SRGB */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8_UNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8_SNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8_SRGB */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_UNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_SNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8_SRGB */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_UNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_SNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8_SRGB */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8A8_UNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
......@@ -142,62 +149,62 @@ constexpr std::array<VkFormatProperties, 185> kFormatProperties = {{
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8B8A8_SNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8B8A8_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8A8_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R8G8B8A8_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8B8A8_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R8G8B8A8_SRGB */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
0},
/* VK_FORMAT_B8G8R8A8_UNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_B8G8R8A8_SNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8A8_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8A8_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8A8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8A8_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B8G8R8A8_SRGB */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
0},
/* VK_FORMAT_A8B8G8R8_UNORM_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
......@@ -205,154 +212,154 @@ constexpr std::array<VkFormatProperties, 185> kFormatProperties = {{
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_A8B8G8R8_SNORM_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_A8B8G8R8_USCALED_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A8B8G8R8_SSCALED_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A8B8G8R8_UINT_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_A8B8G8R8_SINT_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_A8B8G8R8_SRGB_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
0},
/* VK_FORMAT_A2R10G10B10_UNORM_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2R10G10B10_SNORM_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2R10G10B10_USCALED_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2R10G10B10_SSCALED_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2R10G10B10_UINT_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2R10G10B10_SINT_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2B10G10R10_UNORM_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_A2B10G10R10_SNORM_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2B10G10R10_USCALED_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2B10G10R10_SSCALED_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_A2B10G10R10_UINT_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_A2B10G10R10_SINT_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16_UNORM */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R16_SNORM */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R16_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16_SFLOAT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16G16_UNORM */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R16G16_SNORM */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R16G16_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16G16_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16G16_SFLOAT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16G16B16_UNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16_SNORM */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16_SFLOAT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16A16_UNORM */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R16G16B16A16_SNORM */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R16G16B16A16_USCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16A16_SSCALED */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R16G16B16A16_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16G16B16A16_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R16G16B16A16_SFLOAT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT |
......@@ -360,7 +367,7 @@ constexpr std::array<VkFormatProperties, 185> kFormatProperties = {{
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
......@@ -368,7 +375,7 @@ constexpr std::array<VkFormatProperties, 185> kFormatProperties = {{
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT},
/* VK_FORMAT_R32_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT,
......@@ -376,227 +383,221 @@ constexpr std::array<VkFormatProperties, 185> kFormatProperties = {{
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT},
/* VK_FORMAT_R32_SFLOAT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32G32_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32G32_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32G32_SFLOAT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32G32B32_UINT */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R32G32B32_SINT */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R32G32B32_SFLOAT */
{{}, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
{0, 0, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT},
/* VK_FORMAT_R32G32B32A32_UINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32G32B32A32_SINT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R32G32B32A32_SFLOAT */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT,
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT},
/* VK_FORMAT_R64_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64_SFLOAT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64_SFLOAT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64B64_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64B64_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64B64_SFLOAT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64B64A64_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64B64A64_SINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_R64G64B64A64_SFLOAT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_B10G11R11_UFLOAT_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT},
/* VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
0},
/* VK_FORMAT_D16_UNORM */
{{},
{0,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT,
0},
/* VK_FORMAT_X8_D24_UNORM_PACK32 */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_D32_SFLOAT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_S8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_D16_UNORM_S8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_D24_UNORM_S8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_D32_SFLOAT_S8_UINT */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC1_RGB_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC1_RGB_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC1_RGBA_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC1_RGBA_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC2_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC2_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC3_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC3_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC4_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC4_SNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC5_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC5_SNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC6H_UFLOAT_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC6H_SFLOAT_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC7_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_BC7_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_EAC_R11_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_EAC_R11_SNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_EAC_R11G11_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_EAC_R11G11_SNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_4x4_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_4x4_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_5x4_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_5x4_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_5x5_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_5x5_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_6x5_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_6x5_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_6x6_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_6x6_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_8x5_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_8x5_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_8x6_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_8x6_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_8x8_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_8x8_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x5_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x5_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x6_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x6_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x8_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x8_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x10_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_10x10_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_12x10_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_12x10_SRGB_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_12x12_UNORM_BLOCK */
{{}, 0, 0},
{0, 0, 0},
/* VK_FORMAT_ASTC_12x12_SRGB_BLOCK */
{{}, 0, 0}}};
{0, 0, 0}}};
} // anonymous namespace
namespace rx
{
namespace vk
{
const VkFormatProperties &GetMandatoryFormatSupport(VkFormat vkFormat)
{
ASSERT(static_cast<uint64_t>(vkFormat) < sizeof(kFormatProperties));
......
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