diff --git a/scripts/code_generation_hashes/Vulkan_format.json b/scripts/code_generation_hashes/Vulkan_format.json index aaed0376b..a1b89f48e 100644 --- a/scripts/code_generation_hashes/Vulkan_format.json +++ b/scripts/code_generation_hashes/Vulkan_format.json @@ -4,9 +4,9 @@ "src/libANGLE/renderer/angle_format_map.json": "aa4a0d3463b76858a75787b9cdec8e98", "src/libANGLE/renderer/vulkan/gen_vk_format_table.py": - "bf2279d1d8da7e3e271a352e101c8956", + "0bc8a6deefd856387da0bccf3817dde7", "src/libANGLE/renderer/vulkan/vk_format_map.json": "b62588b1e9f6d9fa98aeea886d8ed2bd", "src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp": - "4dfb7525b4f45690091d6642e77481a3" + "ff081c37d8dfabdf87f46af9bf8e295a" } \ No newline at end of file diff --git a/src/libANGLE/Caps.cpp b/src/libANGLE/Caps.cpp index fcfa21183..15e317d22 100644 --- a/src/libANGLE/Caps.cpp +++ b/src/libANGLE/Caps.cpp @@ -109,12 +109,12 @@ const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const const TextureCaps &TextureCapsMap::get(angle::FormatID formatID) const { - return mFormatData[static_cast(formatID)]; + return mFormatData[formatID]; } TextureCaps &TextureCapsMap::get(angle::FormatID formatID) { - return mFormatData[static_cast(formatID)]; + return mFormatData[formatID]; } void TextureCapsMap::set(angle::FormatID formatID, const TextureCaps &caps) diff --git a/src/libANGLE/Caps.h b/src/libANGLE/Caps.h index 45ee11a9e..4f0848adb 100644 --- a/src/libANGLE/Caps.h +++ b/src/libANGLE/Caps.h @@ -79,7 +79,7 @@ class TextureCapsMap final : angle::NonCopyable TextureCaps &get(angle::FormatID formatID); // Indexed by angle::FormatID - std::array mFormatData; + angle::FormatMap mFormatData; }; void InitMinimumTextureCapsMap(const Version &clientVersion, diff --git a/src/libANGLE/renderer/Format.h b/src/libANGLE/renderer/Format.h index 0c5a3165b..c8ec2f0f3 100644 --- a/src/libANGLE/renderer/Format.h +++ b/src/libANGLE/renderer/Format.h @@ -226,6 +226,9 @@ constexpr bool Format::isVertexTypeHalfFloat() const return vertexAttribType == gl::VertexAttribType::HalfFloat; } +template +using FormatMap = PackedEnumMap; + } // namespace angle #endif // LIBANGLE_RENDERER_FORMAT_H_ diff --git a/src/libANGLE/renderer/renderer_utils.cpp b/src/libANGLE/renderer/renderer_utils.cpp index 2fac49d23..1995c505c 100644 --- a/src/libANGLE/renderer/renderer_utils.cpp +++ b/src/libANGLE/renderer/renderer_utils.cpp @@ -1238,4 +1238,130 @@ ResetBaseVertexBaseInstance::~ResetBaseVertexBaseInstance() } } +angle::FormatID ConvertToSRGB(angle::FormatID formatID) +{ + switch (formatID) + { + case angle::FormatID::R8_UNORM: + return angle::FormatID::R8_UNORM_SRGB; + case angle::FormatID::R8G8B8_UNORM: + return angle::FormatID::R8G8B8_UNORM_SRGB; + case angle::FormatID::R8G8B8A8_UNORM: + return angle::FormatID::R8G8B8A8_UNORM_SRGB; + case angle::FormatID::B8G8R8A8_UNORM: + return angle::FormatID::B8G8R8A8_UNORM_SRGB; + case angle::FormatID::BC1_RGB_UNORM_BLOCK: + return angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK; + case angle::FormatID::BC1_RGBA_UNORM_BLOCK: + return angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK; + case angle::FormatID::BC2_RGBA_UNORM_BLOCK: + return angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK; + case angle::FormatID::BC3_RGBA_UNORM_BLOCK: + return angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK; + case angle::FormatID::BPTC_RGBA_UNORM_BLOCK: + return angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK; + case angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK: + return angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK; + case angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK: + return angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK; + case angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK: + return angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK; + case angle::FormatID::ASTC_4x4_UNORM_BLOCK: + return angle::FormatID::ASTC_4x4_SRGB_BLOCK; + case angle::FormatID::ASTC_5x4_UNORM_BLOCK: + return angle::FormatID::ASTC_5x4_SRGB_BLOCK; + case angle::FormatID::ASTC_5x5_UNORM_BLOCK: + return angle::FormatID::ASTC_5x5_SRGB_BLOCK; + case angle::FormatID::ASTC_6x5_UNORM_BLOCK: + return angle::FormatID::ASTC_6x5_SRGB_BLOCK; + case angle::FormatID::ASTC_6x6_UNORM_BLOCK: + return angle::FormatID::ASTC_6x6_SRGB_BLOCK; + case angle::FormatID::ASTC_8x5_UNORM_BLOCK: + return angle::FormatID::ASTC_8x5_SRGB_BLOCK; + case angle::FormatID::ASTC_8x6_UNORM_BLOCK: + return angle::FormatID::ASTC_8x6_SRGB_BLOCK; + case angle::FormatID::ASTC_8x8_UNORM_BLOCK: + return angle::FormatID::ASTC_8x8_SRGB_BLOCK; + case angle::FormatID::ASTC_10x5_UNORM_BLOCK: + return angle::FormatID::ASTC_10x5_SRGB_BLOCK; + case angle::FormatID::ASTC_10x6_UNORM_BLOCK: + return angle::FormatID::ASTC_10x6_SRGB_BLOCK; + case angle::FormatID::ASTC_10x8_UNORM_BLOCK: + return angle::FormatID::ASTC_10x8_SRGB_BLOCK; + case angle::FormatID::ASTC_10x10_UNORM_BLOCK: + return angle::FormatID::ASTC_10x10_SRGB_BLOCK; + case angle::FormatID::ASTC_12x10_UNORM_BLOCK: + return angle::FormatID::ASTC_12x10_SRGB_BLOCK; + case angle::FormatID::ASTC_12x12_UNORM_BLOCK: + return angle::FormatID::ASTC_12x12_SRGB_BLOCK; + default: + return angle::FormatID::NONE; + } +} + +angle::FormatID ConvertToLinear(angle::FormatID formatID) +{ + switch (formatID) + { + case angle::FormatID::R8_UNORM_SRGB: + return angle::FormatID::R8_UNORM; + case angle::FormatID::R8G8B8_UNORM_SRGB: + return angle::FormatID::R8G8B8_UNORM; + case angle::FormatID::R8G8B8A8_UNORM_SRGB: + return angle::FormatID::R8G8B8A8_UNORM; + case angle::FormatID::B8G8R8A8_UNORM_SRGB: + return angle::FormatID::B8G8R8A8_UNORM; + case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK: + return angle::FormatID::BC1_RGB_UNORM_BLOCK; + case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK: + return angle::FormatID::BC1_RGBA_UNORM_BLOCK; + case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK: + return angle::FormatID::BC2_RGBA_UNORM_BLOCK; + case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK: + return angle::FormatID::BC3_RGBA_UNORM_BLOCK; + case angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK: + return angle::FormatID::BPTC_RGBA_UNORM_BLOCK; + case angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK: + return angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK; + case angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK: + return angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK; + case angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK: + return angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK; + case angle::FormatID::ASTC_4x4_SRGB_BLOCK: + return angle::FormatID::ASTC_4x4_UNORM_BLOCK; + case angle::FormatID::ASTC_5x4_SRGB_BLOCK: + return angle::FormatID::ASTC_5x4_UNORM_BLOCK; + case angle::FormatID::ASTC_5x5_SRGB_BLOCK: + return angle::FormatID::ASTC_5x5_UNORM_BLOCK; + case angle::FormatID::ASTC_6x5_SRGB_BLOCK: + return angle::FormatID::ASTC_6x5_UNORM_BLOCK; + case angle::FormatID::ASTC_6x6_SRGB_BLOCK: + return angle::FormatID::ASTC_6x6_UNORM_BLOCK; + case angle::FormatID::ASTC_8x5_SRGB_BLOCK: + return angle::FormatID::ASTC_8x5_UNORM_BLOCK; + case angle::FormatID::ASTC_8x6_SRGB_BLOCK: + return angle::FormatID::ASTC_8x6_UNORM_BLOCK; + case angle::FormatID::ASTC_8x8_SRGB_BLOCK: + return angle::FormatID::ASTC_8x8_UNORM_BLOCK; + case angle::FormatID::ASTC_10x5_SRGB_BLOCK: + return angle::FormatID::ASTC_10x5_UNORM_BLOCK; + case angle::FormatID::ASTC_10x6_SRGB_BLOCK: + return angle::FormatID::ASTC_10x6_UNORM_BLOCK; + case angle::FormatID::ASTC_10x8_SRGB_BLOCK: + return angle::FormatID::ASTC_10x8_UNORM_BLOCK; + case angle::FormatID::ASTC_10x10_SRGB_BLOCK: + return angle::FormatID::ASTC_10x10_UNORM_BLOCK; + case angle::FormatID::ASTC_12x10_SRGB_BLOCK: + return angle::FormatID::ASTC_12x10_UNORM_BLOCK; + case angle::FormatID::ASTC_12x12_SRGB_BLOCK: + return angle::FormatID::ASTC_12x12_UNORM_BLOCK; + default: + return angle::FormatID::NONE; + } +} + +bool IsOverridableLinearFormat(angle::FormatID formatID) +{ + return ConvertToSRGB(formatID) != angle::FormatID::NONE; +} } // namespace rx diff --git a/src/libANGLE/renderer/renderer_utils.h b/src/libANGLE/renderer/renderer_utils.h index f7b707178..5f17b7a43 100644 --- a/src/libANGLE/renderer/renderer_utils.h +++ b/src/libANGLE/renderer/renderer_utils.h @@ -417,6 +417,9 @@ class ResetBaseVertexBaseInstance : angle::NonCopyable bool mResetBaseInstance; }; +angle::FormatID ConvertToSRGB(angle::FormatID formatID); +angle::FormatID ConvertToLinear(angle::FormatID formatID); +bool IsOverridableLinearFormat(angle::FormatID formatID); } // namespace rx // MultiDraw macro patterns diff --git a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp index 320d561e1..f89e44acf 100644 --- a/src/libANGLE/renderer/vulkan/FramebufferVk.cpp +++ b/src/libANGLE/renderer/vulkan/FramebufferVk.cpp @@ -49,13 +49,13 @@ constexpr unsigned int kEmulatedAlphaValue = 1; bool HasSrcBlitFeature(RendererVk *renderer, RenderTargetVk *srcRenderTarget) { - const VkFormat srcFormat = srcRenderTarget->getImageFormat().actualImageVkFormat; + angle::FormatID srcFormat = srcRenderTarget->getImageFormat().actualImageFormatID; return renderer->hasImageFormatFeatureBits(srcFormat, VK_FORMAT_FEATURE_BLIT_SRC_BIT); } bool HasDstBlitFeature(RendererVk *renderer, RenderTargetVk *dstRenderTarget) { - const VkFormat dstFormat = dstRenderTarget->getImageFormat().actualImageVkFormat; + angle::FormatID dstFormat = dstRenderTarget->getImageFormat().actualImageFormatID; return renderer->hasImageFormatFeatureBits(dstFormat, VK_FORMAT_FEATURE_BLIT_DST_BIT); } @@ -87,7 +87,7 @@ bool AreSrcAndDstFormatsIdentical(RenderTargetVk *srcRenderTarget, RenderTargetV const vk::Format &srcFormat = srcRenderTarget->getImageFormat(); const vk::Format &dstFormat = dstRenderTarget->getImageFormat(); - return srcFormat.actualImageVkFormat == dstFormat.actualImageVkFormat; + return srcFormat.actualImageFormatID == dstFormat.actualImageFormatID; } bool AreSrcAndDstDepthStencilChannelsBlitCompatible(RenderTargetVk *srcRenderTarget, diff --git a/src/libANGLE/renderer/vulkan/MemoryObjectVk.cpp b/src/libANGLE/renderer/vulkan/MemoryObjectVk.cpp index 41db5fc87..505df6a63 100644 --- a/src/libANGLE/renderer/vulkan/MemoryObjectVk.cpp +++ b/src/libANGLE/renderer/vulkan/MemoryObjectVk.cpp @@ -178,7 +178,7 @@ angle::Result MemoryObjectVk::createImage(ContextVk *contextVk, // values constituting the bits of |usageFlags| are identical to their corresponding Vulkan // value. const VkImageUsageFlags imageUsageFlags = - vk::GetMaximalImageUsageFlags(renderer, vkFormat.actualImageVkFormat) & usageFlags; + vk::GetMaximalImageUsageFlags(renderer, vkFormat.actualImageFormatID) & usageFlags; VkExternalMemoryImageCreateInfo externalMemoryImageCreateInfo = {}; externalMemoryImageCreateInfo.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; diff --git a/src/libANGLE/renderer/vulkan/OverlayVk.cpp b/src/libANGLE/renderer/vulkan/OverlayVk.cpp index 355833b29..8e6b49144 100644 --- a/src/libANGLE/renderer/vulkan/OverlayVk.cpp +++ b/src/libANGLE/renderer/vulkan/OverlayVk.cpp @@ -217,7 +217,7 @@ angle::Result OverlayVk::onPresent(ContextVk *contextVk, // If the swapchain image doesn't support storage image, we can't output to it. VkFormatFeatureFlags featureBits = renderer->getImageFormatFeatureBits( - imageToPresent->getFormat().actualImageVkFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); + imageToPresent->getFormat().actualImageFormatID, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); if ((featureBits & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) == 0) { return angle::Result::Continue; diff --git a/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp b/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp index 15f980b42..25446d19e 100644 --- a/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp +++ b/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp @@ -45,9 +45,9 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context, GLsizei height, gl::MultisamplingMode mode) { - ContextVk *contextVk = vk::GetImpl(context); - RendererVk *renderer = contextVk->getRenderer(); - const vk::Format &vkFormat = renderer->getFormat(internalformat); + ContextVk *contextVk = vk::GetImpl(context); + RendererVk *renderer = contextVk->getRenderer(); + const vk::Format &format = renderer->getFormat(internalformat); if (!mOwnsImage) { @@ -82,10 +82,11 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context, // causing it to be interpreted in a different colorspace. Create the VkImage accordingly. VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone; VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr; - VkFormat vkImageFormat = vkFormat.actualImageVkFormat; - VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB - ? vk::ConvertToLinear(vkImageFormat) - : vk::ConvertToSRGB(vkImageFormat); + angle::FormatID imageFormat = format.actualImageFormatID; + angle::FormatID imageListFormat = format.actualImageFormat().isSRGB + ? ConvertToLinear(imageFormat) + : ConvertToSRGB(imageFormat); + VkFormat vkFormat = vk::GetVkFormatFromFormatID(imageListFormat); VkImageFormatListCreateInfoKHR formatListInfo = {}; if (renderer->getFeatures().supportsImageFormatList.enabled) @@ -97,11 +98,11 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context, formatListInfo.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR; formatListInfo.pNext = nullptr; formatListInfo.viewFormatCount = 1; - formatListInfo.pViewFormats = &vkImageListFormat; + formatListInfo.pViewFormats = &vkFormat; additionalCreateInfo = &formatListInfo; } - const angle::Format &textureFormat = vkFormat.actualImageFormat(); + const angle::Format &textureFormat = format.actualImageFormat(); const bool isDepthStencilFormat = textureFormat.hasDepthOrStencilBits(); ASSERT(textureFormat.redBits > 0 || isDepthStencilFormat); @@ -124,7 +125,7 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context, bool robustInit = contextVk->isRobustResourceInitEnabled(); VkExtent3D extents = {static_cast(width), static_cast(height), 1u}; - ANGLE_TRY(mImage->initExternal(contextVk, gl::TextureType::_2D, extents, vkFormat, imageSamples, + ANGLE_TRY(mImage->initExternal(contextVk, gl::TextureType::_2D, extents, format, imageSamples, usage, imageCreateFlags, vk::ImageLayout::Undefined, additionalCreateInfo, gl::LevelIndex(0), gl::LevelIndex(0), 1, 1, robustInit)); diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp index f330d71f7..d075088ed 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.cpp +++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp @@ -2244,36 +2244,36 @@ Serial RendererVk::issueShaderSerial() // 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::hasLinearImageFormatFeatureBits(VkFormat format, +bool RendererVk::hasLinearImageFormatFeatureBits(angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const { - return hasFormatFeatureBits<&VkFormatProperties::linearTilingFeatures>(format, featureBits); + return hasFormatFeatureBits<&VkFormatProperties::linearTilingFeatures>(formatID, featureBits); } VkFormatFeatureFlags RendererVk::getLinearImageFormatFeatureBits( - VkFormat format, + angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const { - return getFormatFeatureBits<&VkFormatProperties::linearTilingFeatures>(format, featureBits); + return getFormatFeatureBits<&VkFormatProperties::linearTilingFeatures>(formatID, featureBits); } VkFormatFeatureFlags RendererVk::getImageFormatFeatureBits( - VkFormat format, + angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const { - return getFormatFeatureBits<&VkFormatProperties::optimalTilingFeatures>(format, featureBits); + return getFormatFeatureBits<&VkFormatProperties::optimalTilingFeatures>(formatID, featureBits); } -bool RendererVk::hasImageFormatFeatureBits(VkFormat format, +bool RendererVk::hasImageFormatFeatureBits(angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const { - return hasFormatFeatureBits<&VkFormatProperties::optimalTilingFeatures>(format, featureBits); + return hasFormatFeatureBits<&VkFormatProperties::optimalTilingFeatures>(formatID, featureBits); } -bool RendererVk::hasBufferFormatFeatureBits(VkFormat format, +bool RendererVk::hasBufferFormatFeatureBits(angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const { - return hasFormatFeatureBits<&VkFormatProperties::bufferFeatures>(format, featureBits); + return hasFormatFeatureBits<&VkFormatProperties::bufferFeatures>(formatID, featureBits); } void RendererVk::outputVmaStatString() @@ -2323,27 +2323,28 @@ angle::Result RendererVk::queueSubmitOneOff(vk::Context *context, } template -VkFormatFeatureFlags RendererVk::getFormatFeatureBits(VkFormat format, +VkFormatFeatureFlags RendererVk::getFormatFeatureBits(angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const { - ASSERT(static_cast(format) < vk::kNumVkFormats); - VkFormatProperties &deviceProperties = mFormatProperties[format]; + VkFormatProperties &deviceProperties = mFormatProperties[formatID]; if (deviceProperties.bufferFeatures == kInvalidFormatFeatureFlags) { + VkFormat vkFormat = vk::GetVkFormatFromFormatID(formatID); + // 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); + const VkFormatProperties &mandatoryProperties = vk::GetMandatoryFormatSupport(vkFormat); if (IsMaskFlagSet(mandatoryProperties.*features, featureBits)) { return featureBits; } // Otherwise query the format features and cache it. - vkGetPhysicalDeviceFormatProperties(mPhysicalDevice, format, &deviceProperties); + vkGetPhysicalDeviceFormatProperties(mPhysicalDevice, vkFormat, &deviceProperties); // Workaround for some Android devices that don't indicate filtering // support on D16_UNORM and they should. - if (mFeatures.forceD16TexFilter.enabled && format == VK_FORMAT_D16_UNORM) + if (mFeatures.forceD16TexFilter.enabled && vkFormat == VK_FORMAT_D16_UNORM) { deviceProperties.*features |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; } @@ -2353,14 +2354,16 @@ VkFormatFeatureFlags RendererVk::getFormatFeatureBits(VkFormat format, } template -bool RendererVk::hasFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits) const +bool RendererVk::hasFormatFeatureBits(angle::FormatID formatID, + const VkFormatFeatureFlags featureBits) const { - return IsMaskFlagSet(getFormatFeatureBits(format, featureBits), featureBits); + return IsMaskFlagSet(getFormatFeatureBits(formatID, featureBits), featureBits); } -bool RendererVk::haveSameFormatFeatureBits(VkFormat fmt1, VkFormat fmt2) const +bool RendererVk::haveSameFormatFeatureBits(angle::FormatID formatID1, + angle::FormatID formatID2) const { - if (fmt1 == VK_FORMAT_UNDEFINED || fmt2 == VK_FORMAT_UNDEFINED) + if (formatID1 == angle::FormatID::NONE || formatID2 == angle::FormatID::NONE) { return false; } @@ -2370,12 +2373,12 @@ bool RendererVk::haveSameFormatFeatureBits(VkFormat fmt1, VkFormat fmt2) const VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; VkFormatFeatureFlags fmt1LinearFeatureBits = - getLinearImageFormatFeatureBits(fmt1, kImageUsageFeatureBits); + getLinearImageFormatFeatureBits(formatID1, kImageUsageFeatureBits); VkFormatFeatureFlags fmt1OptimalFeatureBits = - getImageFormatFeatureBits(fmt1, kImageUsageFeatureBits); + getImageFormatFeatureBits(formatID1, kImageUsageFeatureBits); - return hasLinearImageFormatFeatureBits(fmt2, fmt1LinearFeatureBits) && - hasImageFormatFeatureBits(fmt2, fmt1OptimalFeatureBits); + return hasLinearImageFormatFeatureBits(formatID2, fmt1LinearFeatureBits) && + hasImageFormatFeatureBits(formatID2, fmt1OptimalFeatureBits); } angle::Result RendererVk::cleanupGarbage(Serial lastCompletedQueueSerial) diff --git a/src/libANGLE/renderer/vulkan/RendererVk.h b/src/libANGLE/renderer/vulkan/RendererVk.h index bcf03fcda..852f93a42 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.h +++ b/src/libANGLE/renderer/vulkan/RendererVk.h @@ -184,15 +184,17 @@ class RendererVk : angle::NonCopyable // 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 hasLinearImageFormatFeatureBits(VkFormat format, + bool hasLinearImageFormatFeatureBits(angle::FormatID format, const VkFormatFeatureFlags featureBits) const; VkFormatFeatureFlags getLinearImageFormatFeatureBits( - VkFormat format, + angle::FormatID format, const VkFormatFeatureFlags featureBits) const; - VkFormatFeatureFlags getImageFormatFeatureBits(VkFormat format, + VkFormatFeatureFlags getImageFormatFeatureBits(angle::FormatID format, const VkFormatFeatureFlags featureBits) const; - bool hasImageFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits) const; - bool hasBufferFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits) const; + bool hasImageFormatFeatureBits(angle::FormatID format, + const VkFormatFeatureFlags featureBits) const; + bool hasBufferFormatFeatureBits(angle::FormatID format, + const VkFormatFeatureFlags featureBits) const; ANGLE_INLINE egl::ContextPriority getDriverPriority(egl::ContextPriority priority) { @@ -323,7 +325,7 @@ class RendererVk : angle::NonCopyable void outputVmaStatString(); - bool haveSameFormatFeatureBits(VkFormat fmt1, VkFormat fmt2) const; + bool haveSameFormatFeatureBits(angle::FormatID formatID1, angle::FormatID formatID2) const; angle::Result cleanupGarbage(Serial lastCompletedQueueSerial); @@ -386,11 +388,12 @@ class RendererVk : angle::NonCopyable bool *success); template - VkFormatFeatureFlags getFormatFeatureBits(VkFormat format, + VkFormatFeatureFlags getFormatFeatureBits(angle::FormatID formatID, const VkFormatFeatureFlags featureBits) const; template - bool hasFormatFeatureBits(VkFormat format, const VkFormatFeatureFlags featureBits) const; + bool hasFormatFeatureBits(angle::FormatID formatID, + const VkFormatFeatureFlags featureBits) const; egl::Display *mDisplay; @@ -453,7 +456,7 @@ class RendererVk : angle::NonCopyable bool mPipelineCacheInitialized; // A cache of VkFormatProperties as queried from the device over time. - mutable std::array mFormatProperties; + mutable angle::FormatMap mFormatProperties; // Latest validation data for debug overlay. std::string mLastValidationMessage; diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp index 2500a5a5f..c915fcfc9 100644 --- a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp +++ b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp @@ -136,10 +136,11 @@ angle::Result InitImageHelper(DisplayVk *displayVk, // causing it to be interpreted in a different colorspace. Create the VkImage accordingly. VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone; VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr; - VkFormat vkImageFormat = vkFormat.actualImageVkFormat; - VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB - ? vk::ConvertToLinear(vkImageFormat) - : vk::ConvertToSRGB(vkImageFormat); + angle::FormatID imageFormat = vkFormat.actualImageFormatID; + angle::FormatID imageListFormat = vkFormat.actualImageFormat().isSRGB + ? ConvertToLinear(imageFormat) + : ConvertToSRGB(imageFormat); + VkFormat imageListVkFormat = vk::GetVkFormatFromFormatID(imageListFormat); VkImageFormatListCreateInfoKHR formatListInfo = {}; if (renderer->getFeatures().supportsImageFormatList.enabled) @@ -151,7 +152,7 @@ angle::Result InitImageHelper(DisplayVk *displayVk, formatListInfo.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR; formatListInfo.pNext = nullptr; formatListInfo.viewFormatCount = 1; - formatListInfo.pViewFormats = &vkImageListFormat; + formatListInfo.pViewFormats = &imageListVkFormat; additionalCreateInfo = &formatListInfo; } @@ -680,7 +681,7 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk) surfaceFormats.data())); const vk::Format &format = renderer->getFormat(mState.config->renderTargetFormat); - VkFormat nativeFormat = format.actualImageVkFormat; + VkFormat nativeFormat = format.actualImageVkFormat(); if (surfaceFormatCount == 1u && surfaceFormats[0].format == VK_FORMAT_UNDEFINED) { @@ -929,7 +930,7 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context, VkDevice device = renderer->getDevice(); const vk::Format &format = renderer->getFormat(mState.config->renderTargetFormat); - VkFormat nativeFormat = format.actualImageVkFormat; + VkFormat nativeFormat = format.actualImageVkFormat(); gl::Extents rotatedExtents = extents; if (Is90DegreeRotation(getPreTransform())) diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp index 5def1b7cf..af65d93fe 100644 --- a/src/libANGLE/renderer/vulkan/TextureVk.cpp +++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp @@ -152,10 +152,10 @@ bool CanCopyWithDraw(RendererVk *renderer, { // Checks that the formats in copy by drawing have the appropriate feature bits bool srcFormatHasNecessaryFeature = - vk::FormatHasNecessaryFeature(renderer, srcFormat.actualImageVkFormat, srcTilingMode, + vk::FormatHasNecessaryFeature(renderer, srcFormat.actualImageFormatID, srcTilingMode, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); bool dstFormatHasNecessaryFeature = - vk::FormatHasNecessaryFeature(renderer, destFormat.actualImageVkFormat, destTilingMode, + vk::FormatHasNecessaryFeature(renderer, destFormat.actualImageFormatID, destTilingMode, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT); return srcFormatHasNecessaryFeature && dstFormatHasNecessaryFeature; @@ -180,7 +180,7 @@ bool CanGenerateMipmapWithCompute(RendererVk *renderer, // Format must have STORAGE support. const bool hasStorageSupport = renderer->hasImageFormatFeatureBits( - format.actualImageVkFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); + format.actualImageFormatID, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); // No support for sRGB formats yet. const bool isSRGB = angleFormat.isSRGB; @@ -1436,13 +1436,13 @@ void TextureVk::initImageUsageFlags(ContextVk *contextVk, const vk::Format &form { // Work around a bug in the Mock ICD: // https://github.com/KhronosGroup/Vulkan-Tools/issues/445 - if (renderer->hasImageFormatFeatureBits(format.actualImageVkFormat, + if (renderer->hasImageFormatFeatureBits(format.actualImageFormatID, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) { mImageUsageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; } } - else if (renderer->hasImageFormatFeatureBits(format.actualImageVkFormat, + else if (renderer->hasImageFormatFeatureBits(format.actualImageFormatID, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) { mImageUsageFlags |= @@ -1859,7 +1859,7 @@ angle::Result TextureVk::generateMipmap(const gl::Context *context) return generateMipmapsWithCompute(contextVk); } - else if (renderer->hasImageFormatFeatureBits(mImage->getFormat().actualImageVkFormat, + else if (renderer->hasImageFormatFeatureBits(mImage->getFormat().actualImageFormatID, kBlitFeatureFlags)) { // Otherwise, use blit if possible. @@ -2484,7 +2484,7 @@ bool TextureVk::shouldDecodeSRGB(ContextVk *contextVk, bool decodeSRGB = format.actualImageFormat().isSRGB; // If the SRGB override is enabled, we also decode SRGB. - if (isSRGBOverrideEnabled() && vk::IsOverridableLinearFormat(format.actualImageVkFormat)) + if (isSRGBOverrideEnabled() && IsOverridableLinearFormat(format.actualImageFormatID)) { decodeSRGB = true; } @@ -2558,7 +2558,7 @@ const vk::ImageView &TextureVk::getCopyImageViewAndRecordUse(ContextVk *contextV imageViews.retain(&contextVk->getResourceUseList()); ASSERT(mImage->getFormat().actualImageFormat().isSRGB == - (vk::ConvertToLinear(mImage->getFormat().actualImageVkFormat) != VK_FORMAT_UNDEFINED)); + (ConvertToLinear(mImage->getFormat().actualImageFormatID) != angle::FormatID::NONE)); if (mImage->getFormat().actualImageFormat().isSRGB) { return imageViews.getSRGBCopyImageView(); @@ -2598,7 +2598,7 @@ angle::Result TextureVk::getStorageImageView(ContextVk *contextVk, return getImageViews().getLevelLayerStorageImageView( contextVk, *mImage, nativeLevelVk, nativeLayer, - VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.actualImageVkFormat, + VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.actualImageFormatID, imageViewOut); } @@ -2606,7 +2606,7 @@ angle::Result TextureVk::getStorageImageView(ContextVk *contextVk, return getImageViews().getLevelStorageImageView( contextVk, mState.getType(), *mImage, nativeLevelVk, nativeLayer, - VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.actualImageVkFormat, + VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.actualImageFormatID, imageViewOut); } @@ -2648,13 +2648,15 @@ angle::Result TextureVk::initImage(ContextVk *contextVk, // With the introduction of sRGB related GLES extensions any texture could be respecified // causing it to be interpreted in a different colorspace. Create the VkImage accordingly. VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr; - VkFormat imageFormat = format.actualImageVkFormat; - VkFormat imageListFormat = format.actualImageFormat().isSRGB ? vk::ConvertToLinear(imageFormat) - : vk::ConvertToSRGB(imageFormat); + angle::FormatID imageFormat = format.actualImageFormatID; + angle::FormatID imageListFormat = format.actualImageFormat().isSRGB + ? ConvertToLinear(imageFormat) + : ConvertToSRGB(imageFormat); + VkFormat vkFormat = vk::GetVkFormatFromFormatID(imageListFormat); VkImageFormatListCreateInfoKHR formatListInfo = {}; if (renderer->getFeatures().supportsImageFormatList.enabled && - renderer->haveSameFormatFeatureBits(imageFormat, imageListFormat)) + renderer->haveSameFormatFeatureBits(format.actualImageFormatID, imageListFormat)) { mRequiresMutableStorage = true; @@ -2665,7 +2667,7 @@ angle::Result TextureVk::initImage(ContextVk *contextVk, formatListInfo.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR; formatListInfo.pNext = nullptr; formatListInfo.viewFormatCount = 1; - formatListInfo.pViewFormats = &imageListFormat; + formatListInfo.pViewFormats = &vkFormat; additionalCreateInfo = &formatListInfo; } diff --git a/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp b/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp index 8839f5d45..e83dde3a5 100644 --- a/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp +++ b/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp @@ -82,10 +82,14 @@ egl::Error HardwareBufferImageSiblingVkAndroid::ValidateHardwareBuffer(RendererV << bufferFormatProperties.externalFormat << " is unsupported "; } } - else if (!HasFullTextureFormatSupport(renderer, bufferFormatProperties.format)) + else { - return egl::EglBadParameter() - << "AHardwareBuffer format does not support enough features to use as a texture."; + angle::FormatID formatID = vk::GetFormatIDFromVkFormat(bufferFormatProperties.format); + if (!HasFullTextureFormatSupport(renderer, formatID)) + { + return egl::EglBadParameter() << "AHardwareBuffer format does not support enough " + "features to use as a texture."; + } } return egl::NoError(); @@ -199,10 +203,11 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk // With the introduction of sRGB related GLES extensions any texture could be respecified // causing it to be interpreted in a different colorspace. Create the VkImage accordingly. VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone; - VkFormat vkImageFormat = vkFormat.actualImageVkFormat; - VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB - ? vk::ConvertToLinear(vkImageFormat) - : vk::ConvertToSRGB(vkImageFormat); + angle::FormatID imageFormatID = vkFormat.actualImageFormatID; + angle::FormatID imageListFormatID = vkFormat.actualImageFormat().isSRGB + ? ConvertToLinear(imageFormatID) + : ConvertToSRGB(imageFormatID); + VkFormat imageListVkFormat = vk::GetVkFormatFromFormatID(imageListFormatID); VkImageFormatListCreateInfoKHR formatListInfo = {}; if (renderer->getFeatures().supportsImageFormatList.enabled) @@ -213,7 +218,7 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk // There is just 1 additional format we might use to create a VkImageView for this VkImage formatListInfo.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR; formatListInfo.viewFormatCount = 1; - formatListInfo.pViewFormats = &vkImageListFormat; + formatListInfo.pViewFormats = &imageListVkFormat; externalFormat.pNext = &formatListInfo; } @@ -290,15 +295,15 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk constexpr uint32_t kColorRenderableRequiredBits = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; constexpr uint32_t kDepthStencilRenderableRequiredBits = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; - mRenderable = renderer->hasImageFormatFeatureBits(vkFormat.actualImageVkFormat, + mRenderable = renderer->hasImageFormatFeatureBits(vkFormat.actualImageFormatID, kColorRenderableRequiredBits) || - renderer->hasImageFormatFeatureBits(vkFormat.actualImageVkFormat, + renderer->hasImageFormatFeatureBits(vkFormat.actualImageFormatID, kDepthStencilRenderableRequiredBits); constexpr uint32_t kTextureableRequiredBits = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; mTextureable = - renderer->hasImageFormatFeatureBits(vkFormat.actualImageVkFormat, kTextureableRequiredBits); + renderer->hasImageFormatFeatureBits(vkFormat.actualImageFormatID, kTextureableRequiredBits); return angle::Result::Continue; } diff --git a/src/libANGLE/renderer/vulkan/gen_vk_format_table.py b/src/libANGLE/renderer/vulkan/gen_vk_format_table.py index 947138f0f..30537178b 100644 --- a/src/libANGLE/renderer/vulkan/gen_vk_format_table.py +++ b/src/libANGLE/renderer/vulkan/gen_vk_format_table.py @@ -7,7 +7,6 @@ # Code generation for vk format map. See vk_format_map.json for data source. # NOTE: don't run this script directly. Run scripts/run_code_generation.py. -from datetime import date import json import math import pprint @@ -21,7 +20,7 @@ import angle_format template_table_autogen_cpp = """// GENERATED FILE - DO NOT EDIT. // Generated by {script_name} using data from {input_file_name} // -// Copyright {copyright_year} The ANGLE Project Authors. All rights reserved. +// Copyright 2020 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -38,7 +37,6 @@ using namespace angle; namespace rx {{ - namespace vk {{ @@ -54,8 +52,25 @@ void Format::initialize(RendererVk *renderer, }} }} -}} // namespace vk +VkFormat GetVkFormatFromFormatID(angle::FormatID formatID) +{{ + static constexpr angle::FormatMap kMap = {{ +{format_id_cases} + }}; + return kMap[formatID]; +}} + +angle::FormatID GetFormatIDFromVkFormat(VkFormat vkFormat) +{{ + switch (vkFormat) + {{ +{vk_format_cases} + default: + return angle::FormatID::NONE; + }} +}} +}} // namespace vk }} // namespace rx """ @@ -72,10 +87,9 @@ break; """ image_basic_template = """actualImageFormatID = {image}; -actualImageVkFormat = {vk_image_format}; imageInitializerFunction = {image_initializer};""" -image_struct_template = "{{{image}, {vk_image_format}, {image_initializer}}}" +image_struct_template = "{{{image}, {image_initializer}}}" image_fallback_template = """{{ static constexpr ImageFormatInitInfo kInfo[] = {{{image_list}}}; @@ -83,12 +97,11 @@ initImageFallback(renderer, kInfo, ArraySize(kInfo)); }}""" buffer_basic_template = """actualBufferFormatID = {buffer}; -actualBufferVkFormat = {vk_buffer_format}; vkBufferFormatIsPacked = {vk_buffer_format_is_packed}; vertexLoadFunction = {vertex_load_function}; vertexLoadRequiresConversion = {vertex_load_converts};""" -buffer_struct_template = """{{{buffer}, {vk_buffer_format}, {vk_buffer_format_is_packed}, +buffer_struct_template = """{{{buffer}, {vk_buffer_format_is_packed}, {vertex_load_function}, {vertex_load_converts}}}""" buffer_fallback_template = """{{ @@ -170,7 +183,6 @@ def gen_format_case(angle, internal_format, vk_json_data): def image_args(format): return dict( image="angle::FormatID::" + format, - vk_image_format=vk_map[format], image_initializer=angle_format.get_internal_format_initializer( internal_format, format)) @@ -178,7 +190,6 @@ def gen_format_case(angle, internal_format, vk_json_data): vk_buffer_format = vk_map[format] return dict( buffer="angle::FormatID::" + format, - vk_buffer_format=vk_buffer_format, vk_buffer_format_is_packed=is_packed(vk_buffer_format), vertex_load_function=get_vertex_copy_function(angle, format, vk_buffer_format), vertex_load_converts='false' if angle == format else 'true', @@ -207,6 +218,17 @@ def gen_format_case(angle, internal_format, vk_json_data): return format_entry_template.format(**args).format(**args) +def get_format_id_case(format_id, vk_format): + return "{angle::FormatID::%s, %s}" % (format_id, vk_format) + + +def get_vk_format_case(format_id, vk_format): + return """\ + case %s: + return angle::FormatID::%s; +""" % (vk_format, format_id) + + def main(): input_file_name = 'vk_format_map.json' @@ -232,13 +254,24 @@ def main(): if not verify_vk_map_keys(angle_to_gl, vk_json_data): return 1 + format_id_cases = [ + get_format_id_case(format_id, vk_format) + for format_id, vk_format in vk_json_data["map"].iteritems() + ] + + vk_format_cases = [ + get_vk_format_case(format_id, vk_format) + for format_id, vk_format in vk_json_data["map"].iteritems() + ] + vk_cases = [ gen_format_case(angle, gl, vk_json_data) for angle, gl in sorted(angle_to_gl.iteritems()) ] output_cpp = template_table_autogen_cpp.format( - copyright_year=date.today().year, format_case_data="\n".join(vk_cases), + format_id_cases=",\n".join(format_id_cases), + vk_format_cases="".join(vk_format_cases), script_name=__file__, out_file_name=out_file_name, input_file_name=input_file_name) diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp index dd1c3ec36..06126e4f6 100644 --- a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp @@ -155,7 +155,7 @@ void UnpackAttachmentDesc(VkAttachmentDescription *desc, { // We would only need this flag for duplicated attachments. Apply it conservatively. desc->flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT; - desc->format = format.actualImageVkFormat; + desc->format = format.actualImageVkFormat(); desc->samples = gl_vk::GetSamples(samples); desc->loadOp = static_cast(ops.loadOp); desc->storeOp = @@ -179,7 +179,7 @@ void UnpackColorResolveAttachmentDesc(VkAttachmentDescription *desc, // attachments simultaneously, so this flag can likely be removed without any issue if it incurs // a performance penalty. desc->flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT; - desc->format = format.actualImageVkFormat; + desc->format = format.actualImageVkFormat(); // This function is for color resolve attachments. const angle::Format &angleFormat = format.actualImageFormat(); @@ -212,7 +212,7 @@ void UnpackDepthStencilResolveAttachmentDesc(VkAttachmentDescription *desc, // There cannot be simultaneous usages of the depth/stencil resolve image, as depth/stencil // resolve currently only comes from depth/stencil renderbuffers. desc->flags = 0; - desc->format = format.actualImageVkFormat; + desc->format = format.actualImageVkFormat(); // This function is for depth/stencil resolve attachment. const angle::Format &angleFormat = format.intendedFormat(); @@ -1712,8 +1712,7 @@ angle::Result GraphicsPipelineDesc::initializePipeline( angle::FormatID formatID = static_cast(packedAttrib.format); const Format &format = contextVk->getRenderer()->getFormat(formatID); const angle::Format &angleFormat = format.intendedFormat(); - VkFormat vkFormat = packedAttrib.compressed ? format.actualCompressedBufferVkFormat - : format.actualBufferVkFormat; + VkFormat vkFormat = format.actualBufferVkFormat(packedAttrib.compressed); gl::ComponentType attribType = GetVertexAttributeComponentType(angleFormat.isPureInt(), angleFormat.vertexAttribType); diff --git a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp index a63ddcb16..ef9457dc6 100644 --- a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp @@ -40,12 +40,12 @@ bool HasShaderImageAtomicsSupport(const RendererVk *rendererVk, const Format &formatVk = rendererVk->getFormat(GL_R32F); const bool hasImageAtomicSupport = rendererVk->hasImageFormatFeatureBits( - formatVk.actualImageVkFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT); + formatVk.actualImageFormatID, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT); bool hasBufferAtomicSupport = true; if (supportedExtensions.textureBufferAny()) { hasBufferAtomicSupport = rendererVk->hasBufferFormatFeatureBits( - formatVk.actualBufferVkFormat, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT); + formatVk.actualBufferFormatID, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT); } return hasImageAtomicSupport && hasBufferAtomicSupport; @@ -65,12 +65,19 @@ bool FormatReinterpretationSupported(const std::vector &optionalSizedFor { const Format &vkFormat = rendererVk->getFormat(glFormat); - VkFormat reinterpretedFormat = checkLinearColorspace - ? ConvertToLinear(vkFormat.actualImageVkFormat) - : ConvertToSRGB(vkFormat.actualImageVkFormat); + angle::FormatID reinterpretedFormatID = + checkLinearColorspace ? ConvertToLinear(vkFormat.actualImageFormatID) + : ConvertToSRGB(vkFormat.actualImageFormatID); - if (!rendererVk->haveSameFormatFeatureBits(vkFormat.actualImageVkFormat, - reinterpretedFormat)) + const Format &reinterpretedVkFormat = rendererVk->getFormat(reinterpretedFormatID); + + if (reinterpretedVkFormat.actualImageFormatID != reinterpretedFormatID) + { + return false; + } + + if (!rendererVk->haveSameFormatFeatureBits(vkFormat.actualImageFormatID, + reinterpretedFormatID)) { return false; } @@ -179,7 +186,7 @@ bool HasTexelBufferSupport(const RendererVk *rendererVk, GLenum formatGL) const Format &formatVk = rendererVk->getFormat(formatGL); return rendererVk->hasBufferFormatFeatureBits( - formatVk.actualBufferVkFormat, + formatVk.actualBufferFormatID, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT); } diff --git a/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp b/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp index aef9bee07..0d4799c77 100644 --- a/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp +++ b/src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp @@ -18,7 +18,6 @@ using namespace angle; namespace rx { - namespace vk { @@ -29,7 +28,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A16_FLOAT: intendedGLFormat = GL_ALPHA16F_EXT; actualImageFormatID = angle::FormatID::R16_FLOAT; - actualImageVkFormat = VK_FORMAT_R16_SFLOAT; imageInitializerFunction = nullptr; break; @@ -37,10 +35,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A1R5G5B5_UNORM: intendedGLFormat = GL_A1RGB5_ANGLEX; actualImageFormatID = angle::FormatID::A1R5G5B5_UNORM; - actualImageVkFormat = VK_FORMAT_A1R5G5B5_UNORM_PACK16; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::A1R5G5B5_UNORM; - actualBufferVkFormat = VK_FORMAT_A1R5G5B5_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -49,10 +45,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A2R10G10B10_SINT_VERTEX: intendedGLFormat = GL_INT_10_10_10_2_OES; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyW2XYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -61,10 +55,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A2R10G10B10_SNORM_VERTEX: intendedGLFormat = GL_A2_RGB10_SNORM_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyW2XYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -73,10 +65,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A2R10G10B10_SSCALED_VERTEX: intendedGLFormat = GL_A2_RGB10_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyW2XYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -85,10 +75,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A2R10G10B10_UINT_VERTEX: intendedGLFormat = GL_UNSIGNED_INT_10_10_10_2_OES; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyW2XYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -97,10 +85,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A2R10G10B10_UNORM_VERTEX: intendedGLFormat = GL_A2_RGB10_UNORM_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyW2XYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -109,10 +95,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A2R10G10B10_USCALED_VERTEX: intendedGLFormat = GL_A2_RGB10_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyW2XYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -121,7 +105,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A32_FLOAT: intendedGLFormat = GL_ALPHA32F_EXT; actualImageFormatID = angle::FormatID::R32_FLOAT; - actualImageVkFormat = VK_FORMAT_R32_SFLOAT; imageInitializerFunction = nullptr; break; @@ -129,7 +112,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::A8_UNORM: intendedGLFormat = GL_ALPHA8_EXT; actualImageFormatID = angle::FormatID::R8_UNORM; - actualImageVkFormat = VK_FORMAT_R8_UNORM; imageInitializerFunction = nullptr; break; @@ -137,10 +119,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x10_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; actualImageFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x10_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x10_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x10_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -149,10 +129,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x10_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR; actualImageFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x10_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x10_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x10_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -161,10 +139,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x5_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; actualImageFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x5_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x5_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x5_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -173,10 +149,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x5_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR; actualImageFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x5_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x5_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x5_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -185,10 +159,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x6_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; actualImageFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x6_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x6_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x6_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -197,10 +169,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x6_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR; actualImageFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x6_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x6_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x6_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -209,10 +179,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x8_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; actualImageFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x8_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x8_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x8_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -221,10 +189,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_10x8_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR; actualImageFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_10x8_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_10x8_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_10x8_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -233,10 +199,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_12x10_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; actualImageFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_12x10_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_12x10_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_12x10_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -245,10 +209,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_12x10_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR; actualImageFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_12x10_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_12x10_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_12x10_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -257,10 +219,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_12x12_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; actualImageFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_12x12_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_12x12_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_12x12_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -269,10 +229,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_12x12_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR; actualImageFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_12x12_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_12x12_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_12x12_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -297,10 +255,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_4x4_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; actualImageFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_4x4_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_4x4_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_4x4_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -309,10 +265,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_4x4_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; actualImageFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_4x4_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_4x4_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_4x4_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -337,10 +291,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_5x4_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; actualImageFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_5x4_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_5x4_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_5x4_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -349,10 +301,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_5x4_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR; actualImageFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_5x4_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_5x4_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_5x4_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -369,10 +319,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_5x5_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; actualImageFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_5x5_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_5x5_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_5x5_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -381,10 +329,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_5x5_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR; actualImageFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_5x5_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_5x5_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_5x5_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -409,10 +355,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_6x5_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; actualImageFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_6x5_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_6x5_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_6x5_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -421,10 +365,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_6x5_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR; actualImageFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_6x5_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_6x5_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_6x5_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -441,10 +383,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_6x6_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; actualImageFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_6x6_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_6x6_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_6x6_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -453,10 +393,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_6x6_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR; actualImageFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_6x6_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_6x6_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_6x6_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -481,10 +419,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_8x5_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; actualImageFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_8x5_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_8x5_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_8x5_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -493,10 +429,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_8x5_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR; actualImageFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_8x5_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_8x5_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_8x5_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -505,10 +439,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_8x6_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; actualImageFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_8x6_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_8x6_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_8x6_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -517,10 +449,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_8x6_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR; actualImageFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_8x6_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_8x6_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_8x6_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -529,10 +459,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_8x8_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; actualImageFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_8x8_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_8x8_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_8x8_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -541,10 +469,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::ASTC_8x8_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; actualImageFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_ASTC_8x8_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::ASTC_8x8_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ASTC_8x8_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -553,10 +479,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B10G10R10A2_UNORM: intendedGLFormat = GL_BGR10_A2_ANGLEX; actualImageFormatID = angle::FormatID::B10G10R10A2_UNORM; - actualImageVkFormat = VK_FORMAT_A2R10G10B10_UNORM_PACK32; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::B10G10R10A2_UNORM; - actualBufferVkFormat = VK_FORMAT_A2R10G10B10_UNORM_PACK32; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -565,10 +489,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B4G4R4A4_UNORM: intendedGLFormat = GL_BGRA4_ANGLEX; actualImageFormatID = angle::FormatID::B4G4R4A4_UNORM; - actualImageVkFormat = VK_FORMAT_B4G4R4A4_UNORM_PACK16; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::B4G4R4A4_UNORM; - actualBufferVkFormat = VK_FORMAT_B4G4R4A4_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -577,10 +499,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B5G5R5A1_UNORM: intendedGLFormat = GL_BGR5_A1_ANGLEX; actualImageFormatID = angle::FormatID::B5G5R5A1_UNORM; - actualImageVkFormat = VK_FORMAT_B5G5R5A1_UNORM_PACK16; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::B5G5R5A1_UNORM; - actualBufferVkFormat = VK_FORMAT_B5G5R5A1_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -589,10 +509,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B5G6R5_UNORM: intendedGLFormat = GL_BGR565_ANGLEX; actualImageFormatID = angle::FormatID::B5G6R5_UNORM; - actualImageVkFormat = VK_FORMAT_B5G6R5_UNORM_PACK16; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::B5G6R5_UNORM; - actualBufferVkFormat = VK_FORMAT_B5G6R5_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -609,10 +527,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B8G8R8A8_UNORM: intendedGLFormat = GL_BGRA8_EXT; actualImageFormatID = angle::FormatID::B8G8R8A8_UNORM; - actualImageVkFormat = VK_FORMAT_B8G8R8A8_UNORM; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::B8G8R8A8_UNORM; - actualBufferVkFormat = VK_FORMAT_B8G8R8A8_UNORM; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -621,10 +537,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B8G8R8A8_UNORM_SRGB: intendedGLFormat = GL_BGRA8_SRGB_ANGLEX; actualImageFormatID = angle::FormatID::B8G8R8A8_UNORM_SRGB; - actualImageVkFormat = VK_FORMAT_B8G8R8A8_SRGB; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::B8G8R8A8_UNORM_SRGB; - actualBufferVkFormat = VK_FORMAT_B8G8R8A8_SRGB; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -633,10 +547,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::B8G8R8X8_UNORM: intendedGLFormat = GL_BGRX8_ANGLEX; actualImageFormatID = angle::FormatID::B8G8R8A8_UNORM; - actualImageVkFormat = VK_FORMAT_B8G8R8A8_UNORM; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::NONE; - actualBufferVkFormat = VK_FORMAT_UNDEFINED; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = true; @@ -645,10 +557,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC1_RGBA_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; actualImageFormatID = angle::FormatID::BC1_RGBA_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC1_RGBA_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC1_RGBA_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC1_RGBA_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -657,10 +567,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; actualImageFormatID = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_BC1_RGBA_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC1_RGBA_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -669,10 +577,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC1_RGB_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; actualImageFormatID = angle::FormatID::BC1_RGB_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC1_RGB_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC1_RGB_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC1_RGB_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -681,10 +587,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; actualImageFormatID = angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_BC1_RGB_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC1_RGB_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -693,10 +597,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC2_RGBA_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE; actualImageFormatID = angle::FormatID::BC2_RGBA_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC2_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC2_RGBA_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC2_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -705,10 +607,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; actualImageFormatID = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_BC2_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC2_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -717,10 +617,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC3_RGBA_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE; actualImageFormatID = angle::FormatID::BC3_RGBA_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC3_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC3_RGBA_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC3_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -729,10 +627,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; actualImageFormatID = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK; - actualImageVkFormat = VK_FORMAT_BC3_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC3_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -741,10 +637,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC4_RED_SNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_SIGNED_RED_RGTC1_EXT; actualImageFormatID = angle::FormatID::BC4_RED_SNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC4_SNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC4_RED_SNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC4_SNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -753,10 +647,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC4_RED_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RED_RGTC1_EXT; actualImageFormatID = angle::FormatID::BC4_RED_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC4_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC4_RED_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC4_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -765,10 +657,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC5_RG_SNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; actualImageFormatID = angle::FormatID::BC5_RG_SNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC5_SNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC5_RG_SNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC5_SNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -777,10 +667,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BC5_RG_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RED_GREEN_RGTC2_EXT; actualImageFormatID = angle::FormatID::BC5_RG_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC5_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BC5_RG_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC5_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -789,10 +677,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BPTC_RGBA_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_EXT; actualImageFormatID = angle::FormatID::BPTC_RGBA_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC7_UNORM_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BPTC_RGBA_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC7_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -801,10 +687,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK: intendedGLFormat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; actualImageFormatID = angle::FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK; - actualImageVkFormat = VK_FORMAT_BC6H_SFLOAT_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC6H_SFLOAT_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -813,10 +697,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK: intendedGLFormat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; actualImageFormatID = angle::FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK; - actualImageVkFormat = VK_FORMAT_BC6H_UFLOAT_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC6H_UFLOAT_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -825,10 +707,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK: intendedGLFormat = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT; actualImageFormatID = angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK; - actualImageVkFormat = VK_FORMAT_BC7_SRGB_BLOCK; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_BC7_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -837,10 +717,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::D16_UNORM: intendedGLFormat = GL_DEPTH_COMPONENT16; actualImageFormatID = angle::FormatID::D16_UNORM; - actualImageVkFormat = VK_FORMAT_D16_UNORM; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::D16_UNORM; - actualBufferVkFormat = VK_FORMAT_D16_UNORM; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -850,13 +728,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_DEPTH24_STENCIL8; { static constexpr ImageFormatInitInfo kInfo[] = { - {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}}; + {angle::FormatID::D24_UNORM_S8_UINT, nullptr}, + {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}, + {angle::FormatID::D24_UNORM_S8_UINT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::D24_UNORM_S8_UINT; - actualBufferVkFormat = VK_FORMAT_D24_UNORM_S8_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -866,13 +743,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_DEPTH_COMPONENT24; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::D24_UNORM_X8_UINT, VK_FORMAT_X8_D24_UNORM_PACK32, 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}}; + {angle::FormatID::D24_UNORM_X8_UINT, nullptr}, + {angle::FormatID::D24_UNORM_S8_UINT, nullptr}, + {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::D24_UNORM_X8_UINT; - actualBufferVkFormat = VK_FORMAT_X8_D24_UNORM_PACK32; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -881,10 +757,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::D32_FLOAT: intendedGLFormat = GL_DEPTH_COMPONENT32F; actualImageFormatID = angle::FormatID::D32_FLOAT; - actualImageVkFormat = VK_FORMAT_D32_SFLOAT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::D32_FLOAT; - actualBufferVkFormat = VK_FORMAT_D32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -894,13 +768,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_DEPTH32F_STENCIL8; { static constexpr ImageFormatInitInfo kInfo[] = { - {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}}; + {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}, + {angle::FormatID::D24_UNORM_S8_UINT, nullptr}, + {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::D32_FLOAT_S8X24_UINT; - actualBufferVkFormat = VK_FORMAT_D32_SFLOAT_S8_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -910,12 +783,11 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_DEPTH_COMPONENT32_OES; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr}, - {angle::FormatID::D32_FLOAT, VK_FORMAT_D32_SFLOAT, nullptr}}; + {angle::FormatID::D24_UNORM_S8_UINT, nullptr}, + {angle::FormatID::D32_FLOAT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::NONE; - actualBufferVkFormat = VK_FORMAT_UNDEFINED; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = true; @@ -925,14 +797,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_SIGNED_RG11_EAC; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::EAC_R11G11_SNORM_BLOCK, VK_FORMAT_EAC_R11G11_SNORM_BLOCK, - nullptr}, - {angle::FormatID::R16G16_SNORM, VK_FORMAT_R16G16_SNORM, nullptr}, - {angle::FormatID::R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT, nullptr}}; + {angle::FormatID::EAC_R11G11_SNORM_BLOCK, nullptr}, + {angle::FormatID::R16G16_SNORM, nullptr}, + {angle::FormatID::R16G16_FLOAT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::EAC_R11G11_SNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_EAC_R11G11_SNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -942,14 +812,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_RG11_EAC; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::EAC_R11G11_UNORM_BLOCK, VK_FORMAT_EAC_R11G11_UNORM_BLOCK, - nullptr}, - {angle::FormatID::R16G16_UNORM, VK_FORMAT_R16G16_UNORM, nullptr}, - {angle::FormatID::R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT, nullptr}}; + {angle::FormatID::EAC_R11G11_UNORM_BLOCK, nullptr}, + {angle::FormatID::R16G16_UNORM, nullptr}, + {angle::FormatID::R16G16_FLOAT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::EAC_R11G11_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_EAC_R11G11_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -959,13 +827,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_SIGNED_R11_EAC; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::EAC_R11_SNORM_BLOCK, VK_FORMAT_EAC_R11_SNORM_BLOCK, nullptr}, - {angle::FormatID::R16_SNORM, VK_FORMAT_R16_SNORM, nullptr}, - {angle::FormatID::R16_FLOAT, VK_FORMAT_R16_SFLOAT, nullptr}}; + {angle::FormatID::EAC_R11_SNORM_BLOCK, nullptr}, + {angle::FormatID::R16_SNORM, nullptr}, + {angle::FormatID::R16_FLOAT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::EAC_R11_SNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_EAC_R11_SNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -975,13 +842,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_R11_EAC; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::EAC_R11_UNORM_BLOCK, VK_FORMAT_EAC_R11_UNORM_BLOCK, nullptr}, - {angle::FormatID::R16_UNORM, VK_FORMAT_R16_UNORM, nullptr}, - {angle::FormatID::R16_FLOAT, VK_FORMAT_R16_SFLOAT, nullptr}}; + {angle::FormatID::EAC_R11_UNORM_BLOCK, nullptr}, + {angle::FormatID::R16_UNORM, nullptr}, + {angle::FormatID::R16_FLOAT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::EAC_R11_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_EAC_R11_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -995,14 +861,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_ETC1_RGB8_OES; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, - nullptr}, - {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, + {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::NONE; - actualBufferVkFormat = VK_FORMAT_UNDEFINED; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = true; @@ -1012,13 +876,11 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, - nullptr}, - {angle::FormatID::R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB, nullptr}}; + {angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1029,14 +891,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) { static constexpr ImageFormatInitInfo kInfo[] = { {angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK, - VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK, Initialize4ComponentData}, - {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, + {angle::FormatID::R8G8B8A8_UNORM, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1046,13 +906,11 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, - nullptr}, - {angle::FormatID::R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB, nullptr}}; + {angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1062,13 +920,11 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, - VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, nullptr}, - {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, nullptr}}; + {angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1078,14 +934,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_SRGB8_ETC2; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, - nullptr}, - {angle::FormatID::R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB, + {angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK; - actualBufferVkFormat = VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1095,14 +949,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_COMPRESSED_RGB8_ETC2; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, - nullptr}, - {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, + {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK; - actualBufferVkFormat = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1111,7 +963,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::L16A16_FLOAT: intendedGLFormat = GL_LUMINANCE_ALPHA16F_EXT; actualImageFormatID = angle::FormatID::R16G16_FLOAT; - actualImageVkFormat = VK_FORMAT_R16G16_SFLOAT; imageInitializerFunction = nullptr; break; @@ -1119,7 +970,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::L16_FLOAT: intendedGLFormat = GL_LUMINANCE16F_EXT; actualImageFormatID = angle::FormatID::R16_FLOAT; - actualImageVkFormat = VK_FORMAT_R16_SFLOAT; imageInitializerFunction = nullptr; break; @@ -1127,7 +977,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::L32A32_FLOAT: intendedGLFormat = GL_LUMINANCE_ALPHA32F_EXT; actualImageFormatID = angle::FormatID::R32G32_FLOAT; - actualImageVkFormat = VK_FORMAT_R32G32_SFLOAT; imageInitializerFunction = nullptr; break; @@ -1135,7 +984,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::L32_FLOAT: intendedGLFormat = GL_LUMINANCE32F_EXT; actualImageFormatID = angle::FormatID::R32_FLOAT; - actualImageVkFormat = VK_FORMAT_R32_SFLOAT; imageInitializerFunction = nullptr; break; @@ -1143,7 +991,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::L8A8_UNORM: intendedGLFormat = GL_LUMINANCE8_ALPHA8_EXT; actualImageFormatID = angle::FormatID::R8G8_UNORM; - actualImageVkFormat = VK_FORMAT_R8G8_UNORM; imageInitializerFunction = nullptr; break; @@ -1151,7 +998,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::L8_UNORM: intendedGLFormat = GL_LUMINANCE8_EXT; actualImageFormatID = angle::FormatID::R8_UNORM; - actualImageVkFormat = VK_FORMAT_R8_UNORM; imageInitializerFunction = nullptr; break; @@ -1159,10 +1005,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::NONE: intendedGLFormat = GL_NONE; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::NONE; - actualBufferVkFormat = VK_FORMAT_UNDEFINED; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -1203,13 +1047,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10A2_SINT: intendedGLFormat = GL_RGB10_A2_SINT_ANGLEX; actualImageFormatID = angle::FormatID::R10G10B10A2_SINT; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_SINT_PACK32; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R10G10B10A2_SINT, VK_FORMAT_A2B10G10R10_SINT_PACK32, true, - CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT, false, + {angle::FormatID::R10G10B10A2_SINT, true, CopyNativeVertexData, + false}, + {angle::FormatID::R16G16B16A16_SINT, false, CopyXYZ10W2ToXYZW32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1218,13 +1061,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10A2_SNORM: intendedGLFormat = GL_RGB10_A2_SNORM_ANGLEX; actualImageFormatID = angle::FormatID::R10G10B10A2_SNORM; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_SNORM_PACK32; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R10G10B10A2_SNORM, VK_FORMAT_A2B10G10R10_SNORM_PACK32, true, + {angle::FormatID::R10G10B10A2_SNORM, true, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyXYZ10W2ToXYZW32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1233,13 +1075,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10A2_SSCALED: intendedGLFormat = GL_RGB10_A2_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R10G10B10A2_SSCALED; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_SSCALED_PACK32; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R10G10B10A2_SSCALED, VK_FORMAT_A2B10G10R10_SSCALED_PACK32, - true, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R10G10B10A2_SSCALED, true, + CopyNativeVertexData, false}, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyXYZ10W2ToXYZW32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1248,13 +1089,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10A2_UINT: intendedGLFormat = GL_RGB10_A2UI; actualImageFormatID = angle::FormatID::R10G10B10A2_UINT; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_UINT_PACK32; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R10G10B10A2_UINT, VK_FORMAT_A2B10G10R10_UINT_PACK32, true, - CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT, false, + {angle::FormatID::R10G10B10A2_UINT, true, CopyNativeVertexData, + false}, + {angle::FormatID::R16G16B16A16_UINT, false, CopyXYZ10W2ToXYZW32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1263,10 +1103,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10A2_UNORM: intendedGLFormat = GL_RGB10_A2; actualImageFormatID = angle::FormatID::R10G10B10A2_UNORM; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_UNORM_PACK32; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R10G10B10A2_UNORM; - actualBufferVkFormat = VK_FORMAT_A2B10G10R10_UNORM_PACK32; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1275,13 +1113,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10A2_USCALED: intendedGLFormat = GL_RGB10_A2_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R10G10B10A2_USCALED; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_USCALED_PACK32; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R10G10B10A2_USCALED, VK_FORMAT_A2B10G10R10_USCALED_PACK32, - true, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R10G10B10A2_USCALED, true, + CopyNativeVertexData, false}, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyXYZ10W2ToXYZW32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1290,10 +1127,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R10G10B10X2_UNORM: intendedGLFormat = GL_RGB10_UNORM_ANGLEX; actualImageFormatID = angle::FormatID::R10G10B10A2_UNORM; - actualImageVkFormat = VK_FORMAT_A2B10G10R10_UNORM_PACK32; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::NONE; - actualBufferVkFormat = VK_FORMAT_UNDEFINED; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = true; @@ -1302,10 +1137,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R11G11B10_FLOAT: intendedGLFormat = GL_R11F_G11F_B10F; actualImageFormatID = angle::FormatID::R11G11B10_FLOAT; - actualImageVkFormat = VK_FORMAT_B10G11R11_UFLOAT_PACK32; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R11G11B10_FLOAT; - actualBufferVkFormat = VK_FORMAT_B10G11R11_UFLOAT_PACK32; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1314,10 +1147,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_FLOAT: intendedGLFormat = GL_RGBA16F; actualImageFormatID = angle::FormatID::R16G16B16A16_FLOAT; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_SFLOAT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16G16B16A16_FLOAT; - actualBufferVkFormat = VK_FORMAT_R16G16B16A16_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1326,10 +1157,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_SINT: intendedGLFormat = GL_RGBA16I; actualImageFormatID = angle::FormatID::R16G16B16A16_SINT; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16G16B16A16_SINT; - actualBufferVkFormat = VK_FORMAT_R16G16B16A16_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1338,13 +1167,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_SNORM: intendedGLFormat = GL_RGBA16_SNORM_EXT; actualImageFormatID = angle::FormatID::R16G16B16A16_SNORM; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_SNORM, false, + {angle::FormatID::R16G16B16A16_SNORM, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1353,13 +1181,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_SSCALED: intendedGLFormat = GL_RGBA16_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16G16B16A16_SSCALED; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16A16_SSCALED, VK_FORMAT_R16G16B16A16_SSCALED, false, + {angle::FormatID::R16G16B16A16_SSCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1368,10 +1195,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_UINT: intendedGLFormat = GL_RGBA16UI; actualImageFormatID = angle::FormatID::R16G16B16A16_UINT; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16G16B16A16_UINT; - actualBufferVkFormat = VK_FORMAT_R16G16B16A16_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1380,13 +1205,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_UNORM: intendedGLFormat = GL_RGBA16_EXT; actualImageFormatID = angle::FormatID::R16G16B16A16_UNORM; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_UNORM, false, + {angle::FormatID::R16G16B16A16_UNORM, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1395,13 +1219,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16A16_USCALED: intendedGLFormat = GL_RGBA16_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16G16B16A16_USCALED; - actualImageVkFormat = VK_FORMAT_R16G16B16A16_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16A16_USCALED, VK_FORMAT_R16G16B16A16_USCALED, false, + {angle::FormatID::R16G16B16A16_USCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1411,16 +1234,16 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB16F; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_FLOAT, VK_FORMAT_R16G16B16_SFLOAT, nullptr}, - {angle::FormatID::R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, + {angle::FormatID::R16G16B16_FLOAT, nullptr}, + {angle::FormatID::R16G16B16A16_FLOAT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_FLOAT, VK_FORMAT_R16G16B16_SFLOAT, false, - CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, false, + {angle::FormatID::R16G16B16_FLOAT, false, CopyNativeVertexData, + false}, + {angle::FormatID::R16G16B16A16_FLOAT, false, CopyNativeVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1430,16 +1253,16 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB16I; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_SINT, VK_FORMAT_R16G16B16_SINT, nullptr}, - {angle::FormatID::R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT, + {angle::FormatID::R16G16B16_SINT, nullptr}, + {angle::FormatID::R16G16B16A16_SINT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_SINT, VK_FORMAT_R16G16B16_SINT, false, - CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT, false, + {angle::FormatID::R16G16B16_SINT, false, CopyNativeVertexData, + false}, + {angle::FormatID::R16G16B16A16_SINT, false, CopyNativeVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1448,13 +1271,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16_SNORM: intendedGLFormat = GL_RGB16_SNORM_EXT; actualImageFormatID = angle::FormatID::R16G16B16_SNORM; - actualImageVkFormat = VK_FORMAT_R16G16B16_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_SNORM, VK_FORMAT_R16G16B16_SNORM, false, + {angle::FormatID::R16G16B16_SNORM, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1463,13 +1285,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16_SSCALED: intendedGLFormat = GL_RGB16_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16G16B16_SSCALED; - actualImageVkFormat = VK_FORMAT_R16G16B16_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_SSCALED, VK_FORMAT_R16G16B16_SSCALED, false, + {angle::FormatID::R16G16B16_SSCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1479,16 +1300,16 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB16UI; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_UINT, VK_FORMAT_R16G16B16_UINT, nullptr}, - {angle::FormatID::R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT, + {angle::FormatID::R16G16B16_UINT, nullptr}, + {angle::FormatID::R16G16B16A16_UINT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_UINT, VK_FORMAT_R16G16B16_UINT, false, + {angle::FormatID::R16G16B16_UINT, false, CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT, false, + {angle::FormatID::R16G16B16A16_UINT, false, CopyNativeVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1497,13 +1318,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16_UNORM: intendedGLFormat = GL_RGB16_EXT; actualImageFormatID = angle::FormatID::R16G16B16_UNORM; - actualImageVkFormat = VK_FORMAT_R16G16B16_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_UNORM, VK_FORMAT_R16G16B16_UNORM, false, + {angle::FormatID::R16G16B16_UNORM, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1512,13 +1332,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16B16_USCALED: intendedGLFormat = GL_RGB16_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16G16B16_USCALED; - actualImageVkFormat = VK_FORMAT_R16G16B16_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16B16_USCALED, VK_FORMAT_R16G16B16_USCALED, false, + {angle::FormatID::R16G16B16_USCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1527,10 +1346,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_FLOAT: intendedGLFormat = GL_RG16F; actualImageFormatID = angle::FormatID::R16G16_FLOAT; - actualImageVkFormat = VK_FORMAT_R16G16_SFLOAT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16G16_FLOAT; - actualBufferVkFormat = VK_FORMAT_R16G16_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1539,10 +1356,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_SINT: intendedGLFormat = GL_RG16I; actualImageFormatID = angle::FormatID::R16G16_SINT; - actualImageVkFormat = VK_FORMAT_R16G16_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16G16_SINT; - actualBufferVkFormat = VK_FORMAT_R16G16_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1551,14 +1366,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_SNORM: intendedGLFormat = GL_RG16_SNORM_EXT; actualImageFormatID = angle::FormatID::R16G16_SNORM; - actualImageVkFormat = VK_FORMAT_R16G16_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16_SNORM, VK_FORMAT_R16G16_SNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R16G16_SNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -1566,13 +1380,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_SSCALED: intendedGLFormat = GL_RG16_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16G16_SSCALED; - actualImageVkFormat = VK_FORMAT_R16G16_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16_SSCALED, VK_FORMAT_R16G16_SSCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, + {angle::FormatID::R16G16_SSCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1581,10 +1394,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_UINT: intendedGLFormat = GL_RG16UI; actualImageFormatID = angle::FormatID::R16G16_UINT; - actualImageVkFormat = VK_FORMAT_R16G16_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16G16_UINT; - actualBufferVkFormat = VK_FORMAT_R16G16_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1593,13 +1404,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_UNORM: intendedGLFormat = GL_RG16_EXT; actualImageFormatID = angle::FormatID::R16G16_UNORM; - actualImageVkFormat = VK_FORMAT_R16G16_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16_UNORM, VK_FORMAT_R16G16_UNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, + {angle::FormatID::R16G16_UNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1608,13 +1418,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16G16_USCALED: intendedGLFormat = GL_RG16_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16G16_USCALED; - actualImageVkFormat = VK_FORMAT_R16G16_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16G16_USCALED, VK_FORMAT_R16G16_USCALED, false, + {angle::FormatID::R16G16_USCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -1623,10 +1432,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_FLOAT: intendedGLFormat = GL_R16F; actualImageFormatID = angle::FormatID::R16_FLOAT; - actualImageVkFormat = VK_FORMAT_R16_SFLOAT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16_FLOAT; - actualBufferVkFormat = VK_FORMAT_R16_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1635,10 +1442,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_SINT: intendedGLFormat = GL_R16I; actualImageFormatID = angle::FormatID::R16_SINT; - actualImageVkFormat = VK_FORMAT_R16_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16_SINT; - actualBufferVkFormat = VK_FORMAT_R16_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1647,14 +1452,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_SNORM: intendedGLFormat = GL_R16_SNORM_EXT; actualImageFormatID = angle::FormatID::R16_SNORM; - actualImageVkFormat = VK_FORMAT_R16_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16_SNORM, VK_FORMAT_R16_SNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R16_SNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -1662,14 +1466,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_SSCALED: intendedGLFormat = GL_R16_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16_SSCALED; - actualImageVkFormat = VK_FORMAT_R16_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16_SSCALED, VK_FORMAT_R16_SSCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R16_SSCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -1677,10 +1480,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_UINT: intendedGLFormat = GL_R16UI; actualImageFormatID = angle::FormatID::R16_UINT; - actualImageVkFormat = VK_FORMAT_R16_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R16_UINT; - actualBufferVkFormat = VK_FORMAT_R16_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1689,14 +1490,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_UNORM: intendedGLFormat = GL_R16_EXT; actualImageFormatID = angle::FormatID::R16_UNORM; - actualImageVkFormat = VK_FORMAT_R16_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16_UNORM, VK_FORMAT_R16_UNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R16_UNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -1704,14 +1504,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R16_USCALED: intendedGLFormat = GL_R16_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R16_USCALED; - actualImageVkFormat = VK_FORMAT_R16_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R16_USCALED, VK_FORMAT_R16_USCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R16_USCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -1720,7 +1519,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGBA32_FIXED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = Copy32FixedTo32FVertexData<4, 4>; vertexLoadRequiresConversion = true; @@ -1729,13 +1527,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32G32B32A32_FLOAT: intendedGLFormat = GL_RGBA32F; actualImageFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualImageVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, false, + {angle::FormatID::R16G16B16A16_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1); } @@ -1744,10 +1541,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32G32B32A32_SINT: intendedGLFormat = GL_RGBA32I; actualImageFormatID = angle::FormatID::R32G32B32A32_SINT; - actualImageVkFormat = VK_FORMAT_R32G32B32A32_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_SINT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1757,7 +1552,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGBA32_SNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1767,7 +1561,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGBA32_SSCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1776,10 +1569,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32G32B32A32_UINT: intendedGLFormat = GL_RGBA32UI; actualImageFormatID = angle::FormatID::R32G32B32A32_UINT; - actualImageVkFormat = VK_FORMAT_R32G32B32A32_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_UINT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1789,7 +1580,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGBA32_UNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1799,7 +1589,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGBA32_USCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1809,7 +1598,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32_FIXED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = Copy32FixedTo32FVertexData<3, 3>; vertexLoadRequiresConversion = true; @@ -1819,17 +1607,17 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32F; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, nullptr}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, + {angle::FormatID::R32G32B32_FLOAT, nullptr}, + {angle::FormatID::R32G32B32A32_FLOAT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R32G32B32_FLOAT, false, CopyNativeVertexData, false}, - {angle::FormatID::R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, false, + {angle::FormatID::R16G16B16A16_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1); } @@ -1839,14 +1627,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32I; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R32G32B32_SINT, VK_FORMAT_R32G32B32_SINT, nullptr}, - {angle::FormatID::R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SINT, + {angle::FormatID::R32G32B32_SINT, nullptr}, + {angle::FormatID::R32G32B32A32_SINT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::R32G32B32_SINT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1856,7 +1643,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32_SNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1866,7 +1652,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32_SSCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1876,14 +1661,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32UI; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R32G32B32_UINT, VK_FORMAT_R32G32B32_UINT, nullptr}, - {angle::FormatID::R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT, + {angle::FormatID::R32G32B32_UINT, nullptr}, + {angle::FormatID::R32G32B32A32_UINT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::R32G32B32_UINT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1893,7 +1677,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32_UNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1903,7 +1686,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB32_USCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32B32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1913,7 +1695,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RG32_FIXED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = Copy32FixedTo32FVertexData<2, 2>; vertexLoadRequiresConversion = true; @@ -1922,13 +1703,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32G32_FLOAT: intendedGLFormat = GL_RG32F; actualImageFormatID = angle::FormatID::R32G32_FLOAT; - actualImageVkFormat = VK_FORMAT_R32G32_SFLOAT; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, - CopyNativeVertexData, false}, - {angle::FormatID::R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT, false, + {angle::FormatID::R32G32_FLOAT, false, CopyNativeVertexData, + false}, + {angle::FormatID::R16G16_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1); } @@ -1937,10 +1717,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32G32_SINT: intendedGLFormat = GL_RG32I; actualImageFormatID = angle::FormatID::R32G32_SINT; - actualImageVkFormat = VK_FORMAT_R32G32_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32_SINT; - actualBufferVkFormat = VK_FORMAT_R32G32_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1950,7 +1728,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RG32_SNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1960,7 +1737,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RG32_SSCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1969,10 +1745,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32G32_UINT: intendedGLFormat = GL_RG32UI; actualImageFormatID = angle::FormatID::R32G32_UINT; - actualImageVkFormat = VK_FORMAT_R32G32_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32_UINT; - actualBufferVkFormat = VK_FORMAT_R32G32_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -1982,7 +1756,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RG32_UNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -1992,7 +1765,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RG32_USCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32G32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -2002,7 +1774,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_R32_FIXED_ANGLEX; actualBufferFormatID = angle::FormatID::R32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = Copy32FixedTo32FVertexData<1, 1>; vertexLoadRequiresConversion = true; @@ -2011,14 +1782,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32_FLOAT: intendedGLFormat = GL_R32F; actualImageFormatID = angle::FormatID::R32_FLOAT; - actualImageVkFormat = VK_FORMAT_R32_SFLOAT; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyNativeVertexData, false}, - {angle::FormatID::R16_FLOAT, VK_FORMAT_R16_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R32_FLOAT, false, CopyNativeVertexData, + false}, + {angle::FormatID::R16_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 1); } break; @@ -2026,10 +1796,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32_SINT: intendedGLFormat = GL_R32I; actualImageFormatID = angle::FormatID::R32_SINT; - actualImageVkFormat = VK_FORMAT_R32_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32_SINT; - actualBufferVkFormat = VK_FORMAT_R32_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2039,7 +1807,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_R32_SNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -2049,7 +1816,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_R32_SSCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -2058,10 +1824,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R32_UINT: intendedGLFormat = GL_R32UI; actualImageFormatID = angle::FormatID::R32_UINT; - actualImageVkFormat = VK_FORMAT_R32_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32_UINT; - actualBufferVkFormat = VK_FORMAT_R32_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2071,7 +1835,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_R32_UNORM_ANGLEX; actualBufferFormatID = angle::FormatID::R32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -2081,7 +1844,6 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_R32_USCALED_ANGLEX; actualBufferFormatID = angle::FormatID::R32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -2091,12 +1853,11 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGBA4; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R4G4B4A4_UNORM, VK_FORMAT_R4G4B4A4_UNORM_PACK16, nullptr}, - {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, nullptr}}; + {angle::FormatID::R4G4B4A4_UNORM, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::R4G4B4A4_UNORM; - actualBufferVkFormat = VK_FORMAT_R4G4B4A4_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2106,12 +1867,11 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB5_A1; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R5G5B5A1_UNORM, VK_FORMAT_R5G5B5A1_UNORM_PACK16, nullptr}, - {angle::FormatID::A1R5G5B5_UNORM, VK_FORMAT_A1R5G5B5_UNORM_PACK16, nullptr}}; + {angle::FormatID::R5G5B5A1_UNORM, nullptr}, + {angle::FormatID::A1R5G5B5_UNORM, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::R5G5B5A1_UNORM; - actualBufferVkFormat = VK_FORMAT_R5G5B5A1_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2120,10 +1880,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R5G6B5_UNORM: intendedGLFormat = GL_RGB565; actualImageFormatID = angle::FormatID::R5G6B5_UNORM; - actualImageVkFormat = VK_FORMAT_R5G6B5_UNORM_PACK16; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R5G6B5_UNORM; - actualBufferVkFormat = VK_FORMAT_R5G6B5_UNORM_PACK16; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2132,10 +1890,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_SINT: intendedGLFormat = GL_RGBA8I; actualImageFormatID = angle::FormatID::R8G8B8A8_SINT; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8G8B8A8_SINT; - actualBufferVkFormat = VK_FORMAT_R8G8B8A8_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2144,13 +1900,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_SNORM: intendedGLFormat = GL_RGBA8_SNORM; actualImageFormatID = angle::FormatID::R8G8B8A8_SNORM; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R8G8B8A8_SNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2159,13 +1914,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_SSCALED: intendedGLFormat = GL_RGBA8_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8G8B8A8_SSCALED; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8A8_SSCALED, VK_FORMAT_R8G8B8A8_SSCALED, false, + {angle::FormatID::R8G8B8A8_SSCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2182,10 +1936,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_UINT: intendedGLFormat = GL_RGBA8UI; actualImageFormatID = angle::FormatID::R8G8B8A8_UINT; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8G8B8A8_UINT; - actualBufferVkFormat = VK_FORMAT_R8G8B8A8_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2194,13 +1946,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_UNORM: intendedGLFormat = GL_RGBA8; actualImageFormatID = angle::FormatID::R8G8B8A8_UNORM; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R8G8B8A8_UNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2209,10 +1960,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_UNORM_SRGB: intendedGLFormat = GL_SRGB8_ALPHA8; actualImageFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_SRGB; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8G8B8A8_UNORM_SRGB; - actualBufferVkFormat = VK_FORMAT_R8G8B8A8_SRGB; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2221,13 +1970,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8A8_USCALED: intendedGLFormat = GL_RGBA8_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8G8B8A8_USCALED; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8A8_USCALED, VK_FORMAT_R8G8B8A8_USCALED, false, + {angle::FormatID::R8G8B8A8_USCALED, false, CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, false, + {angle::FormatID::R32G32B32A32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2237,17 +1985,17 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB8I; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_SINT, VK_FORMAT_R8G8B8_SINT, nullptr}, - {angle::FormatID::R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT, + {angle::FormatID::R8G8B8_SINT, nullptr}, + {angle::FormatID::R8G8B8A8_SINT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_SINT, VK_FORMAT_R8G8B8_SINT, false, - CopyNativeVertexData, false}, - {angle::FormatID::R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT, false, - CopyNativeVertexData, true}}; + {angle::FormatID::R8G8B8_SINT, false, CopyNativeVertexData, + false}, + {angle::FormatID::R8G8B8A8_SINT, false, CopyNativeVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2256,16 +2004,16 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB8_SNORM; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_SNORM, VK_FORMAT_R8G8B8_SNORM, nullptr}, - {angle::FormatID::R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM, + {angle::FormatID::R8G8B8_SNORM, nullptr}, + {angle::FormatID::R8G8B8A8_SNORM, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_SNORM, VK_FORMAT_R8G8B8_SNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R8G8B8_SNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2274,13 +2022,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8_SSCALED: intendedGLFormat = GL_RGB8_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8G8B8_SSCALED; - actualImageVkFormat = VK_FORMAT_R8G8B8_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_SSCALED, VK_FORMAT_R8G8B8_SSCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R8G8B8_SSCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2290,17 +2037,17 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_RGB8UI; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_UINT, VK_FORMAT_R8G8B8_UINT, nullptr}, - {angle::FormatID::R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT, + {angle::FormatID::R8G8B8_UINT, nullptr}, + {angle::FormatID::R8G8B8A8_UINT, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_UINT, VK_FORMAT_R8G8B8_UINT, false, - CopyNativeVertexData, false}, - {angle::FormatID::R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT, false, - CopyNativeVertexData, true}}; + {angle::FormatID::R8G8B8_UINT, false, CopyNativeVertexData, + false}, + {angle::FormatID::R8G8B8A8_UINT, false, CopyNativeVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2308,10 +2055,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8_UNORM: intendedGLFormat = GL_RGB8; actualImageFormatID = angle::FormatID::R8G8B8A8_UNORM; - actualImageVkFormat = VK_FORMAT_R8G8B8A8_UNORM; imageInitializerFunction = Initialize4ComponentData; actualBufferFormatID = angle::FormatID::R32G32B32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyTo32FVertexData; vertexLoadRequiresConversion = true; @@ -2321,13 +2066,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_SRGB8; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_UNORM_SRGB, VK_FORMAT_R8G8B8_SRGB, nullptr}, - {angle::FormatID::R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB, + {angle::FormatID::R8G8B8_UNORM_SRGB, nullptr}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, Initialize4ComponentData}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::R8G8B8_UNORM_SRGB; - actualBufferVkFormat = VK_FORMAT_R8G8B8_SRGB; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2336,13 +2080,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8B8_USCALED: intendedGLFormat = GL_RGB8_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8G8B8_USCALED; - actualImageVkFormat = VK_FORMAT_R8G8B8_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8B8_USCALED, VK_FORMAT_R8G8B8_USCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT, false, + {angle::FormatID::R8G8B8_USCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32B32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2351,10 +2094,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8_SINT: intendedGLFormat = GL_RG8I; actualImageFormatID = angle::FormatID::R8G8_SINT; - actualImageVkFormat = VK_FORMAT_R8G8_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8G8_SINT; - actualBufferVkFormat = VK_FORMAT_R8G8_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2363,14 +2104,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8_SNORM: intendedGLFormat = GL_RG8_SNORM; actualImageFormatID = angle::FormatID::R8G8_SNORM; - actualImageVkFormat = VK_FORMAT_R8G8_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8_SNORM, VK_FORMAT_R8G8_SNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8G8_SNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2378,14 +2118,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8_SSCALED: intendedGLFormat = GL_RG8_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8G8_SSCALED; - actualImageVkFormat = VK_FORMAT_R8G8_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8_SSCALED, VK_FORMAT_R8G8_SSCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8G8_SSCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2393,10 +2132,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8_UINT: intendedGLFormat = GL_RG8UI; actualImageFormatID = angle::FormatID::R8G8_UINT; - actualImageVkFormat = VK_FORMAT_R8G8_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8G8_UINT; - actualBufferVkFormat = VK_FORMAT_R8G8_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2405,14 +2142,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8_UNORM: intendedGLFormat = GL_RG8; actualImageFormatID = angle::FormatID::R8G8_UNORM; - actualImageVkFormat = VK_FORMAT_R8G8_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8_UNORM, VK_FORMAT_R8G8_UNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8G8_UNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2420,13 +2156,12 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8G8_USCALED: intendedGLFormat = GL_RG8_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8G8_USCALED; - actualImageVkFormat = VK_FORMAT_R8G8_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8G8_USCALED, VK_FORMAT_R8G8_USCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT, false, + {angle::FormatID::R8G8_USCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32G32_FLOAT, false, CopyTo32FVertexData, true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } @@ -2435,10 +2170,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_SINT: intendedGLFormat = GL_R8I; actualImageFormatID = angle::FormatID::R8_SINT; - actualImageVkFormat = VK_FORMAT_R8_SINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8_SINT; - actualBufferVkFormat = VK_FORMAT_R8_SINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2447,14 +2180,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_SNORM: intendedGLFormat = GL_R8_SNORM; actualImageFormatID = angle::FormatID::R8_SNORM; - actualImageVkFormat = VK_FORMAT_R8_SNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8_SNORM, VK_FORMAT_R8_SNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8_SNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2462,14 +2194,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_SSCALED: intendedGLFormat = GL_R8_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8_SSCALED; - actualImageVkFormat = VK_FORMAT_R8_SSCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8_SSCALED, VK_FORMAT_R8_SSCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8_SSCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2477,10 +2208,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_UINT: intendedGLFormat = GL_R8UI; actualImageFormatID = angle::FormatID::R8_UINT; - actualImageVkFormat = VK_FORMAT_R8_UINT; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8_UINT; - actualBufferVkFormat = VK_FORMAT_R8_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2489,14 +2218,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_UNORM: intendedGLFormat = GL_R8; actualImageFormatID = angle::FormatID::R8_UNORM; - actualImageVkFormat = VK_FORMAT_R8_UNORM; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8_UNORM, VK_FORMAT_R8_UNORM, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8_UNORM, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2504,10 +2232,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_UNORM_SRGB: intendedGLFormat = GL_SR8_EXT; actualImageFormatID = angle::FormatID::R8_UNORM_SRGB; - actualImageVkFormat = VK_FORMAT_R8_SRGB; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R8_UNORM_SRGB; - actualBufferVkFormat = VK_FORMAT_R8_SRGB; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2516,14 +2242,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R8_USCALED: intendedGLFormat = GL_R8_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::R8_USCALED; - actualImageVkFormat = VK_FORMAT_R8_USCALED; imageInitializerFunction = nullptr; { static constexpr BufferFormatInitInfo kInfo[] = { - {angle::FormatID::R8_USCALED, VK_FORMAT_R8_USCALED, false, - CopyNativeVertexData, false}, - {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT, false, - CopyTo32FVertexData, true}}; + {angle::FormatID::R8_USCALED, false, CopyNativeVertexData, + false}, + {angle::FormatID::R32_FLOAT, false, CopyTo32FVertexData, + true}}; initBufferFallback(renderer, kInfo, ArraySize(kInfo), 2); } break; @@ -2531,10 +2256,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::R9G9B9E5_SHAREDEXP: intendedGLFormat = GL_RGB9_E5; actualImageFormatID = angle::FormatID::R9G9B9E5_SHAREDEXP; - actualImageVkFormat = VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R9G9B9E5_SHAREDEXP; - actualBufferVkFormat = VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; vkBufferFormatIsPacked = true; vertexLoadFunction = CopyNativeVertexData; vertexLoadRequiresConversion = false; @@ -2544,14 +2267,13 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) intendedGLFormat = GL_STENCIL_INDEX8; { static constexpr ImageFormatInitInfo kInfo[] = { - {angle::FormatID::S8_UINT, VK_FORMAT_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}, - {angle::FormatID::S8_UINT, VK_FORMAT_S8_UINT, nullptr}}; + {angle::FormatID::S8_UINT, nullptr}, + {angle::FormatID::D24_UNORM_S8_UINT, nullptr}, + {angle::FormatID::D32_FLOAT_S8X24_UINT, nullptr}, + {angle::FormatID::S8_UINT, nullptr}}; initImageFallback(renderer, kInfo, ArraySize(kInfo)); } actualBufferFormatID = angle::FormatID::S8_UINT; - actualBufferVkFormat = VK_FORMAT_S8_UINT; vkBufferFormatIsPacked = false; vertexLoadFunction = nullptr; vertexLoadRequiresConversion = false; @@ -2560,10 +2282,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::X2R10G10B10_SINT_VERTEX: intendedGLFormat = GL_X2_RGB10_SINT_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyXYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -2572,10 +2292,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::X2R10G10B10_SNORM_VERTEX: intendedGLFormat = GL_X2_RGB10_SNORM_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyXYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -2584,10 +2302,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::X2R10G10B10_SSCALED_VERTEX: intendedGLFormat = GL_X2_RGB10_SSCALED_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyXYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -2596,10 +2312,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::X2R10G10B10_UINT_VERTEX: intendedGLFormat = GL_X2_RGB10_UINT_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyXYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -2608,10 +2322,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::X2R10G10B10_UNORM_VERTEX: intendedGLFormat = GL_X2_RGB10_UNORM_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyXYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -2620,10 +2332,8 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) case angle::FormatID::X2R10G10B10_USCALED_VERTEX: intendedGLFormat = GL_X2_RGB10_USCALED_ANGLEX; actualImageFormatID = angle::FormatID::NONE; - actualImageVkFormat = VK_FORMAT_UNDEFINED; imageInitializerFunction = nullptr; actualBufferFormatID = angle::FormatID::R32G32B32A32_FLOAT; - actualBufferVkFormat = VK_FORMAT_R32G32B32A32_SFLOAT; vkBufferFormatIsPacked = false; vertexLoadFunction = CopyXYZ10ToXYZW32FVertexData; vertexLoadRequiresConversion = true; @@ -2635,6 +2345,456 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) } } -} // namespace vk +VkFormat GetVkFormatFromFormatID(angle::FormatID formatID) +{ + static constexpr angle::FormatMap kMap = { + {angle::FormatID::R8G8_USCALED, VK_FORMAT_R8G8_USCALED}, + {angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT}, + {angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK}, + {angle::FormatID::R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SINT}, + {angle::FormatID::ASTC_10x8_SRGB_BLOCK, VK_FORMAT_ASTC_10x8_SRGB_BLOCK}, + {angle::FormatID::R16G16B16_USCALED, VK_FORMAT_R16G16B16_USCALED}, + {angle::FormatID::BC4_RED_SNORM_BLOCK, VK_FORMAT_BC4_SNORM_BLOCK}, + {angle::FormatID::R16G16B16_SNORM, VK_FORMAT_R16G16B16_SNORM}, + {angle::FormatID::S8_UINT, VK_FORMAT_S8_UINT}, + {angle::FormatID::R8G8B8_USCALED, VK_FORMAT_R8G8B8_USCALED}, + {angle::FormatID::ASTC_5x4_UNORM_BLOCK, VK_FORMAT_ASTC_5x4_UNORM_BLOCK}, + {angle::FormatID::BC5_RG_UNORM_BLOCK, VK_FORMAT_BC5_UNORM_BLOCK}, + {angle::FormatID::ASTC_8x5_SRGB_BLOCK, VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, + {angle::FormatID::R8G8_SNORM, VK_FORMAT_R8G8_SNORM}, + {angle::FormatID::R16G16B16_UINT, VK_FORMAT_R16G16B16_UINT}, + {angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK}, + {angle::FormatID::R16G16_UINT, VK_FORMAT_R16G16_UINT}, + {angle::FormatID::R16_USCALED, VK_FORMAT_R16_USCALED}, + {angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC3_SRGB_BLOCK}, + {angle::FormatID::R8_SINT, VK_FORMAT_R8_SINT}, + {angle::FormatID::R11G11B10_FLOAT, VK_FORMAT_B10G11R11_UFLOAT_PACK32}, + {angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT}, + {angle::FormatID::B4G4R4A4_UNORM, VK_FORMAT_B4G4R4A4_UNORM_PACK16}, + {angle::FormatID::ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_UNORM_BLOCK}, + {angle::FormatID::R8G8B8_SSCALED, VK_FORMAT_R8G8B8_SSCALED}, + {angle::FormatID::R32G32B32_UINT, VK_FORMAT_R32G32B32_UINT}, + {angle::FormatID::R16_SINT, VK_FORMAT_R16_SINT}, + {angle::FormatID::D16_UNORM, VK_FORMAT_D16_UNORM}, + {angle::FormatID::ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_UNORM_BLOCK}, + {angle::FormatID::ASTC_8x8_SRGB_BLOCK, VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, + {angle::FormatID::R8_USCALED, VK_FORMAT_R8_USCALED}, + {angle::FormatID::R8G8B8_UNORM_SRGB, VK_FORMAT_R8G8B8_SRGB}, + {angle::FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK, VK_FORMAT_BC6H_UFLOAT_BLOCK}, + {angle::FormatID::B5G5R5A1_UNORM, VK_FORMAT_B5G5R5A1_UNORM_PACK16}, + {angle::FormatID::R16G16_SSCALED, VK_FORMAT_R16G16_SSCALED}, + {angle::FormatID::B8G8R8A8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB}, + {angle::FormatID::BC3_RGBA_UNORM_BLOCK, VK_FORMAT_BC3_UNORM_BLOCK}, + {angle::FormatID::R16_FLOAT, VK_FORMAT_R16_SFLOAT}, + {angle::FormatID::R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM}, + {angle::FormatID::R8G8B8A8_SSCALED, VK_FORMAT_R8G8B8A8_SSCALED}, + {angle::FormatID::R8_UNORM_SRGB, VK_FORMAT_R8_SRGB}, + {angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC1_RGBA_SRGB_BLOCK}, + {angle::FormatID::ASTC_10x10_SRGB_BLOCK, VK_FORMAT_ASTC_10x10_SRGB_BLOCK}, + {angle::FormatID::R10G10B10A2_UNORM, VK_FORMAT_A2B10G10R10_UNORM_PACK32}, + {angle::FormatID::ASTC_12x10_SRGB_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK}, + {angle::FormatID::ASTC_5x4_SRGB_BLOCK, VK_FORMAT_ASTC_5x4_SRGB_BLOCK}, + {angle::FormatID::ASTC_8x5_UNORM_BLOCK, VK_FORMAT_ASTC_8x5_UNORM_BLOCK}, + {angle::FormatID::R16G16B16A16_USCALED, VK_FORMAT_R16G16B16A16_USCALED}, + {angle::FormatID::R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB}, + {angle::FormatID::NONE, VK_FORMAT_UNDEFINED}, + {angle::FormatID::R32G32_UINT, VK_FORMAT_R32G32_UINT}, + {angle::FormatID::R16G16_SNORM, VK_FORMAT_R16G16_SNORM}, + {angle::FormatID::R16_UNORM, VK_FORMAT_R16_UNORM}, + {angle::FormatID::R10G10B10A2_SINT, VK_FORMAT_A2B10G10R10_SINT_PACK32}, + {angle::FormatID::R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT}, + {angle::FormatID::ASTC_5x5_SRGB_BLOCK, VK_FORMAT_ASTC_5x5_SRGB_BLOCK}, + {angle::FormatID::EAC_R11_SNORM_BLOCK, VK_FORMAT_EAC_R11_SNORM_BLOCK}, + {angle::FormatID::ASTC_8x6_SRGB_BLOCK, VK_FORMAT_ASTC_8x6_SRGB_BLOCK}, + {angle::FormatID::R8G8B8A8_USCALED, VK_FORMAT_R8G8B8A8_USCALED}, + {angle::FormatID::ASTC_6x5_UNORM_BLOCK, VK_FORMAT_ASTC_6x5_UNORM_BLOCK}, + {angle::FormatID::R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT}, + {angle::FormatID::R5G6B5_UNORM, VK_FORMAT_R5G6B5_UNORM_PACK16}, + {angle::FormatID::R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT}, + {angle::FormatID::B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM}, + {angle::FormatID::R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT}, + {angle::FormatID::R16G16B16_UNORM, VK_FORMAT_R16G16B16_UNORM}, + {angle::FormatID::BC2_RGBA_UNORM_BLOCK, VK_FORMAT_BC2_UNORM_BLOCK}, + {angle::FormatID::ASTC_12x12_UNORM_BLOCK, VK_FORMAT_ASTC_12x12_UNORM_BLOCK}, + {angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK}, + {angle::FormatID::R10G10B10A2_SNORM, VK_FORMAT_A2B10G10R10_SNORM_PACK32}, + {angle::FormatID::R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM}, + {angle::FormatID::ASTC_6x6_SRGB_BLOCK, VK_FORMAT_ASTC_6x6_SRGB_BLOCK}, + {angle::FormatID::ASTC_10x10_UNORM_BLOCK, VK_FORMAT_ASTC_10x10_UNORM_BLOCK}, + {angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK}, + {angle::FormatID::R16G16B16_SSCALED, VK_FORMAT_R16G16B16_SSCALED}, + {angle::FormatID::R16G16_UNORM, VK_FORMAT_R16G16_UNORM}, + {angle::FormatID::D32_FLOAT, VK_FORMAT_D32_SFLOAT}, + {angle::FormatID::R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_UNORM}, + {angle::FormatID::EAC_R11_UNORM_BLOCK, VK_FORMAT_EAC_R11_UNORM_BLOCK}, + {angle::FormatID::R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT}, + {angle::FormatID::R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT}, + {angle::FormatID::BPTC_RGBA_UNORM_BLOCK, VK_FORMAT_BC7_UNORM_BLOCK}, + {angle::FormatID::A1R5G5B5_UNORM, VK_FORMAT_A1R5G5B5_UNORM_PACK16}, + {angle::FormatID::ASTC_8x6_UNORM_BLOCK, VK_FORMAT_ASTC_8x6_UNORM_BLOCK}, + {angle::FormatID::EAC_R11G11_SNORM_BLOCK, VK_FORMAT_EAC_R11G11_SNORM_BLOCK}, + {angle::FormatID::R10G10B10A2_SSCALED, VK_FORMAT_A2B10G10R10_SSCALED_PACK32}, + {angle::FormatID::BC1_RGBA_UNORM_BLOCK, VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, + {angle::FormatID::R32G32_SINT, VK_FORMAT_R32G32_SINT}, + {angle::FormatID::R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT}, + {angle::FormatID::R8_UINT, VK_FORMAT_R8_UINT}, + {angle::FormatID::ASTC_10x6_UNORM_BLOCK, VK_FORMAT_ASTC_10x6_UNORM_BLOCK}, + {angle::FormatID::BC1_RGB_UNORM_BLOCK, VK_FORMAT_BC1_RGB_UNORM_BLOCK}, + {angle::FormatID::R4G4B4A4_UNORM, VK_FORMAT_R4G4B4A4_UNORM_PACK16}, + {angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK, VK_FORMAT_BC1_RGB_SRGB_BLOCK}, + {angle::FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK, VK_FORMAT_BC6H_SFLOAT_BLOCK}, + {angle::FormatID::R10G10B10A2_UINT, VK_FORMAT_A2B10G10R10_UINT_PACK32}, + {angle::FormatID::ASTC_6x5_SRGB_BLOCK, VK_FORMAT_ASTC_6x5_SRGB_BLOCK}, + {angle::FormatID::R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT}, + {angle::FormatID::B5G6R5_UNORM, VK_FORMAT_B5G6R5_UNORM_PACK16}, + {angle::FormatID::R32_FLOAT, VK_FORMAT_R32_SFLOAT}, + {angle::FormatID::ASTC_12x12_SRGB_BLOCK, VK_FORMAT_ASTC_12x12_SRGB_BLOCK}, + {angle::FormatID::ASTC_5x5_UNORM_BLOCK, VK_FORMAT_ASTC_5x5_UNORM_BLOCK}, + {angle::FormatID::R8G8B8_SINT, VK_FORMAT_R8G8B8_SINT}, + {angle::FormatID::ASTC_8x8_UNORM_BLOCK, VK_FORMAT_ASTC_8x8_UNORM_BLOCK}, + {angle::FormatID::R32_SINT, VK_FORMAT_R32_SINT}, + {angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK}, + {angle::FormatID::R16_SSCALED, VK_FORMAT_R16_SSCALED}, + {angle::FormatID::ASTC_6x6_UNORM_BLOCK, VK_FORMAT_ASTC_6x6_UNORM_BLOCK}, + {angle::FormatID::R8G8B8_SNORM, VK_FORMAT_R8G8B8_SNORM}, + {angle::FormatID::R16_UINT, VK_FORMAT_R16_UINT}, + {angle::FormatID::R8_UNORM, VK_FORMAT_R8_UNORM}, + {angle::FormatID::R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT}, + {angle::FormatID::BC5_RG_SNORM_BLOCK, VK_FORMAT_BC5_SNORM_BLOCK}, + {angle::FormatID::R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_SNORM}, + {angle::FormatID::R8G8_UNORM, VK_FORMAT_R8G8_UNORM}, + {angle::FormatID::ASTC_10x6_SRGB_BLOCK, VK_FORMAT_ASTC_10x6_SRGB_BLOCK}, + {angle::FormatID::ASTC_10x5_UNORM_BLOCK, VK_FORMAT_ASTC_10x5_UNORM_BLOCK}, + {angle::FormatID::B10G10R10A2_UNORM, VK_FORMAT_A2R10G10B10_UNORM_PACK32}, + {angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK, VK_FORMAT_BC2_SRGB_BLOCK}, + {angle::FormatID::R32G32B32_SINT, VK_FORMAT_R32G32B32_SINT}, + {angle::FormatID::R10G10B10A2_USCALED, VK_FORMAT_A2B10G10R10_USCALED_PACK32}, + {angle::FormatID::R8G8_SINT, VK_FORMAT_R8G8_SINT}, + {angle::FormatID::R16G16B16A16_SSCALED, VK_FORMAT_R16G16B16A16_SSCALED}, + {angle::FormatID::ASTC_10x5_SRGB_BLOCK, VK_FORMAT_ASTC_10x5_SRGB_BLOCK}, + {angle::FormatID::R8_SSCALED, VK_FORMAT_R8_SSCALED}, + {angle::FormatID::R16G16B16_FLOAT, VK_FORMAT_R16G16B16_SFLOAT}, + {angle::FormatID::R8_SNORM, VK_FORMAT_R8_SNORM}, + {angle::FormatID::R16_SNORM, VK_FORMAT_R16_SNORM}, + {angle::FormatID::D24_UNORM_X8_UINT, VK_FORMAT_X8_D24_UNORM_PACK32}, + {angle::FormatID::R16G16_SINT, VK_FORMAT_R16G16_SINT}, + {angle::FormatID::R16G16B16_SINT, VK_FORMAT_R16G16B16_SINT}, + {angle::FormatID::R8G8_SSCALED, VK_FORMAT_R8G8_SSCALED}, + {angle::FormatID::EAC_R11G11_UNORM_BLOCK, VK_FORMAT_EAC_R11G11_UNORM_BLOCK}, + {angle::FormatID::ASTC_10x8_UNORM_BLOCK, VK_FORMAT_ASTC_10x8_UNORM_BLOCK}, + {angle::FormatID::ASTC_4x4_SRGB_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, + {angle::FormatID::R8G8_UINT, VK_FORMAT_R8G8_UINT}, + {angle::FormatID::R5G5B5A1_UNORM, VK_FORMAT_R5G5B5A1_UNORM_PACK16}, + {angle::FormatID::R8G8B8_UINT, VK_FORMAT_R8G8B8_UINT}, + {angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK}, + {angle::FormatID::R32_UINT, VK_FORMAT_R32_UINT}, + {angle::FormatID::R9G9B9E5_SHAREDEXP, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, + {angle::FormatID::BC4_RED_UNORM_BLOCK, VK_FORMAT_BC4_UNORM_BLOCK}, + {angle::FormatID::R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT}, + {angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK, VK_FORMAT_BC7_SRGB_BLOCK}, + {angle::FormatID::R16G16_USCALED, VK_FORMAT_R16G16_USCALED}}; + return kMap[formatID]; +} + +angle::FormatID GetFormatIDFromVkFormat(VkFormat vkFormat) +{ + switch (vkFormat) + { + case VK_FORMAT_R8G8_USCALED: + return angle::FormatID::R8G8_USCALED; + case VK_FORMAT_D32_SFLOAT_S8_UINT: + return angle::FormatID::D32_FLOAT_S8X24_UINT; + case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: + return angle::FormatID::ETC2_R8G8B8_SRGB_BLOCK; + case VK_FORMAT_R32G32B32A32_SINT: + return angle::FormatID::R32G32B32A32_SINT; + case VK_FORMAT_ASTC_10x8_SRGB_BLOCK: + return angle::FormatID::ASTC_10x8_SRGB_BLOCK; + case VK_FORMAT_R16G16B16_USCALED: + return angle::FormatID::R16G16B16_USCALED; + case VK_FORMAT_BC4_SNORM_BLOCK: + return angle::FormatID::BC4_RED_SNORM_BLOCK; + case VK_FORMAT_R16G16B16_SNORM: + return angle::FormatID::R16G16B16_SNORM; + case VK_FORMAT_S8_UINT: + return angle::FormatID::S8_UINT; + case VK_FORMAT_R8G8B8_USCALED: + return angle::FormatID::R8G8B8_USCALED; + case VK_FORMAT_ASTC_5x4_UNORM_BLOCK: + return angle::FormatID::ASTC_5x4_UNORM_BLOCK; + case VK_FORMAT_BC5_UNORM_BLOCK: + return angle::FormatID::BC5_RG_UNORM_BLOCK; + case VK_FORMAT_ASTC_8x5_SRGB_BLOCK: + return angle::FormatID::ASTC_8x5_SRGB_BLOCK; + case VK_FORMAT_R8G8_SNORM: + return angle::FormatID::R8G8_SNORM; + case VK_FORMAT_R16G16B16_UINT: + return angle::FormatID::R16G16B16_UINT; + case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: + return angle::FormatID::ETC2_R8G8B8A8_UNORM_BLOCK; + case VK_FORMAT_R16G16_UINT: + return angle::FormatID::R16G16_UINT; + case VK_FORMAT_R16_USCALED: + return angle::FormatID::R16_USCALED; + case VK_FORMAT_BC3_SRGB_BLOCK: + return angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK; + case VK_FORMAT_R8_SINT: + return angle::FormatID::R8_SINT; + case VK_FORMAT_B10G11R11_UFLOAT_PACK32: + return angle::FormatID::R11G11B10_FLOAT; + case VK_FORMAT_D24_UNORM_S8_UINT: + return angle::FormatID::D24_UNORM_S8_UINT; + case VK_FORMAT_B4G4R4A4_UNORM_PACK16: + return angle::FormatID::B4G4R4A4_UNORM; + case VK_FORMAT_ASTC_12x10_UNORM_BLOCK: + return angle::FormatID::ASTC_12x10_UNORM_BLOCK; + case VK_FORMAT_R8G8B8_SSCALED: + return angle::FormatID::R8G8B8_SSCALED; + case VK_FORMAT_R32G32B32_UINT: + return angle::FormatID::R32G32B32_UINT; + case VK_FORMAT_R16_SINT: + return angle::FormatID::R16_SINT; + case VK_FORMAT_D16_UNORM: + return angle::FormatID::D16_UNORM; + case VK_FORMAT_ASTC_4x4_UNORM_BLOCK: + return angle::FormatID::ASTC_4x4_UNORM_BLOCK; + case VK_FORMAT_ASTC_8x8_SRGB_BLOCK: + return angle::FormatID::ASTC_8x8_SRGB_BLOCK; + case VK_FORMAT_R8_USCALED: + return angle::FormatID::R8_USCALED; + case VK_FORMAT_R8G8B8_SRGB: + return angle::FormatID::R8G8B8_UNORM_SRGB; + case VK_FORMAT_BC6H_UFLOAT_BLOCK: + return angle::FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK; + case VK_FORMAT_B5G5R5A1_UNORM_PACK16: + return angle::FormatID::B5G5R5A1_UNORM; + case VK_FORMAT_R16G16_SSCALED: + return angle::FormatID::R16G16_SSCALED; + case VK_FORMAT_B8G8R8A8_SRGB: + return angle::FormatID::B8G8R8A8_UNORM_SRGB; + case VK_FORMAT_BC3_UNORM_BLOCK: + return angle::FormatID::BC3_RGBA_UNORM_BLOCK; + case VK_FORMAT_R16_SFLOAT: + return angle::FormatID::R16_FLOAT; + case VK_FORMAT_R8G8B8A8_SNORM: + return angle::FormatID::R8G8B8A8_SNORM; + case VK_FORMAT_R8G8B8A8_SSCALED: + return angle::FormatID::R8G8B8A8_SSCALED; + case VK_FORMAT_R8_SRGB: + return angle::FormatID::R8_UNORM_SRGB; + case VK_FORMAT_BC1_RGBA_SRGB_BLOCK: + return angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK; + case VK_FORMAT_ASTC_10x10_SRGB_BLOCK: + return angle::FormatID::ASTC_10x10_SRGB_BLOCK; + case VK_FORMAT_A2B10G10R10_UNORM_PACK32: + return angle::FormatID::R10G10B10A2_UNORM; + case VK_FORMAT_ASTC_12x10_SRGB_BLOCK: + return angle::FormatID::ASTC_12x10_SRGB_BLOCK; + case VK_FORMAT_ASTC_5x4_SRGB_BLOCK: + return angle::FormatID::ASTC_5x4_SRGB_BLOCK; + case VK_FORMAT_ASTC_8x5_UNORM_BLOCK: + return angle::FormatID::ASTC_8x5_UNORM_BLOCK; + case VK_FORMAT_R16G16B16A16_USCALED: + return angle::FormatID::R16G16B16A16_USCALED; + case VK_FORMAT_R8G8B8A8_SRGB: + return angle::FormatID::R8G8B8A8_UNORM_SRGB; + case VK_FORMAT_UNDEFINED: + return angle::FormatID::NONE; + case VK_FORMAT_R32G32_UINT: + return angle::FormatID::R32G32_UINT; + case VK_FORMAT_R16G16_SNORM: + return angle::FormatID::R16G16_SNORM; + case VK_FORMAT_R16_UNORM: + return angle::FormatID::R16_UNORM; + case VK_FORMAT_A2B10G10R10_SINT_PACK32: + return angle::FormatID::R10G10B10A2_SINT; + case VK_FORMAT_R16G16B16A16_SFLOAT: + return angle::FormatID::R16G16B16A16_FLOAT; + case VK_FORMAT_ASTC_5x5_SRGB_BLOCK: + return angle::FormatID::ASTC_5x5_SRGB_BLOCK; + case VK_FORMAT_EAC_R11_SNORM_BLOCK: + return angle::FormatID::EAC_R11_SNORM_BLOCK; + case VK_FORMAT_ASTC_8x6_SRGB_BLOCK: + return angle::FormatID::ASTC_8x6_SRGB_BLOCK; + case VK_FORMAT_R8G8B8A8_USCALED: + return angle::FormatID::R8G8B8A8_USCALED; + case VK_FORMAT_ASTC_6x5_UNORM_BLOCK: + return angle::FormatID::ASTC_6x5_UNORM_BLOCK; + case VK_FORMAT_R8G8B8A8_UINT: + return angle::FormatID::R8G8B8A8_UINT; + case VK_FORMAT_R5G6B5_UNORM_PACK16: + return angle::FormatID::R5G6B5_UNORM; + case VK_FORMAT_R8G8B8A8_SINT: + return angle::FormatID::R8G8B8A8_SINT; + case VK_FORMAT_B8G8R8A8_UNORM: + return angle::FormatID::B8G8R8A8_UNORM; + case VK_FORMAT_R32G32B32A32_SFLOAT: + return angle::FormatID::R32G32B32A32_FLOAT; + case VK_FORMAT_R16G16B16_UNORM: + return angle::FormatID::R16G16B16_UNORM; + case VK_FORMAT_BC2_UNORM_BLOCK: + return angle::FormatID::BC2_RGBA_UNORM_BLOCK; + case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: + return angle::FormatID::ASTC_12x12_UNORM_BLOCK; + case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: + return angle::FormatID::ETC2_R8G8B8A8_SRGB_BLOCK; + case VK_FORMAT_A2B10G10R10_SNORM_PACK32: + return angle::FormatID::R10G10B10A2_SNORM; + case VK_FORMAT_R8G8B8A8_UNORM: + return angle::FormatID::R8G8B8A8_UNORM; + case VK_FORMAT_ASTC_6x6_SRGB_BLOCK: + return angle::FormatID::ASTC_6x6_SRGB_BLOCK; + case VK_FORMAT_ASTC_10x10_UNORM_BLOCK: + return angle::FormatID::ASTC_10x10_UNORM_BLOCK; + case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: + return angle::FormatID::ETC2_R8G8B8A1_SRGB_BLOCK; + case VK_FORMAT_R16G16B16_SSCALED: + return angle::FormatID::R16G16B16_SSCALED; + case VK_FORMAT_R16G16_UNORM: + return angle::FormatID::R16G16_UNORM; + case VK_FORMAT_D32_SFLOAT: + return angle::FormatID::D32_FLOAT; + case VK_FORMAT_R16G16B16A16_UNORM: + return angle::FormatID::R16G16B16A16_UNORM; + case VK_FORMAT_EAC_R11_UNORM_BLOCK: + return angle::FormatID::EAC_R11_UNORM_BLOCK; + case VK_FORMAT_R16G16B16A16_UINT: + return angle::FormatID::R16G16B16A16_UINT; + case VK_FORMAT_R16G16B16A16_SINT: + return angle::FormatID::R16G16B16A16_SINT; + case VK_FORMAT_BC7_UNORM_BLOCK: + return angle::FormatID::BPTC_RGBA_UNORM_BLOCK; + case VK_FORMAT_A1R5G5B5_UNORM_PACK16: + return angle::FormatID::A1R5G5B5_UNORM; + case VK_FORMAT_ASTC_8x6_UNORM_BLOCK: + return angle::FormatID::ASTC_8x6_UNORM_BLOCK; + case VK_FORMAT_EAC_R11G11_SNORM_BLOCK: + return angle::FormatID::EAC_R11G11_SNORM_BLOCK; + case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: + return angle::FormatID::R10G10B10A2_SSCALED; + case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: + return angle::FormatID::BC1_RGBA_UNORM_BLOCK; + case VK_FORMAT_R32G32_SINT: + return angle::FormatID::R32G32_SINT; + case VK_FORMAT_R32G32B32_SFLOAT: + return angle::FormatID::R32G32B32_FLOAT; + case VK_FORMAT_R8_UINT: + return angle::FormatID::R8_UINT; + case VK_FORMAT_ASTC_10x6_UNORM_BLOCK: + return angle::FormatID::ASTC_10x6_UNORM_BLOCK; + case VK_FORMAT_BC1_RGB_UNORM_BLOCK: + return angle::FormatID::BC1_RGB_UNORM_BLOCK; + case VK_FORMAT_R4G4B4A4_UNORM_PACK16: + return angle::FormatID::R4G4B4A4_UNORM; + case VK_FORMAT_BC1_RGB_SRGB_BLOCK: + return angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK; + case VK_FORMAT_BC6H_SFLOAT_BLOCK: + return angle::FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK; + case VK_FORMAT_A2B10G10R10_UINT_PACK32: + return angle::FormatID::R10G10B10A2_UINT; + case VK_FORMAT_ASTC_6x5_SRGB_BLOCK: + return angle::FormatID::ASTC_6x5_SRGB_BLOCK; + case VK_FORMAT_R16G16_SFLOAT: + return angle::FormatID::R16G16_FLOAT; + case VK_FORMAT_B5G6R5_UNORM_PACK16: + return angle::FormatID::B5G6R5_UNORM; + case VK_FORMAT_R32_SFLOAT: + return angle::FormatID::R32_FLOAT; + case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: + return angle::FormatID::ASTC_12x12_SRGB_BLOCK; + case VK_FORMAT_ASTC_5x5_UNORM_BLOCK: + return angle::FormatID::ASTC_5x5_UNORM_BLOCK; + case VK_FORMAT_R8G8B8_SINT: + return angle::FormatID::R8G8B8_SINT; + case VK_FORMAT_ASTC_8x8_UNORM_BLOCK: + return angle::FormatID::ASTC_8x8_UNORM_BLOCK; + case VK_FORMAT_R32_SINT: + return angle::FormatID::R32_SINT; + case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK: + return angle::FormatID::ETC2_R8G8B8A1_UNORM_BLOCK; + case VK_FORMAT_R16_SSCALED: + return angle::FormatID::R16_SSCALED; + case VK_FORMAT_ASTC_6x6_UNORM_BLOCK: + return angle::FormatID::ASTC_6x6_UNORM_BLOCK; + case VK_FORMAT_R8G8B8_SNORM: + return angle::FormatID::R8G8B8_SNORM; + case VK_FORMAT_R16_UINT: + return angle::FormatID::R16_UINT; + case VK_FORMAT_R8_UNORM: + return angle::FormatID::R8_UNORM; + case VK_FORMAT_R32G32_SFLOAT: + return angle::FormatID::R32G32_FLOAT; + case VK_FORMAT_BC5_SNORM_BLOCK: + return angle::FormatID::BC5_RG_SNORM_BLOCK; + case VK_FORMAT_R16G16B16A16_SNORM: + return angle::FormatID::R16G16B16A16_SNORM; + case VK_FORMAT_R8G8_UNORM: + return angle::FormatID::R8G8_UNORM; + case VK_FORMAT_ASTC_10x6_SRGB_BLOCK: + return angle::FormatID::ASTC_10x6_SRGB_BLOCK; + case VK_FORMAT_ASTC_10x5_UNORM_BLOCK: + return angle::FormatID::ASTC_10x5_UNORM_BLOCK; + case VK_FORMAT_A2R10G10B10_UNORM_PACK32: + return angle::FormatID::B10G10R10A2_UNORM; + case VK_FORMAT_BC2_SRGB_BLOCK: + return angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK; + case VK_FORMAT_R32G32B32_SINT: + return angle::FormatID::R32G32B32_SINT; + case VK_FORMAT_A2B10G10R10_USCALED_PACK32: + return angle::FormatID::R10G10B10A2_USCALED; + case VK_FORMAT_R8G8_SINT: + return angle::FormatID::R8G8_SINT; + case VK_FORMAT_R16G16B16A16_SSCALED: + return angle::FormatID::R16G16B16A16_SSCALED; + case VK_FORMAT_ASTC_10x5_SRGB_BLOCK: + return angle::FormatID::ASTC_10x5_SRGB_BLOCK; + case VK_FORMAT_R8_SSCALED: + return angle::FormatID::R8_SSCALED; + case VK_FORMAT_R16G16B16_SFLOAT: + return angle::FormatID::R16G16B16_FLOAT; + case VK_FORMAT_R8_SNORM: + return angle::FormatID::R8_SNORM; + case VK_FORMAT_R16_SNORM: + return angle::FormatID::R16_SNORM; + case VK_FORMAT_X8_D24_UNORM_PACK32: + return angle::FormatID::D24_UNORM_X8_UINT; + case VK_FORMAT_R16G16_SINT: + return angle::FormatID::R16G16_SINT; + case VK_FORMAT_R16G16B16_SINT: + return angle::FormatID::R16G16B16_SINT; + case VK_FORMAT_R8G8_SSCALED: + return angle::FormatID::R8G8_SSCALED; + case VK_FORMAT_EAC_R11G11_UNORM_BLOCK: + return angle::FormatID::EAC_R11G11_UNORM_BLOCK; + case VK_FORMAT_ASTC_10x8_UNORM_BLOCK: + return angle::FormatID::ASTC_10x8_UNORM_BLOCK; + case VK_FORMAT_ASTC_4x4_SRGB_BLOCK: + return angle::FormatID::ASTC_4x4_SRGB_BLOCK; + case VK_FORMAT_R8G8_UINT: + return angle::FormatID::R8G8_UINT; + case VK_FORMAT_R5G5B5A1_UNORM_PACK16: + return angle::FormatID::R5G5B5A1_UNORM; + case VK_FORMAT_R8G8B8_UINT: + return angle::FormatID::R8G8B8_UINT; + case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: + return angle::FormatID::ETC2_R8G8B8_UNORM_BLOCK; + case VK_FORMAT_R32_UINT: + return angle::FormatID::R32_UINT; + case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: + return angle::FormatID::R9G9B9E5_SHAREDEXP; + case VK_FORMAT_BC4_UNORM_BLOCK: + return angle::FormatID::BC4_RED_UNORM_BLOCK; + case VK_FORMAT_R32G32B32A32_UINT: + return angle::FormatID::R32G32B32A32_UINT; + case VK_FORMAT_BC7_SRGB_BLOCK: + return angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK; + case VK_FORMAT_R16G16_USCALED: + return angle::FormatID::R16G16_USCALED; + + default: + return angle::FormatID::NONE; + } +} +} // namespace vk } // namespace rx diff --git a/src/libANGLE/renderer/vulkan/vk_format_utils.cpp b/src/libANGLE/renderer/vulkan/vk_format_utils.cpp index 4391aab3b..4468f9da2 100644 --- a/src/libANGLE/renderer/vulkan/vk_format_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_format_utils.cpp @@ -19,21 +19,23 @@ namespace rx { namespace { -void FillTextureFormatCaps(RendererVk *renderer, VkFormat format, gl::TextureCaps *outTextureCaps) +void FillTextureFormatCaps(RendererVk *renderer, + angle::FormatID formatID, + gl::TextureCaps *outTextureCaps) { const VkPhysicalDeviceLimits &physicalDeviceLimits = renderer->getPhysicalDeviceProperties().limits; bool hasColorAttachmentFeatureBit = - renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT); - bool hasDepthAttachmentFeatureBit = - renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT); + renderer->hasImageFormatFeatureBits(formatID, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT); + bool hasDepthAttachmentFeatureBit = renderer->hasImageFormatFeatureBits( + formatID, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT); outTextureCaps->texturable = - renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); + renderer->hasImageFormatFeatureBits(formatID, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); outTextureCaps->filterable = renderer->hasImageFormatFeatureBits( - format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); + formatID, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); outTextureCaps->blendable = - renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT); + renderer->hasImageFormatFeatureBits(formatID, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT); // For renderbuffer and texture attachments we require transfer and sampling for // GLES 2.0 CopyTexImage support. Sampling is also required for other features like @@ -62,7 +64,7 @@ void FillTextureFormatCaps(RendererVk *renderer, VkFormat format, gl::TextureCap } } -bool HasFullBufferFormatSupport(RendererVk *renderer, VkFormat vkFormat) +bool HasFullBufferFormatSupport(RendererVk *renderer, angle::FormatID formatID) { // Note: GL_EXT_texture_buffer support uses the same vkBufferFormat that is determined by // Format::initBufferFallback, which uses this function. That relies on the fact that formats @@ -70,10 +72,10 @@ bool HasFullBufferFormatSupport(RendererVk *renderer, VkFormat vkFormat) // Vulkan. If this function is changed to test for more features in such a way that makes any // of those formats use a fallback format, the implementation of GL_EXT_texture_buffer must be // modified not to use vkBufferFormat. - return renderer->hasBufferFormatFeatureBits(vkFormat, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT); + return renderer->hasBufferFormatFeatureBits(formatID, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT); } -using SupportTest = bool (*)(RendererVk *renderer, VkFormat vkFormat); +using SupportTest = bool (*)(RendererVk *renderer, angle::FormatID formatID); template int FindSupportedFormat(RendererVk *renderer, @@ -88,36 +90,41 @@ int FindSupportedFormat(RendererVk *renderer, for (int i = static_cast(skip); i < last; ++i) { ASSERT(info[i].format != angle::FormatID::NONE); - if (hasSupport(renderer, info[i].vkFormat)) + if (hasSupport(renderer, info[i].format)) return i; } - if (skip > 0 && !hasSupport(renderer, info[last].vkFormat)) + if (skip > 0 && !hasSupport(renderer, info[last].format)) { // We couldn't find a valid fallback, try again without skip return FindSupportedFormat(renderer, info, 0, numInfo, hasSupport); } ASSERT(info[last].format != angle::FormatID::NONE); - ASSERT(hasSupport(renderer, info[last].vkFormat)); + ASSERT(hasSupport(renderer, info[last].format)); return last; } +bool HasNonFilterableTextureFormatSupport(RendererVk *renderer, angle::FormatID formatID) +{ + constexpr uint32_t kBitsColor = + VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + constexpr uint32_t kBitsDepth = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + + return renderer->hasImageFormatFeatureBits(formatID, kBitsColor) || + renderer->hasImageFormatFeatureBits(formatID, kBitsDepth); +} } // anonymous namespace namespace vk { - // Format implementation. Format::Format() : intendedFormatID(angle::FormatID::NONE), intendedGLFormat(GL_NONE), actualImageFormatID(angle::FormatID::NONE), - actualImageVkFormat(VK_FORMAT_UNDEFINED), actualBufferFormatID(angle::FormatID::NONE), - actualBufferVkFormat(VK_FORMAT_UNDEFINED), actualCompressedBufferFormatID(angle::FormatID::NONE), - actualCompressedBufferVkFormat(VK_FORMAT_UNDEFINED), imageInitializerFunction(nullptr), textureLoadFunctions(), vertexLoadFunction(nullptr), @@ -152,7 +159,6 @@ void Format::initImageFallback(RendererVk *renderer, const ImageFormatInitInfo * int i = FindSupportedFormat(renderer, info, skip, static_cast(numInfo), testFunction); actualImageFormatID = info[i].format; - actualImageVkFormat = info[i].vkFormat; imageInitializerFunction = info[i].initializer; } @@ -167,7 +173,6 @@ void Format::initBufferFallback(RendererVk *renderer, HasFullBufferFormatSupport); actualBufferFormatID = info[i].format; - actualBufferVkFormat = info[i].vkFormat; vkBufferFormatIsPacked = info[i].vkFormatIsPacked; vertexLoadFunction = info[i].vertexLoadFunction; vertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion; @@ -179,7 +184,6 @@ void Format::initBufferFallback(RendererVk *renderer, HasFullBufferFormatSupport); actualCompressedBufferFormatID = info[i].format; - actualCompressedBufferVkFormat = info[i].vkFormat; vkCompressedBufferFormatIsPacked = info[i].vkFormatIsPacked; compressedVertexLoadFunction = info[i].vertexLoadFunction; compressedVertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion; @@ -270,7 +274,7 @@ void FormatTable::initialize(RendererVk *renderer, } gl::TextureCaps textureCaps; - FillTextureFormatCaps(renderer, format.actualImageVkFormat, &textureCaps); + FillTextureFormatCaps(renderer, format.actualImageFormatID, &textureCaps); outTextureCapsMap->set(formatID, textureCaps); if (textureCaps.texturable) @@ -286,14 +290,14 @@ void FormatTable::initialize(RendererVk *renderer, } } -VkImageUsageFlags GetMaximalImageUsageFlags(RendererVk *renderer, VkFormat format) +VkImageUsageFlags GetMaximalImageUsageFlags(RendererVk *renderer, angle::FormatID formatID) { constexpr VkFormatFeatureFlags kImageUsageFeatureBits = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT; VkFormatFeatureFlags featureBits = - renderer->getImageFormatFeatureBits(format, kImageUsageFeatureBits); + renderer->getImageFormatFeatureBits(formatID, kImageUsageFeatureBits); VkImageUsageFlags imageUsageFlags = 0; if (featureBits & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) imageUsageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT; @@ -310,10 +314,9 @@ VkImageUsageFlags GetMaximalImageUsageFlags(RendererVk *renderer, VkFormat forma imageUsageFlags |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT; return imageUsageFlags; } - } // namespace vk -bool HasFullTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat) +bool HasFullTextureFormatSupport(RendererVk *renderer, angle::FormatID formatID) { constexpr uint32_t kBitsColor = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | @@ -322,11 +325,11 @@ bool HasFullTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat) // In OpenGL ES, all renderable formats except 32-bit floating-point support blending. // 32-bit floating-point case validation is handled by ANGLE's frontend. uint32_t kBitsColorFull = kBitsColor; - switch (vkFormat) + switch (formatID) { - case VK_FORMAT_R32_SFLOAT: - case VK_FORMAT_R32G32_SFLOAT: - case VK_FORMAT_R32G32B32A32_SFLOAT: + case angle::FormatID::R32_FLOAT: + case angle::FormatID::R32G32_FLOAT: + case angle::FormatID::R32G32B32A32_FLOAT: break; default: kBitsColorFull |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; @@ -335,28 +338,18 @@ bool HasFullTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat) constexpr uint32_t kBitsDepth = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; - return renderer->hasImageFormatFeatureBits(vkFormat, kBitsColorFull) || - renderer->hasImageFormatFeatureBits(vkFormat, kBitsDepth); + return renderer->hasImageFormatFeatureBits(formatID, kBitsColorFull) || + renderer->hasImageFormatFeatureBits(formatID, kBitsDepth); } -bool HasNonFilterableTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat) -{ - constexpr uint32_t kBitsColor = - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; - constexpr uint32_t kBitsDepth = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; - - return renderer->hasImageFormatFeatureBits(vkFormat, kBitsColor) || - renderer->hasImageFormatFeatureBits(vkFormat, kBitsDepth); -} - -bool HasNonRenderableTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat) +bool HasNonRenderableTextureFormatSupport(RendererVk *renderer, angle::FormatID formatID) { constexpr uint32_t kBitsColor = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; constexpr uint32_t kBitsDepth = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; - return renderer->hasImageFormatFeatureBits(vkFormat, kBitsColor) || - renderer->hasImageFormatFeatureBits(vkFormat, kBitsDepth); + return renderer->hasImageFormatFeatureBits(formatID, kBitsColor) || + renderer->hasImageFormatFeatureBits(formatID, kBitsDepth); } size_t GetVertexInputAlignment(const vk::Format &format, bool compressed) diff --git a/src/libANGLE/renderer/vulkan/vk_format_utils.h b/src/libANGLE/renderer/vulkan/vk_format_utils.h index 9e957d096..16c381116 100644 --- a/src/libANGLE/renderer/vulkan/vk_format_utils.h +++ b/src/libANGLE/renderer/vulkan/vk_format_utils.h @@ -37,19 +37,20 @@ constexpr uint32_t kNumVkFormats = 185; struct ImageFormatInitInfo final { angle::FormatID format; - VkFormat vkFormat; InitializeTextureDataFunction initializer; }; struct BufferFormatInitInfo final { angle::FormatID format; - VkFormat vkFormat; bool vkFormatIsPacked; VertexCopyFunction vertexLoadFunction; bool vertexLoadRequiresConversion; }; +VkFormat GetVkFormatFromFormatID(angle::FormatID formatID); +angle::FormatID GetFormatIDFromVkFormat(VkFormat vkFormat); + // Describes a Vulkan format. For more information on formats in the Vulkan back-end please see // https://chromium.googlesource.com/angle/angle/+/master/src/libANGLE/renderer/vulkan/doc/FormatTablesAndEmulation.md struct Format final : private angle::NonCopyable @@ -69,6 +70,8 @@ struct Format final : private angle::NonCopyable return angle::Format::Get(actualImageFormatID); } + VkFormat actualImageVkFormat() const { return GetVkFormatFromFormatID(actualImageFormatID); } + // The actual Buffer format is used to implement the front-end format for Buffers. This format // is used by vertex buffers as well as texture buffers. Note that all formats required for // GL_EXT_texture_buffer have mandatory support for vertex buffers in Vulkan, so they won't be @@ -79,6 +82,12 @@ struct Format final : private angle::NonCopyable : actualBufferFormatID); } + VkFormat actualBufferVkFormat(bool compressed) const + { + return GetVkFormatFromFormatID(compressed ? actualCompressedBufferFormatID + : actualBufferFormatID); + } + VertexCopyFunction getVertexLoadFunction(bool compressed) const { return compressed ? compressedVertexLoadFunction : vertexLoadFunction; @@ -119,11 +128,8 @@ struct Format final : private angle::NonCopyable angle::FormatID intendedFormatID; GLenum intendedGLFormat; angle::FormatID actualImageFormatID; - VkFormat actualImageVkFormat; angle::FormatID actualBufferFormatID; - VkFormat actualBufferVkFormat; angle::FormatID actualCompressedBufferFormatID; - VkFormat actualCompressedBufferVkFormat; InitializeTextureDataFunction imageInitializerFunction; LoadFunctionMap textureLoadFunctions; @@ -174,16 +180,14 @@ class FormatTable final : angle::NonCopyable // initialized to 0. const VkFormatProperties &GetMandatoryFormatSupport(VkFormat vkFormat); -VkImageUsageFlags GetMaximalImageUsageFlags(RendererVk *renderer, VkFormat format); +VkImageUsageFlags GetMaximalImageUsageFlags(RendererVk *renderer, angle::FormatID formatID); } // namespace vk -// Checks if a vkFormat supports all the features needed to use it as a GL texture format -bool HasFullTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat); -// Checks if a vkFormat supports all the features except texture filtering -bool HasNonFilterableTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat); -// Checks if a vkFormat supports all the features except rendering -bool HasNonRenderableTextureFormatSupport(RendererVk *renderer, VkFormat vkFormat); +// Checks if a Vulkan format supports all the features needed to use it as a GL texture format. +bool HasFullTextureFormatSupport(RendererVk *renderer, angle::FormatID formatID); +// Checks if a Vulkan format supports all the features except rendering. +bool HasNonRenderableTextureFormatSupport(RendererVk *renderer, angle::FormatID formatID); // Returns the alignment for a buffer to be used with the vertex input stage in Vulkan. This // calculation is listed in the Vulkan spec at the end of the section 'Vertex Input Description'. @@ -198,144 +202,6 @@ gl::SwizzleState GetFormatSwizzle(const ContextVk *contextVk, gl::SwizzleState ApplySwizzle(const gl::SwizzleState &formatSwizzle, const gl::SwizzleState &toApply); -namespace vk -{ - -ANGLE_INLINE VkFormat ConvertToSRGB(VkFormat format) -{ - switch (format) - { - case VK_FORMAT_R8_UNORM: - return VK_FORMAT_R8_SRGB; - case VK_FORMAT_R8G8_UNORM: - return VK_FORMAT_R8G8_SRGB; - case VK_FORMAT_R8G8B8_UNORM: - return VK_FORMAT_R8G8B8_SRGB; - case VK_FORMAT_B8G8R8_UNORM: - return VK_FORMAT_B8G8R8_SRGB; - case VK_FORMAT_R8G8B8A8_UNORM: - return VK_FORMAT_R8G8B8A8_SRGB; - case VK_FORMAT_B8G8R8A8_UNORM: - return VK_FORMAT_B8G8R8A8_SRGB; - case VK_FORMAT_BC1_RGB_UNORM_BLOCK: - return VK_FORMAT_BC1_RGB_SRGB_BLOCK; - case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: - return VK_FORMAT_BC1_RGBA_SRGB_BLOCK; - case VK_FORMAT_BC2_UNORM_BLOCK: - return VK_FORMAT_BC2_SRGB_BLOCK; - case VK_FORMAT_BC3_UNORM_BLOCK: - return VK_FORMAT_BC3_SRGB_BLOCK; - case VK_FORMAT_BC7_UNORM_BLOCK: - return VK_FORMAT_BC7_SRGB_BLOCK; - case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: - return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; - case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK: - return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; - case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: - return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; - case VK_FORMAT_ASTC_4x4_UNORM_BLOCK: - return VK_FORMAT_ASTC_4x4_SRGB_BLOCK; - case VK_FORMAT_ASTC_5x4_UNORM_BLOCK: - return VK_FORMAT_ASTC_5x4_SRGB_BLOCK; - case VK_FORMAT_ASTC_5x5_UNORM_BLOCK: - return VK_FORMAT_ASTC_5x5_SRGB_BLOCK; - case VK_FORMAT_ASTC_6x5_UNORM_BLOCK: - return VK_FORMAT_ASTC_6x5_SRGB_BLOCK; - case VK_FORMAT_ASTC_6x6_UNORM_BLOCK: - return VK_FORMAT_ASTC_6x6_SRGB_BLOCK; - case VK_FORMAT_ASTC_8x5_UNORM_BLOCK: - return VK_FORMAT_ASTC_8x5_SRGB_BLOCK; - case VK_FORMAT_ASTC_8x6_UNORM_BLOCK: - return VK_FORMAT_ASTC_8x6_SRGB_BLOCK; - case VK_FORMAT_ASTC_8x8_UNORM_BLOCK: - return VK_FORMAT_ASTC_8x8_SRGB_BLOCK; - case VK_FORMAT_ASTC_10x5_UNORM_BLOCK: - return VK_FORMAT_ASTC_10x5_SRGB_BLOCK; - case VK_FORMAT_ASTC_10x6_UNORM_BLOCK: - return VK_FORMAT_ASTC_10x6_SRGB_BLOCK; - case VK_FORMAT_ASTC_10x8_UNORM_BLOCK: - return VK_FORMAT_ASTC_10x8_SRGB_BLOCK; - case VK_FORMAT_ASTC_10x10_UNORM_BLOCK: - return VK_FORMAT_ASTC_10x10_SRGB_BLOCK; - case VK_FORMAT_ASTC_12x10_UNORM_BLOCK: - return VK_FORMAT_ASTC_12x10_SRGB_BLOCK; - case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: - return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; - default: - return VK_FORMAT_UNDEFINED; - } -} - -ANGLE_INLINE VkFormat ConvertToLinear(VkFormat format) -{ - switch (format) - { - case VK_FORMAT_R8_SRGB: - return VK_FORMAT_R8_UNORM; - case VK_FORMAT_R8G8_SRGB: - return VK_FORMAT_R8G8_UNORM; - case VK_FORMAT_R8G8B8_SRGB: - return VK_FORMAT_R8G8B8_UNORM; - case VK_FORMAT_B8G8R8_SRGB: - return VK_FORMAT_B8G8R8_UNORM; - case VK_FORMAT_R8G8B8A8_SRGB: - return VK_FORMAT_R8G8B8A8_UNORM; - case VK_FORMAT_B8G8R8A8_SRGB: - return VK_FORMAT_B8G8R8A8_UNORM; - case VK_FORMAT_BC1_RGB_SRGB_BLOCK: - return VK_FORMAT_BC1_RGB_UNORM_BLOCK; - case VK_FORMAT_BC1_RGBA_SRGB_BLOCK: - return VK_FORMAT_BC1_RGBA_UNORM_BLOCK; - case VK_FORMAT_BC2_SRGB_BLOCK: - return VK_FORMAT_BC2_UNORM_BLOCK; - case VK_FORMAT_BC3_SRGB_BLOCK: - return VK_FORMAT_BC3_UNORM_BLOCK; - case VK_FORMAT_BC7_SRGB_BLOCK: - return VK_FORMAT_BC7_UNORM_BLOCK; - case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: - return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; - case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: - return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; - case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: - return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; - case VK_FORMAT_ASTC_4x4_SRGB_BLOCK: - return VK_FORMAT_ASTC_4x4_UNORM_BLOCK; - case VK_FORMAT_ASTC_5x4_SRGB_BLOCK: - return VK_FORMAT_ASTC_5x4_UNORM_BLOCK; - case VK_FORMAT_ASTC_5x5_SRGB_BLOCK: - return VK_FORMAT_ASTC_5x5_UNORM_BLOCK; - case VK_FORMAT_ASTC_6x5_SRGB_BLOCK: - return VK_FORMAT_ASTC_6x5_UNORM_BLOCK; - case VK_FORMAT_ASTC_6x6_SRGB_BLOCK: - return VK_FORMAT_ASTC_6x6_UNORM_BLOCK; - case VK_FORMAT_ASTC_8x5_SRGB_BLOCK: - return VK_FORMAT_ASTC_8x5_UNORM_BLOCK; - case VK_FORMAT_ASTC_8x6_SRGB_BLOCK: - return VK_FORMAT_ASTC_8x6_UNORM_BLOCK; - case VK_FORMAT_ASTC_8x8_SRGB_BLOCK: - return VK_FORMAT_ASTC_8x8_UNORM_BLOCK; - case VK_FORMAT_ASTC_10x5_SRGB_BLOCK: - return VK_FORMAT_ASTC_10x5_UNORM_BLOCK; - case VK_FORMAT_ASTC_10x6_SRGB_BLOCK: - return VK_FORMAT_ASTC_10x6_UNORM_BLOCK; - case VK_FORMAT_ASTC_10x8_SRGB_BLOCK: - return VK_FORMAT_ASTC_10x8_UNORM_BLOCK; - case VK_FORMAT_ASTC_10x10_SRGB_BLOCK: - return VK_FORMAT_ASTC_10x10_UNORM_BLOCK; - case VK_FORMAT_ASTC_12x10_SRGB_BLOCK: - return VK_FORMAT_ASTC_12x10_UNORM_BLOCK; - case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: - return VK_FORMAT_ASTC_12x12_UNORM_BLOCK; - default: - return VK_FORMAT_UNDEFINED; - } -} - -ANGLE_INLINE bool IsOverridableLinearFormat(VkFormat format) -{ - return ConvertToSRGB(format) != VK_FORMAT_UNDEFINED; -} -} // namespace vk } // namespace rx #endif // LIBANGLE_RENDERER_VULKAN_VK_FORMAT_UTILS_H_ diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp index 2afd19913..8ebc2d5eb 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp +++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp @@ -693,13 +693,13 @@ VkImageLayout ConvertImageLayoutToVkImageLayout(ImageLayout imageLayout) } bool FormatHasNecessaryFeature(RendererVk *renderer, - VkFormat format, + angle::FormatID formatID, VkImageTiling tilingMode, VkFormatFeatureFlags featureBits) { return (tilingMode == VK_IMAGE_TILING_OPTIMAL) - ? renderer->hasImageFormatFeatureBits(format, featureBits) - : renderer->hasLinearImageFormatFeatureBits(format, featureBits); + ? renderer->hasImageFormatFeatureBits(formatID, featureBits) + : renderer->hasLinearImageFormatFeatureBits(formatID, featureBits); } bool CanCopyWithTransfer(RendererVk *renderer, @@ -711,9 +711,9 @@ bool CanCopyWithTransfer(RendererVk *renderer, // Checks that the formats in the copy transfer have the appropriate tiling and transfer bits bool isTilingCompatible = srcTilingMode == destTilingMode; bool srcFormatHasNecessaryFeature = FormatHasNecessaryFeature( - renderer, srcFormat.actualImageVkFormat, srcTilingMode, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT); + renderer, srcFormat.actualImageFormatID, srcTilingMode, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT); bool dstFormatHasNecessaryFeature = - FormatHasNecessaryFeature(renderer, destFormat.actualImageVkFormat, destTilingMode, + FormatHasNecessaryFeature(renderer, destFormat.actualImageFormatID, destTilingMode, VK_FORMAT_FEATURE_TRANSFER_DST_BIT); return isTilingCompatible && srcFormatHasNecessaryFeature && dstFormatHasNecessaryFeature; @@ -3626,7 +3626,7 @@ angle::Result ImageHelper::initExternal(Context *context, imageInfo.pNext = externalImageCreateInfo; imageInfo.flags = GetImageCreateFlags(textureType) | additionalCreateFlags; imageInfo.imageType = mImageType; - imageInfo.format = format.actualImageVkFormat; + imageInfo.format = format.actualImageVkFormat(); imageInfo.extent = mExtents; imageInfo.mipLevels = mipLevels; imageInfo.arrayLayers = mLayerCount; @@ -3878,7 +3878,7 @@ angle::Result ImageHelper::initLayerImageView(Context *context, { return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut, baseMipLevelVk, levelCount, baseArrayLayer, layerCount, - mFormat->actualImageVkFormat, nullptr); + mFormat->actualImageVkFormat(), nullptr); } angle::Result ImageHelper::initLayerImageViewWithFormat(Context *context, @@ -3894,7 +3894,7 @@ angle::Result ImageHelper::initLayerImageViewWithFormat(Context *context, { return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut, baseMipLevelVk, levelCount, baseArrayLayer, layerCount, - format.actualImageVkFormat, nullptr); + format.actualImageVkFormat(), nullptr); } angle::Result ImageHelper::initLayerImageViewImpl( @@ -3969,7 +3969,7 @@ angle::Result ImageHelper::initReinterpretedLayerImageView(Context *context, uint32_t baseArrayLayer, uint32_t layerCount, VkImageUsageFlags imageUsageFlags, - VkFormat imageViewFormat) const + angle::FormatID imageViewFormat) const { VkImageViewUsageCreateInfo imageViewUsageCreateInfo = {}; imageViewUsageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO; @@ -3978,7 +3978,8 @@ angle::Result ImageHelper::initReinterpretedLayerImageView(Context *context, return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut, baseMipLevelVk, levelCount, baseArrayLayer, layerCount, - imageViewFormat, &imageViewUsageCreateInfo); + vk::GetVkFormatFromFormatID(imageViewFormat), + &imageViewUsageCreateInfo); } void ImageHelper::destroy(RendererVk *renderer) @@ -4045,7 +4046,7 @@ angle::Result ImageHelper::init2DStaging(Context *context, imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.flags = 0; imageInfo.imageType = mImageType; - imageInfo.format = format.actualImageVkFormat; + imageInfo.format = format.actualImageVkFormat(); imageInfo.extent = mExtents; imageInfo.mipLevels = 1; imageInfo.arrayLayers = mLayerCount; @@ -5957,7 +5958,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk, // per pixel which is sufficient to contain its depth aspect (no stencil aspect). uint32_t pixelBytes = imageFormat.pixelBytes; uint32_t depthBytesPerPixel = imageFormat.depthBits >> 3; - if (mFormat->actualImageVkFormat == VK_FORMAT_D24_UNORM_S8_UINT) + if (mFormat->actualImageVkFormat() == VK_FORMAT_D24_UNORM_S8_UINT) { pixelBytes = 5; depthBytesPerPixel = 4; @@ -6725,18 +6726,18 @@ angle::Result ImageViewHelper::initSRGBReadViewsImpl(ContextVk *contextVk, // When we select the linear/srgb counterpart formats, we must first make sure they're // actually supported by the ICD. If they are not supported by the ICD, then we treat that as if // there is no counterpart format. (In this case, the relevant extension should not be exposed) - VkFormat srgbOverrideFormat = ConvertToSRGB(image.getFormat().actualImageVkFormat); - ASSERT((srgbOverrideFormat == VK_FORMAT_UNDEFINED) || + angle::FormatID srgbOverrideFormat = ConvertToSRGB(image.getFormat().actualImageFormatID); + ASSERT((srgbOverrideFormat == angle::FormatID::NONE) || (HasNonRenderableTextureFormatSupport(contextVk->getRenderer(), srgbOverrideFormat))); - VkFormat linearOverrideFormat = ConvertToLinear(image.getFormat().actualImageVkFormat); - ASSERT((linearOverrideFormat == VK_FORMAT_UNDEFINED) || + angle::FormatID linearOverrideFormat = ConvertToLinear(image.getFormat().actualImageFormatID); + ASSERT((linearOverrideFormat == angle::FormatID::NONE) || (HasNonRenderableTextureFormatSupport(contextVk->getRenderer(), linearOverrideFormat))); - VkFormat linearFormat = (linearOverrideFormat != VK_FORMAT_UNDEFINED) - ? linearOverrideFormat - : format.actualImageVkFormat; - ASSERT(linearFormat != VK_FORMAT_UNDEFINED); + angle::FormatID linearFormat = (linearOverrideFormat != angle::FormatID::NONE) + ? linearOverrideFormat + : format.actualImageFormatID; + ASSERT(linearFormat != angle::FormatID::NONE); const VkImageAspectFlags aspectFlags = GetFormatAspectFlags(format.intendedFormat()); @@ -6747,7 +6748,7 @@ angle::Result ImageViewHelper::initSRGBReadViewsImpl(ContextVk *contextVk, &mPerLevelLinearReadImageViews[mCurrentMaxLevel.get()], baseLevel, levelCount, baseLayer, layerCount, imageUsageFlags, linearFormat)); } - if (srgbOverrideFormat != VK_FORMAT_UNDEFINED && + if (srgbOverrideFormat != angle::FormatID::NONE && !mPerLevelSRGBReadImageViews[mCurrentMaxLevel.get()].valid()) { ANGLE_TRY(image.initReinterpretedLayerImageView( @@ -6771,7 +6772,7 @@ angle::Result ImageViewHelper::initSRGBReadViewsImpl(ContextVk *contextVk, &mPerLevelLinearFetchImageViews[mCurrentMaxLevel.get()], baseLevel, levelCount, baseLayer, layerCount, imageUsageFlags, linearFormat)); } - if (srgbOverrideFormat != VK_FORMAT_UNDEFINED && + if (srgbOverrideFormat != angle::FormatID::NONE && !mPerLevelSRGBFetchImageViews[mCurrentMaxLevel.get()].valid()) { ANGLE_TRY(image.initReinterpretedLayerImageView( @@ -6788,7 +6789,7 @@ angle::Result ImageViewHelper::initSRGBReadViewsImpl(ContextVk *contextVk, &mPerLevelLinearCopyImageViews[mCurrentMaxLevel.get()], baseLevel, levelCount, baseLayer, layerCount, imageUsageFlags, linearFormat)); } - if (srgbOverrideFormat != VK_FORMAT_UNDEFINED && + if (srgbOverrideFormat != angle::FormatID::NONE && !mPerLevelSRGBCopyImageViews[mCurrentMaxLevel.get()].valid()) { ANGLE_TRY(image.initReinterpretedLayerImageView( @@ -6806,7 +6807,7 @@ angle::Result ImageViewHelper::getLevelStorageImageView(ContextVk *contextVk, LevelIndex levelVk, uint32_t layer, VkImageUsageFlags imageUsageFlags, - VkFormat vkImageFormat, + angle::FormatID formatID, const ImageView **imageViewOut) { ASSERT(mImageViewSerial.valid()); @@ -6823,9 +6824,9 @@ angle::Result ImageViewHelper::getLevelStorageImageView(ContextVk *contextVk, } // Create the view. Note that storage images are not affected by swizzle parameters. - return image.initReinterpretedLayerImageView( - contextVk, viewType, image.getAspectFlags(), gl::SwizzleState(), imageView, levelVk, 1, - layer, image.getLayerCount(), imageUsageFlags, vkImageFormat); + return image.initReinterpretedLayerImageView(contextVk, viewType, image.getAspectFlags(), + gl::SwizzleState(), imageView, levelVk, 1, layer, + image.getLayerCount(), imageUsageFlags, formatID); } angle::Result ImageViewHelper::getLevelLayerStorageImageView(ContextVk *contextVk, @@ -6833,7 +6834,7 @@ angle::Result ImageViewHelper::getLevelLayerStorageImageView(ContextVk *contextV LevelIndex levelVk, uint32_t layer, VkImageUsageFlags imageUsageFlags, - VkFormat vkImageFormat, + angle::FormatID formatID, const ImageView **imageViewOut) { ASSERT(image.valid()); @@ -6856,7 +6857,7 @@ angle::Result ImageViewHelper::getLevelLayerStorageImageView(ContextVk *contextV gl::TextureType viewType = Get2DTextureType(1, image.getSamples()); return image.initReinterpretedLayerImageView(contextVk, viewType, image.getAspectFlags(), gl::SwizzleState(), imageView, levelVk, 1, layer, - 1, imageUsageFlags, vkImageFormat); + 1, imageUsageFlags, formatID); } angle::Result ImageViewHelper::getLevelDrawImageView(ContextVk *contextVk, @@ -7018,7 +7019,9 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk, { ASSERT(format.valid()); - auto iter = mViews.find(format.actualBufferVkFormat); + VkFormat viewVkFormat = format.actualBufferVkFormat(false); + + auto iter = mViews.find(viewVkFormat); if (iter != mViews.end()) { *viewOut = &iter->second; @@ -7035,7 +7038,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk, VkBufferViewCreateInfo viewCreateInfo = {}; viewCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; viewCreateInfo.buffer = buffer.getBuffer().getHandle(); - viewCreateInfo.format = format.actualBufferVkFormat; + viewCreateInfo.format = viewVkFormat; viewCreateInfo.offset = mOffset; viewCreateInfo.range = size; @@ -7043,7 +7046,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk, ANGLE_VK_TRY(contextVk, view.init(contextVk->getDevice(), viewCreateInfo)); // Cache the view - auto insertIter = mViews.insert({format.actualBufferVkFormat, std::move(view)}); + auto insertIter = mViews.insert({viewVkFormat, std::move(view)}); *viewOut = &insertIter.first->second; ASSERT(insertIter.second); diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.h b/src/libANGLE/renderer/vulkan/vk_helpers.h index 04d15a9e6..40851d1fc 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.h +++ b/src/libANGLE/renderer/vulkan/vk_helpers.h @@ -1302,7 +1302,7 @@ enum class ImageLayout VkImageLayout ConvertImageLayoutToVkImageLayout(ImageLayout imageLayout); bool FormatHasNecessaryFeature(RendererVk *renderer, - VkFormat format, + angle::FormatID formatID, VkImageTiling tilingMode, VkFormatFeatureFlags featureBits); @@ -1389,7 +1389,7 @@ class ImageHelper final : public Resource, public angle::Subject uint32_t baseArrayLayer, uint32_t layerCount, VkImageUsageFlags imageUsageFlags, - VkFormat imageViewFormat) const; + angle::FormatID imageViewFormat) const; angle::Result initImageView(Context *context, gl::TextureType textureType, VkImageAspectFlags aspectMask, @@ -2089,7 +2089,7 @@ class ImageViewHelper final : public Resource LevelIndex levelVk, uint32_t layer, VkImageUsageFlags imageUsageFlags, - VkFormat vkImageFormat, + angle::FormatID formatID, const ImageView **imageViewOut); // Creates a storage view with a single layer of the level. @@ -2098,7 +2098,7 @@ class ImageViewHelper final : public Resource LevelIndex levelVk, uint32_t layer, VkImageUsageFlags imageUsageFlags, - VkFormat vkImageFormat, + angle::FormatID formatID, const ImageView **imageViewOut); // Creates a draw view with all layers of the level. diff --git a/src/libANGLE/renderer/vulkan/vk_utils.cpp b/src/libANGLE/renderer/vulkan/vk_utils.cpp index 22331ba40..fc79d6305 100644 --- a/src/libANGLE/renderer/vulkan/vk_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_utils.cpp @@ -989,7 +989,7 @@ void InitExternalSemaphoreCapabilitiesFunctions(VkInstance instance) GLenum CalculateGenerateMipmapFilter(ContextVk *contextVk, const vk::Format &format) { const bool formatSupportsLinearFiltering = contextVk->getRenderer()->hasImageFormatFeatureBits( - format.actualImageVkFormat, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); + format.actualImageFormatID, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); const bool hintFastest = contextVk->getState().getGenerateMipmapHint() == GL_FASTEST; return formatSupportsLinearFiltering && !hintFastest ? GL_LINEAR : GL_NEAREST; diff --git a/src/libANGLE/renderer/vulkan/win32/DisplayVkWin32.cpp b/src/libANGLE/renderer/vulkan/win32/DisplayVkWin32.cpp index f9444fa9d..20a4375d5 100644 --- a/src/libANGLE/renderer/vulkan/win32/DisplayVkWin32.cpp +++ b/src/libANGLE/renderer/vulkan/win32/DisplayVkWin32.cpp @@ -163,7 +163,7 @@ void DisplayVkWin32::checkConfigSupport(egl::Config *config) for (const VkSurfaceFormatKHR &surfaceFormat : mSurfaceFormats) { - if (surfaceFormat.format == formatVk.actualImageVkFormat) + if (surfaceFormat.format == formatVk.actualImageVkFormat()) { return; } diff --git a/src/tests/gl_tests/VulkanFormatTablesTest.cpp b/src/tests/gl_tests/VulkanFormatTablesTest.cpp index 43483cfc1..ee7ff9bc9 100644 --- a/src/tests/gl_tests/VulkanFormatTablesTest.cpp +++ b/src/tests/gl_tests/VulkanFormatTablesTest.cpp @@ -70,20 +70,23 @@ TEST_P(VulkanFormatTablesTest, TestFormatSupport) for (const ParametersToTest params : parametersToTest) { + VkFormat actualImageVkFormat = + rx::vk::GetVkFormatFromFormatID(vkFormat.actualImageFormatID); + // Now let's verify that against vulkan. VkFormatProperties formatProperties; - vkGetPhysicalDeviceFormatProperties(renderer->getPhysicalDevice(), - vkFormat.actualImageVkFormat, &formatProperties); + vkGetPhysicalDeviceFormatProperties(renderer->getPhysicalDevice(), actualImageVkFormat, + &formatProperties); VkImageFormatProperties imageProperties; // isTexturable? bool isTexturable = vkGetPhysicalDeviceImageFormatProperties( - renderer->getPhysicalDevice(), vkFormat.actualImageVkFormat, params.imageType, + renderer->getPhysicalDevice(), actualImageVkFormat, params.imageType, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT, params.createFlags, &imageProperties) == VK_SUCCESS; - EXPECT_EQ(isTexturable, textureCaps.texturable) << vkFormat.actualImageVkFormat; + EXPECT_EQ(isTexturable, textureCaps.texturable) << actualImageVkFormat; // TODO(jmadill): Support ES3 textures. @@ -91,23 +94,23 @@ TEST_P(VulkanFormatTablesTest, TestFormatSupport) bool isFilterable = (formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) == VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; - EXPECT_EQ(isFilterable, textureCaps.filterable) << vkFormat.actualImageVkFormat; + EXPECT_EQ(isFilterable, textureCaps.filterable) << actualImageVkFormat; // isRenderable? const bool isRenderableColor = (vkGetPhysicalDeviceImageFormatProperties( - renderer->getPhysicalDevice(), vkFormat.actualImageVkFormat, params.imageType, + renderer->getPhysicalDevice(), actualImageVkFormat, params.imageType, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, params.createFlags, &imageProperties)) == VK_SUCCESS; const bool isRenderableDepthStencil = (vkGetPhysicalDeviceImageFormatProperties( - renderer->getPhysicalDevice(), vkFormat.actualImageVkFormat, params.imageType, + renderer->getPhysicalDevice(), actualImageVkFormat, params.imageType, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, params.createFlags, &imageProperties)) == VK_SUCCESS; bool isRenderable = isRenderableColor || isRenderableDepthStencil; - EXPECT_EQ(isRenderable, textureCaps.textureAttachment) << vkFormat.actualImageVkFormat; - EXPECT_EQ(isRenderable, textureCaps.renderbuffer) << vkFormat.actualImageVkFormat; + EXPECT_EQ(isRenderable, textureCaps.textureAttachment) << actualImageVkFormat; + EXPECT_EQ(isRenderable, textureCaps.renderbuffer) << actualImageVkFormat; } } }