Commit e91097bf by Jamie Madill Committed by Commit Bot

Vulkan: Clean up "actual"/"intended" naming.

Clarifies that the GL internal format is an "intended" format and the Vulkan formats are "actual" formats. This makes all the format fields use the same consistent naming pattern. Bug: angleproject:5438 Change-Id: I935a49895109e9e06eae5ef98d5614dfd1128ff8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2605728Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 973bd4ba
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"aa4a0d3463b76858a75787b9cdec8e98", "aa4a0d3463b76858a75787b9cdec8e98",
"src/libANGLE/renderer/vulkan/gen_vk_format_table.py": "src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"b4d38f08a354849dcba2a8f9f2569069", "bf2279d1d8da7e3e271a352e101c8956",
"src/libANGLE/renderer/vulkan/vk_format_map.json": "src/libANGLE/renderer/vulkan/vk_format_map.json":
"b62588b1e9f6d9fa98aeea886d8ed2bd", "b62588b1e9f6d9fa98aeea886d8ed2bd",
"src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp": "src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp":
"dfb656a573582202fe813eb23d5052dc" "4dfb7525b4f45690091d6642e77481a3"
} }
\ No newline at end of file
...@@ -49,13 +49,13 @@ constexpr unsigned int kEmulatedAlphaValue = 1; ...@@ -49,13 +49,13 @@ constexpr unsigned int kEmulatedAlphaValue = 1;
bool HasSrcBlitFeature(RendererVk *renderer, RenderTargetVk *srcRenderTarget) bool HasSrcBlitFeature(RendererVk *renderer, RenderTargetVk *srcRenderTarget)
{ {
const VkFormat srcFormat = srcRenderTarget->getImageFormat().vkImageFormat; const VkFormat srcFormat = srcRenderTarget->getImageFormat().actualImageVkFormat;
return renderer->hasImageFormatFeatureBits(srcFormat, VK_FORMAT_FEATURE_BLIT_SRC_BIT); return renderer->hasImageFormatFeatureBits(srcFormat, VK_FORMAT_FEATURE_BLIT_SRC_BIT);
} }
bool HasDstBlitFeature(RendererVk *renderer, RenderTargetVk *dstRenderTarget) bool HasDstBlitFeature(RendererVk *renderer, RenderTargetVk *dstRenderTarget)
{ {
const VkFormat dstFormat = dstRenderTarget->getImageFormat().vkImageFormat; const VkFormat dstFormat = dstRenderTarget->getImageFormat().actualImageVkFormat;
return renderer->hasImageFormatFeatureBits(dstFormat, VK_FORMAT_FEATURE_BLIT_DST_BIT); return renderer->hasImageFormatFeatureBits(dstFormat, VK_FORMAT_FEATURE_BLIT_DST_BIT);
} }
...@@ -87,7 +87,7 @@ bool AreSrcAndDstFormatsIdentical(RenderTargetVk *srcRenderTarget, RenderTargetV ...@@ -87,7 +87,7 @@ bool AreSrcAndDstFormatsIdentical(RenderTargetVk *srcRenderTarget, RenderTargetV
const vk::Format &srcFormat = srcRenderTarget->getImageFormat(); const vk::Format &srcFormat = srcRenderTarget->getImageFormat();
const vk::Format &dstFormat = dstRenderTarget->getImageFormat(); const vk::Format &dstFormat = dstRenderTarget->getImageFormat();
return srcFormat.vkImageFormat == dstFormat.vkImageFormat; return srcFormat.actualImageVkFormat == dstFormat.actualImageVkFormat;
} }
bool AreSrcAndDstDepthStencilChannelsBlitCompatible(RenderTargetVk *srcRenderTarget, bool AreSrcAndDstDepthStencilChannelsBlitCompatible(RenderTargetVk *srcRenderTarget,
......
...@@ -178,7 +178,7 @@ angle::Result MemoryObjectVk::createImage(ContextVk *contextVk, ...@@ -178,7 +178,7 @@ angle::Result MemoryObjectVk::createImage(ContextVk *contextVk,
// values constituting the bits of |usageFlags| are identical to their corresponding Vulkan // values constituting the bits of |usageFlags| are identical to their corresponding Vulkan
// value. // value.
const VkImageUsageFlags imageUsageFlags = const VkImageUsageFlags imageUsageFlags =
vk::GetMaximalImageUsageFlags(renderer, vkFormat.vkImageFormat) & usageFlags; vk::GetMaximalImageUsageFlags(renderer, vkFormat.actualImageVkFormat) & usageFlags;
VkExternalMemoryImageCreateInfo externalMemoryImageCreateInfo = {}; VkExternalMemoryImageCreateInfo externalMemoryImageCreateInfo = {};
externalMemoryImageCreateInfo.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; externalMemoryImageCreateInfo.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO;
......
...@@ -217,7 +217,7 @@ angle::Result OverlayVk::onPresent(ContextVk *contextVk, ...@@ -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. // If the swapchain image doesn't support storage image, we can't output to it.
VkFormatFeatureFlags featureBits = renderer->getImageFormatFeatureBits( VkFormatFeatureFlags featureBits = renderer->getImageFormatFeatureBits(
imageToPresent->getFormat().vkImageFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); imageToPresent->getFormat().actualImageVkFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT);
if ((featureBits & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) == 0) if ((featureBits & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) == 0)
{ {
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -82,7 +82,7 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context, ...@@ -82,7 +82,7 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context,
// causing it to be interpreted in a different colorspace. Create the VkImage accordingly. // causing it to be interpreted in a different colorspace. Create the VkImage accordingly.
VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone; VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone;
VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr; VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr;
VkFormat vkImageFormat = vkFormat.vkImageFormat; VkFormat vkImageFormat = vkFormat.actualImageVkFormat;
VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB
? vk::ConvertToLinear(vkImageFormat) ? vk::ConvertToLinear(vkImageFormat)
: vk::ConvertToSRGB(vkImageFormat); : vk::ConvertToSRGB(vkImageFormat);
......
...@@ -136,7 +136,7 @@ angle::Result InitImageHelper(DisplayVk *displayVk, ...@@ -136,7 +136,7 @@ angle::Result InitImageHelper(DisplayVk *displayVk,
// causing it to be interpreted in a different colorspace. Create the VkImage accordingly. // causing it to be interpreted in a different colorspace. Create the VkImage accordingly.
VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone; VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone;
VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr; VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr;
VkFormat vkImageFormat = vkFormat.vkImageFormat; VkFormat vkImageFormat = vkFormat.actualImageVkFormat;
VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB
? vk::ConvertToLinear(vkImageFormat) ? vk::ConvertToLinear(vkImageFormat)
: vk::ConvertToSRGB(vkImageFormat); : vk::ConvertToSRGB(vkImageFormat);
...@@ -680,7 +680,7 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk) ...@@ -680,7 +680,7 @@ angle::Result WindowSurfaceVk::initializeImpl(DisplayVk *displayVk)
surfaceFormats.data())); surfaceFormats.data()));
const vk::Format &format = renderer->getFormat(mState.config->renderTargetFormat); const vk::Format &format = renderer->getFormat(mState.config->renderTargetFormat);
VkFormat nativeFormat = format.vkImageFormat; VkFormat nativeFormat = format.actualImageVkFormat;
if (surfaceFormatCount == 1u && surfaceFormats[0].format == VK_FORMAT_UNDEFINED) if (surfaceFormatCount == 1u && surfaceFormats[0].format == VK_FORMAT_UNDEFINED)
{ {
...@@ -929,7 +929,7 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context, ...@@ -929,7 +929,7 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context,
VkDevice device = renderer->getDevice(); VkDevice device = renderer->getDevice();
const vk::Format &format = renderer->getFormat(mState.config->renderTargetFormat); const vk::Format &format = renderer->getFormat(mState.config->renderTargetFormat);
VkFormat nativeFormat = format.vkImageFormat; VkFormat nativeFormat = format.actualImageVkFormat;
gl::Extents rotatedExtents = extents; gl::Extents rotatedExtents = extents;
if (Is90DegreeRotation(getPreTransform())) if (Is90DegreeRotation(getPreTransform()))
......
...@@ -151,10 +151,12 @@ bool CanCopyWithDraw(RendererVk *renderer, ...@@ -151,10 +151,12 @@ bool CanCopyWithDraw(RendererVk *renderer,
VkImageTiling destTilingMode) VkImageTiling destTilingMode)
{ {
// Checks that the formats in copy by drawing have the appropriate feature bits // Checks that the formats in copy by drawing have the appropriate feature bits
bool srcFormatHasNecessaryFeature = vk::FormatHasNecessaryFeature( bool srcFormatHasNecessaryFeature =
renderer, srcFormat.vkImageFormat, srcTilingMode, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); vk::FormatHasNecessaryFeature(renderer, srcFormat.actualImageVkFormat, srcTilingMode,
bool dstFormatHasNecessaryFeature = vk::FormatHasNecessaryFeature( VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
renderer, destFormat.vkImageFormat, destTilingMode, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT); bool dstFormatHasNecessaryFeature =
vk::FormatHasNecessaryFeature(renderer, destFormat.actualImageVkFormat, destTilingMode,
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
return srcFormatHasNecessaryFeature && dstFormatHasNecessaryFeature; return srcFormatHasNecessaryFeature && dstFormatHasNecessaryFeature;
} }
...@@ -178,7 +180,7 @@ bool CanGenerateMipmapWithCompute(RendererVk *renderer, ...@@ -178,7 +180,7 @@ bool CanGenerateMipmapWithCompute(RendererVk *renderer,
// Format must have STORAGE support. // Format must have STORAGE support.
const bool hasStorageSupport = renderer->hasImageFormatFeatureBits( const bool hasStorageSupport = renderer->hasImageFormatFeatureBits(
format.vkImageFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); format.actualImageVkFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT);
// No support for sRGB formats yet. // No support for sRGB formats yet.
const bool isSRGB = angleFormat.isSRGB; const bool isSRGB = angleFormat.isSRGB;
...@@ -285,7 +287,7 @@ angle::Result CopyAndStageImageSubresource(ContextVk *contextVk, ...@@ -285,7 +287,7 @@ angle::Result CopyAndStageImageSubresource(ContextVk *contextVk,
// Stage an update to the new image // Stage an update to the new image
ASSERT(stagingBuffer); ASSERT(stagingBuffer);
const gl::InternalFormat &formatInfo = const gl::InternalFormat &formatInfo =
gl::GetSizedInternalFormatInfo(dstImage->getFormat().internalFormat); gl::GetSizedInternalFormatInfo(dstImage->getFormat().intendedGLFormat);
uint32_t bufferRowLength; uint32_t bufferRowLength;
uint32_t bufferImageHeight; uint32_t bufferImageHeight;
ANGLE_VK_CHECK_MATH(contextVk, ANGLE_VK_CHECK_MATH(contextVk,
...@@ -1434,13 +1436,13 @@ void TextureVk::initImageUsageFlags(ContextVk *contextVk, const vk::Format &form ...@@ -1434,13 +1436,13 @@ void TextureVk::initImageUsageFlags(ContextVk *contextVk, const vk::Format &form
{ {
// Work around a bug in the Mock ICD: // Work around a bug in the Mock ICD:
// https://github.com/KhronosGroup/Vulkan-Tools/issues/445 // https://github.com/KhronosGroup/Vulkan-Tools/issues/445
if (renderer->hasImageFormatFeatureBits(format.vkImageFormat, if (renderer->hasImageFormatFeatureBits(format.actualImageVkFormat,
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
{ {
mImageUsageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; mImageUsageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
} }
} }
else if (renderer->hasImageFormatFeatureBits(format.vkImageFormat, else if (renderer->hasImageFormatFeatureBits(format.actualImageVkFormat,
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT))
{ {
mImageUsageFlags |= mImageUsageFlags |=
...@@ -1857,7 +1859,7 @@ angle::Result TextureVk::generateMipmap(const gl::Context *context) ...@@ -1857,7 +1859,7 @@ angle::Result TextureVk::generateMipmap(const gl::Context *context)
return generateMipmapsWithCompute(contextVk); return generateMipmapsWithCompute(contextVk);
} }
else if (renderer->hasImageFormatFeatureBits(mImage->getFormat().vkImageFormat, else if (renderer->hasImageFormatFeatureBits(mImage->getFormat().actualImageVkFormat,
kBlitFeatureFlags)) kBlitFeatureFlags))
{ {
// Otherwise, use blit if possible. // Otherwise, use blit if possible.
...@@ -2482,7 +2484,7 @@ bool TextureVk::shouldDecodeSRGB(ContextVk *contextVk, ...@@ -2482,7 +2484,7 @@ bool TextureVk::shouldDecodeSRGB(ContextVk *contextVk,
bool decodeSRGB = format.actualImageFormat().isSRGB; bool decodeSRGB = format.actualImageFormat().isSRGB;
// If the SRGB override is enabled, we also decode SRGB. // If the SRGB override is enabled, we also decode SRGB.
if (isSRGBOverrideEnabled() && vk::IsOverridableLinearFormat(format.vkImageFormat)) if (isSRGBOverrideEnabled() && vk::IsOverridableLinearFormat(format.actualImageVkFormat))
{ {
decodeSRGB = true; decodeSRGB = true;
} }
...@@ -2556,7 +2558,7 @@ const vk::ImageView &TextureVk::getCopyImageViewAndRecordUse(ContextVk *contextV ...@@ -2556,7 +2558,7 @@ const vk::ImageView &TextureVk::getCopyImageViewAndRecordUse(ContextVk *contextV
imageViews.retain(&contextVk->getResourceUseList()); imageViews.retain(&contextVk->getResourceUseList());
ASSERT(mImage->getFormat().actualImageFormat().isSRGB == ASSERT(mImage->getFormat().actualImageFormat().isSRGB ==
(vk::ConvertToLinear(mImage->getFormat().vkImageFormat) != VK_FORMAT_UNDEFINED)); (vk::ConvertToLinear(mImage->getFormat().actualImageVkFormat) != VK_FORMAT_UNDEFINED));
if (mImage->getFormat().actualImageFormat().isSRGB) if (mImage->getFormat().actualImageFormat().isSRGB)
{ {
return imageViews.getSRGBCopyImageView(); return imageViews.getSRGBCopyImageView();
...@@ -2596,7 +2598,7 @@ angle::Result TextureVk::getStorageImageView(ContextVk *contextVk, ...@@ -2596,7 +2598,7 @@ angle::Result TextureVk::getStorageImageView(ContextVk *contextVk,
return getImageViews().getLevelLayerStorageImageView( return getImageViews().getLevelLayerStorageImageView(
contextVk, *mImage, nativeLevelVk, nativeLayer, contextVk, *mImage, nativeLevelVk, nativeLayer,
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.vkImageFormat, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.actualImageVkFormat,
imageViewOut); imageViewOut);
} }
...@@ -2604,7 +2606,7 @@ angle::Result TextureVk::getStorageImageView(ContextVk *contextVk, ...@@ -2604,7 +2606,7 @@ angle::Result TextureVk::getStorageImageView(ContextVk *contextVk,
return getImageViews().getLevelStorageImageView( return getImageViews().getLevelStorageImageView(
contextVk, mState.getType(), *mImage, nativeLevelVk, nativeLayer, contextVk, mState.getType(), *mImage, nativeLevelVk, nativeLayer,
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.vkImageFormat, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, format.actualImageVkFormat,
imageViewOut); imageViewOut);
} }
...@@ -2646,7 +2648,7 @@ angle::Result TextureVk::initImage(ContextVk *contextVk, ...@@ -2646,7 +2648,7 @@ angle::Result TextureVk::initImage(ContextVk *contextVk,
// With the introduction of sRGB related GLES extensions any texture could be respecified // 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. // causing it to be interpreted in a different colorspace. Create the VkImage accordingly.
VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr; VkImageFormatListCreateInfoKHR *additionalCreateInfo = nullptr;
VkFormat imageFormat = format.vkImageFormat; VkFormat imageFormat = format.actualImageVkFormat;
VkFormat imageListFormat = format.actualImageFormat().isSRGB ? vk::ConvertToLinear(imageFormat) VkFormat imageListFormat = format.actualImageFormat().isSRGB ? vk::ConvertToLinear(imageFormat)
: vk::ConvertToSRGB(imageFormat); : vk::ConvertToSRGB(imageFormat);
......
...@@ -2134,9 +2134,9 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk, ...@@ -2134,9 +2134,9 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk,
shaderParams.rotateXY = 0; shaderParams.rotateXY = 0;
shaderParams.srcIsSRGB = shaderParams.srcIsSRGB =
gl::GetSizedInternalFormatInfo(srcFormat.internalFormat).colorEncoding == GL_SRGB; gl::GetSizedInternalFormatInfo(srcFormat.intendedGLFormat).colorEncoding == GL_SRGB;
shaderParams.destIsSRGB = shaderParams.destIsSRGB =
gl::GetSizedInternalFormatInfo(dstFormat.internalFormat).colorEncoding == GL_SRGB; gl::GetSizedInternalFormatInfo(dstFormat.intendedGLFormat).colorEncoding == GL_SRGB;
// If both src and dest are sRGB, and there is no alpha multiplication/division necessary, then // If both src and dest are sRGB, and there is no alpha multiplication/division necessary, then
// the shader can work with sRGB data and pretend they are linear. // the shader can work with sRGB data and pretend they are linear.
......
...@@ -199,7 +199,7 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk ...@@ -199,7 +199,7 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk
// With the introduction of sRGB related GLES extensions any texture could be respecified // 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. // causing it to be interpreted in a different colorspace. Create the VkImage accordingly.
VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone; VkImageCreateFlags imageCreateFlags = vk::kVkImageCreateFlagsNone;
VkFormat vkImageFormat = vkFormat.vkImageFormat; VkFormat vkImageFormat = vkFormat.actualImageVkFormat;
VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB VkFormat vkImageListFormat = vkFormat.actualImageFormat().isSRGB
? vk::ConvertToLinear(vkImageFormat) ? vk::ConvertToLinear(vkImageFormat)
: vk::ConvertToSRGB(vkImageFormat); : vk::ConvertToSRGB(vkImageFormat);
...@@ -290,15 +290,15 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk ...@@ -290,15 +290,15 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk
constexpr uint32_t kColorRenderableRequiredBits = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; constexpr uint32_t kColorRenderableRequiredBits = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
constexpr uint32_t kDepthStencilRenderableRequiredBits = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; constexpr uint32_t kDepthStencilRenderableRequiredBits = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
mRenderable = mRenderable = renderer->hasImageFormatFeatureBits(vkFormat.actualImageVkFormat,
renderer->hasImageFormatFeatureBits(vkFormat.vkImageFormat, kColorRenderableRequiredBits) || kColorRenderableRequiredBits) ||
renderer->hasImageFormatFeatureBits(vkFormat.vkImageFormat, renderer->hasImageFormatFeatureBits(vkFormat.actualImageVkFormat,
kDepthStencilRenderableRequiredBits); kDepthStencilRenderableRequiredBits);
constexpr uint32_t kTextureableRequiredBits = constexpr uint32_t kTextureableRequiredBits =
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
mTextureable = mTextureable =
renderer->hasImageFormatFeatureBits(vkFormat.vkImageFormat, kTextureableRequiredBits); renderer->hasImageFormatFeatureBits(vkFormat.actualImageVkFormat, kTextureableRequiredBits);
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -65,14 +65,14 @@ break; ...@@ -65,14 +65,14 @@ break;
""" """
format_entry_template = """case angle::FormatID::{format_id}: format_entry_template = """case angle::FormatID::{format_id}:
internalFormat = {internal_format}; intendedGLFormat = {internal_format};
{image_template} {image_template}
{buffer_template} {buffer_template}
break; break;
""" """
image_basic_template = """actualImageFormatID = {image}; image_basic_template = """actualImageFormatID = {image};
vkImageFormat = {vk_image_format}; actualImageVkFormat = {vk_image_format};
imageInitializerFunction = {image_initializer};""" imageInitializerFunction = {image_initializer};"""
image_struct_template = "{{{image}, {vk_image_format}, {image_initializer}}}" image_struct_template = "{{{image}, {vk_image_format}, {image_initializer}}}"
...@@ -83,7 +83,7 @@ initImageFallback(renderer, kInfo, ArraySize(kInfo)); ...@@ -83,7 +83,7 @@ initImageFallback(renderer, kInfo, ArraySize(kInfo));
}}""" }}"""
buffer_basic_template = """actualBufferFormatID = {buffer}; buffer_basic_template = """actualBufferFormatID = {buffer};
vkBufferFormat = {vk_buffer_format}; actualBufferVkFormat = {vk_buffer_format};
vkBufferFormatIsPacked = {vk_buffer_format_is_packed}; vkBufferFormatIsPacked = {vk_buffer_format_is_packed};
vertexLoadFunction = {vertex_load_function}; vertexLoadFunction = {vertex_load_function};
vertexLoadRequiresConversion = {vertex_load_converts};""" vertexLoadRequiresConversion = {vertex_load_converts};"""
......
...@@ -155,7 +155,7 @@ void UnpackAttachmentDesc(VkAttachmentDescription *desc, ...@@ -155,7 +155,7 @@ void UnpackAttachmentDesc(VkAttachmentDescription *desc,
{ {
// We would only need this flag for duplicated attachments. Apply it conservatively. // We would only need this flag for duplicated attachments. Apply it conservatively.
desc->flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT; desc->flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT;
desc->format = format.vkImageFormat; desc->format = format.actualImageVkFormat;
desc->samples = gl_vk::GetSamples(samples); desc->samples = gl_vk::GetSamples(samples);
desc->loadOp = static_cast<VkAttachmentLoadOp>(ops.loadOp); desc->loadOp = static_cast<VkAttachmentLoadOp>(ops.loadOp);
desc->storeOp = desc->storeOp =
...@@ -179,7 +179,7 @@ void UnpackColorResolveAttachmentDesc(VkAttachmentDescription *desc, ...@@ -179,7 +179,7 @@ void UnpackColorResolveAttachmentDesc(VkAttachmentDescription *desc,
// attachments simultaneously, so this flag can likely be removed without any issue if it incurs // attachments simultaneously, so this flag can likely be removed without any issue if it incurs
// a performance penalty. // a performance penalty.
desc->flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT; desc->flags = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT;
desc->format = format.vkImageFormat; desc->format = format.actualImageVkFormat;
// This function is for color resolve attachments. // This function is for color resolve attachments.
const angle::Format &angleFormat = format.actualImageFormat(); const angle::Format &angleFormat = format.actualImageFormat();
...@@ -212,7 +212,7 @@ void UnpackDepthStencilResolveAttachmentDesc(VkAttachmentDescription *desc, ...@@ -212,7 +212,7 @@ void UnpackDepthStencilResolveAttachmentDesc(VkAttachmentDescription *desc,
// There cannot be simultaneous usages of the depth/stencil resolve image, as depth/stencil // There cannot be simultaneous usages of the depth/stencil resolve image, as depth/stencil
// resolve currently only comes from depth/stencil renderbuffers. // resolve currently only comes from depth/stencil renderbuffers.
desc->flags = 0; desc->flags = 0;
desc->format = format.vkImageFormat; desc->format = format.actualImageVkFormat;
// This function is for depth/stencil resolve attachment. // This function is for depth/stencil resolve attachment.
const angle::Format &angleFormat = format.intendedFormat(); const angle::Format &angleFormat = format.intendedFormat();
...@@ -1712,8 +1712,8 @@ angle::Result GraphicsPipelineDesc::initializePipeline( ...@@ -1712,8 +1712,8 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
angle::FormatID formatID = static_cast<angle::FormatID>(packedAttrib.format); angle::FormatID formatID = static_cast<angle::FormatID>(packedAttrib.format);
const Format &format = contextVk->getRenderer()->getFormat(formatID); const Format &format = contextVk->getRenderer()->getFormat(formatID);
const angle::Format &angleFormat = format.intendedFormat(); const angle::Format &angleFormat = format.intendedFormat();
VkFormat vkFormat = VkFormat vkFormat = packedAttrib.compressed ? format.actualCompressedBufferVkFormat
packedAttrib.compressed ? format.vkCompressedBufferFormat : format.vkBufferFormat; : format.actualBufferVkFormat;
gl::ComponentType attribType = gl::ComponentType attribType =
GetVertexAttributeComponentType(angleFormat.isPureInt(), angleFormat.vertexAttribType); GetVertexAttributeComponentType(angleFormat.isPureInt(), angleFormat.vertexAttribType);
......
...@@ -40,12 +40,12 @@ bool HasShaderImageAtomicsSupport(const RendererVk *rendererVk, ...@@ -40,12 +40,12 @@ bool HasShaderImageAtomicsSupport(const RendererVk *rendererVk,
const Format &formatVk = rendererVk->getFormat(GL_R32F); const Format &formatVk = rendererVk->getFormat(GL_R32F);
const bool hasImageAtomicSupport = rendererVk->hasImageFormatFeatureBits( const bool hasImageAtomicSupport = rendererVk->hasImageFormatFeatureBits(
formatVk.vkImageFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT); formatVk.actualImageVkFormat, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT);
bool hasBufferAtomicSupport = true; bool hasBufferAtomicSupport = true;
if (supportedExtensions.textureBufferAny()) if (supportedExtensions.textureBufferAny())
{ {
hasBufferAtomicSupport = rendererVk->hasBufferFormatFeatureBits( hasBufferAtomicSupport = rendererVk->hasBufferFormatFeatureBits(
formatVk.vkBufferFormat, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT); formatVk.actualBufferVkFormat, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT);
} }
return hasImageAtomicSupport && hasBufferAtomicSupport; return hasImageAtomicSupport && hasBufferAtomicSupport;
...@@ -66,10 +66,11 @@ bool FormatReinterpretationSupported(const std::vector<GLenum> &optionalSizedFor ...@@ -66,10 +66,11 @@ bool FormatReinterpretationSupported(const std::vector<GLenum> &optionalSizedFor
const Format &vkFormat = rendererVk->getFormat(glFormat); const Format &vkFormat = rendererVk->getFormat(glFormat);
VkFormat reinterpretedFormat = checkLinearColorspace VkFormat reinterpretedFormat = checkLinearColorspace
? ConvertToLinear(vkFormat.vkImageFormat) ? ConvertToLinear(vkFormat.actualImageVkFormat)
: ConvertToSRGB(vkFormat.vkImageFormat); : ConvertToSRGB(vkFormat.actualImageVkFormat);
if (!rendererVk->haveSameFormatFeatureBits(vkFormat.vkImageFormat, reinterpretedFormat)) if (!rendererVk->haveSameFormatFeatureBits(vkFormat.actualImageVkFormat,
reinterpretedFormat))
{ {
return false; return false;
} }
...@@ -178,7 +179,7 @@ bool HasTexelBufferSupport(const RendererVk *rendererVk, GLenum formatGL) ...@@ -178,7 +179,7 @@ bool HasTexelBufferSupport(const RendererVk *rendererVk, GLenum formatGL)
const Format &formatVk = rendererVk->getFormat(formatGL); const Format &formatVk = rendererVk->getFormat(formatGL);
return rendererVk->hasBufferFormatFeatureBits( return rendererVk->hasBufferFormatFeatureBits(
formatVk.vkBufferFormat, formatVk.actualBufferVkFormat,
VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT); VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -111,13 +111,13 @@ namespace vk ...@@ -111,13 +111,13 @@ namespace vk
// Format implementation. // Format implementation.
Format::Format() Format::Format()
: intendedFormatID(angle::FormatID::NONE), : intendedFormatID(angle::FormatID::NONE),
internalFormat(GL_NONE), intendedGLFormat(GL_NONE),
actualImageFormatID(angle::FormatID::NONE), actualImageFormatID(angle::FormatID::NONE),
vkImageFormat(VK_FORMAT_UNDEFINED), actualImageVkFormat(VK_FORMAT_UNDEFINED),
actualBufferFormatID(angle::FormatID::NONE), actualBufferFormatID(angle::FormatID::NONE),
vkBufferFormat(VK_FORMAT_UNDEFINED), actualBufferVkFormat(VK_FORMAT_UNDEFINED),
actualCompressedBufferFormatID(angle::FormatID::NONE), actualCompressedBufferFormatID(angle::FormatID::NONE),
vkCompressedBufferFormat(VK_FORMAT_UNDEFINED), actualCompressedBufferVkFormat(VK_FORMAT_UNDEFINED),
imageInitializerFunction(nullptr), imageInitializerFunction(nullptr),
textureLoadFunctions(), textureLoadFunctions(),
vertexLoadFunction(nullptr), vertexLoadFunction(nullptr),
...@@ -152,7 +152,7 @@ void Format::initImageFallback(RendererVk *renderer, const ImageFormatInitInfo * ...@@ -152,7 +152,7 @@ void Format::initImageFallback(RendererVk *renderer, const ImageFormatInitInfo *
int i = FindSupportedFormat(renderer, info, skip, static_cast<uint32_t>(numInfo), testFunction); int i = FindSupportedFormat(renderer, info, skip, static_cast<uint32_t>(numInfo), testFunction);
actualImageFormatID = info[i].format; actualImageFormatID = info[i].format;
vkImageFormat = info[i].vkFormat; actualImageVkFormat = info[i].vkFormat;
imageInitializerFunction = info[i].initializer; imageInitializerFunction = info[i].initializer;
} }
...@@ -167,7 +167,7 @@ void Format::initBufferFallback(RendererVk *renderer, ...@@ -167,7 +167,7 @@ void Format::initBufferFallback(RendererVk *renderer,
HasFullBufferFormatSupport); HasFullBufferFormatSupport);
actualBufferFormatID = info[i].format; actualBufferFormatID = info[i].format;
vkBufferFormat = info[i].vkFormat; actualBufferVkFormat = info[i].vkFormat;
vkBufferFormatIsPacked = info[i].vkFormatIsPacked; vkBufferFormatIsPacked = info[i].vkFormatIsPacked;
vertexLoadFunction = info[i].vertexLoadFunction; vertexLoadFunction = info[i].vertexLoadFunction;
vertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion; vertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion;
...@@ -179,7 +179,7 @@ void Format::initBufferFallback(RendererVk *renderer, ...@@ -179,7 +179,7 @@ void Format::initBufferFallback(RendererVk *renderer,
HasFullBufferFormatSupport); HasFullBufferFormatSupport);
actualCompressedBufferFormatID = info[i].format; actualCompressedBufferFormatID = info[i].format;
vkCompressedBufferFormat = info[i].vkFormat; actualCompressedBufferVkFormat = info[i].vkFormat;
vkCompressedBufferFormatIsPacked = info[i].vkFormatIsPacked; vkCompressedBufferFormatIsPacked = info[i].vkFormatIsPacked;
compressedVertexLoadFunction = info[i].vertexLoadFunction; compressedVertexLoadFunction = info[i].vertexLoadFunction;
compressedVertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion; compressedVertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion;
...@@ -262,8 +262,7 @@ void FormatTable::initialize(RendererVk *renderer, ...@@ -262,8 +262,7 @@ void FormatTable::initialize(RendererVk *renderer,
const angle::Format &angleFormat = angle::Format::Get(formatID); const angle::Format &angleFormat = angle::Format::Get(formatID);
format.initialize(renderer, angleFormat); format.initialize(renderer, angleFormat);
const GLenum internalFormat = format.internalFormat; format.intendedFormatID = formatID;
format.intendedFormatID = formatID;
if (!format.valid()) if (!format.valid())
{ {
...@@ -271,18 +270,18 @@ void FormatTable::initialize(RendererVk *renderer, ...@@ -271,18 +270,18 @@ void FormatTable::initialize(RendererVk *renderer,
} }
gl::TextureCaps textureCaps; gl::TextureCaps textureCaps;
FillTextureFormatCaps(renderer, format.vkImageFormat, &textureCaps); FillTextureFormatCaps(renderer, format.actualImageVkFormat, &textureCaps);
outTextureCapsMap->set(formatID, textureCaps); outTextureCapsMap->set(formatID, textureCaps);
if (textureCaps.texturable) if (textureCaps.texturable)
{ {
format.textureLoadFunctions = format.textureLoadFunctions =
GetLoadFunctionsMap(internalFormat, format.actualImageFormatID); GetLoadFunctionsMap(format.intendedGLFormat, format.actualImageFormatID);
} }
if (angleFormat.isBlock) if (angleFormat.isBlock)
{ {
outCompressedTextureFormats->push_back(internalFormat); outCompressedTextureFormats->push_back(format.intendedGLFormat);
} }
} }
} }
......
...@@ -56,7 +56,7 @@ struct Format final : private angle::NonCopyable ...@@ -56,7 +56,7 @@ struct Format final : private angle::NonCopyable
{ {
Format(); Format();
bool valid() const { return internalFormat != 0; } bool valid() const { return intendedGLFormat != 0; }
// The intended format is the front-end format. For Textures this usually correponds to a // The intended format is the front-end format. For Textures this usually correponds to a
// GLenum in the headers. Buffer formats don't always have a corresponding GLenum type. // GLenum in the headers. Buffer formats don't always have a corresponding GLenum type.
...@@ -89,11 +89,11 @@ struct Format final : private angle::NonCopyable ...@@ -89,11 +89,11 @@ struct Format final : private angle::NonCopyable
return compressed ? compressedVertexLoadRequiresConversion : vertexLoadRequiresConversion; return compressed ? compressedVertexLoadRequiresConversion : vertexLoadRequiresConversion;
} }
// The |internalFormat| always correponds to a valid GLenum type. For types that don't have a // |intendedGLFormat| always correponds to a valid GLenum type. For types that don't have a
// corresponding GLenum we do our best to specify a GLenum that is "close". // corresponding GLenum we do our best to specify a GLenum that is "close".
const gl::InternalFormat &getInternalFormatInfo(GLenum type) const const gl::InternalFormat &getInternalFormatInfo(GLenum type) const
{ {
return gl::GetInternalFormatInfo(internalFormat, type); return gl::GetInternalFormatInfo(intendedGLFormat, type);
} }
// Returns buffer alignment for image-copy operations (to or from a buffer). // Returns buffer alignment for image-copy operations (to or from a buffer).
...@@ -117,13 +117,13 @@ struct Format final : private angle::NonCopyable ...@@ -117,13 +117,13 @@ struct Format final : private angle::NonCopyable
int compressedStartIndex); int compressedStartIndex);
angle::FormatID intendedFormatID; angle::FormatID intendedFormatID;
GLenum internalFormat; GLenum intendedGLFormat;
angle::FormatID actualImageFormatID; angle::FormatID actualImageFormatID;
VkFormat vkImageFormat; VkFormat actualImageVkFormat;
angle::FormatID actualBufferFormatID; angle::FormatID actualBufferFormatID;
VkFormat vkBufferFormat; VkFormat actualBufferVkFormat;
angle::FormatID actualCompressedBufferFormatID; angle::FormatID actualCompressedBufferFormatID;
VkFormat vkCompressedBufferFormat; VkFormat actualCompressedBufferVkFormat;
InitializeTextureDataFunction imageInitializerFunction; InitializeTextureDataFunction imageInitializerFunction;
LoadFunctionMap textureLoadFunctions; LoadFunctionMap textureLoadFunctions;
......
...@@ -711,9 +711,10 @@ bool CanCopyWithTransfer(RendererVk *renderer, ...@@ -711,9 +711,10 @@ bool CanCopyWithTransfer(RendererVk *renderer,
// Checks that the formats in the copy transfer have the appropriate tiling and transfer bits // Checks that the formats in the copy transfer have the appropriate tiling and transfer bits
bool isTilingCompatible = srcTilingMode == destTilingMode; bool isTilingCompatible = srcTilingMode == destTilingMode;
bool srcFormatHasNecessaryFeature = FormatHasNecessaryFeature( bool srcFormatHasNecessaryFeature = FormatHasNecessaryFeature(
renderer, srcFormat.vkImageFormat, srcTilingMode, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT); renderer, srcFormat.actualImageVkFormat, srcTilingMode, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT);
bool dstFormatHasNecessaryFeature = FormatHasNecessaryFeature( bool dstFormatHasNecessaryFeature =
renderer, destFormat.vkImageFormat, destTilingMode, VK_FORMAT_FEATURE_TRANSFER_DST_BIT); FormatHasNecessaryFeature(renderer, destFormat.actualImageVkFormat, destTilingMode,
VK_FORMAT_FEATURE_TRANSFER_DST_BIT);
return isTilingCompatible && srcFormatHasNecessaryFeature && dstFormatHasNecessaryFeature; return isTilingCompatible && srcFormatHasNecessaryFeature && dstFormatHasNecessaryFeature;
} }
...@@ -3619,7 +3620,7 @@ angle::Result ImageHelper::initExternal(Context *context, ...@@ -3619,7 +3620,7 @@ angle::Result ImageHelper::initExternal(Context *context,
imageInfo.pNext = externalImageCreateInfo; imageInfo.pNext = externalImageCreateInfo;
imageInfo.flags = GetImageCreateFlags(textureType) | additionalCreateFlags; imageInfo.flags = GetImageCreateFlags(textureType) | additionalCreateFlags;
imageInfo.imageType = mImageType; imageInfo.imageType = mImageType;
imageInfo.format = format.vkImageFormat; imageInfo.format = format.actualImageVkFormat;
imageInfo.extent = mExtents; imageInfo.extent = mExtents;
imageInfo.mipLevels = mipLevels; imageInfo.mipLevels = mipLevels;
imageInfo.arrayLayers = mLayerCount; imageInfo.arrayLayers = mLayerCount;
...@@ -3871,7 +3872,7 @@ angle::Result ImageHelper::initLayerImageView(Context *context, ...@@ -3871,7 +3872,7 @@ angle::Result ImageHelper::initLayerImageView(Context *context,
{ {
return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut, return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut,
baseMipLevelVk, levelCount, baseArrayLayer, layerCount, baseMipLevelVk, levelCount, baseArrayLayer, layerCount,
mFormat->vkImageFormat, nullptr); mFormat->actualImageVkFormat, nullptr);
} }
angle::Result ImageHelper::initLayerImageViewWithFormat(Context *context, angle::Result ImageHelper::initLayerImageViewWithFormat(Context *context,
...@@ -3887,7 +3888,7 @@ angle::Result ImageHelper::initLayerImageViewWithFormat(Context *context, ...@@ -3887,7 +3888,7 @@ angle::Result ImageHelper::initLayerImageViewWithFormat(Context *context,
{ {
return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut, return initLayerImageViewImpl(context, textureType, aspectMask, swizzleMap, imageViewOut,
baseMipLevelVk, levelCount, baseArrayLayer, layerCount, baseMipLevelVk, levelCount, baseArrayLayer, layerCount,
format.vkImageFormat, nullptr); format.actualImageVkFormat, nullptr);
} }
angle::Result ImageHelper::initLayerImageViewImpl( angle::Result ImageHelper::initLayerImageViewImpl(
...@@ -4038,7 +4039,7 @@ angle::Result ImageHelper::init2DStaging(Context *context, ...@@ -4038,7 +4039,7 @@ angle::Result ImageHelper::init2DStaging(Context *context,
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
imageInfo.flags = 0; imageInfo.flags = 0;
imageInfo.imageType = mImageType; imageInfo.imageType = mImageType;
imageInfo.format = format.vkImageFormat; imageInfo.format = format.actualImageVkFormat;
imageInfo.extent = mExtents; imageInfo.extent = mExtents;
imageInfo.mipLevels = 1; imageInfo.mipLevels = 1;
imageInfo.arrayLayers = mLayerCount; imageInfo.arrayLayers = mLayerCount;
...@@ -5944,7 +5945,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk, ...@@ -5944,7 +5945,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk,
// per pixel which is sufficient to contain its depth aspect (no stencil aspect). // per pixel which is sufficient to contain its depth aspect (no stencil aspect).
uint32_t pixelBytes = imageFormat.pixelBytes; uint32_t pixelBytes = imageFormat.pixelBytes;
uint32_t depthBytesPerPixel = imageFormat.depthBits >> 3; uint32_t depthBytesPerPixel = imageFormat.depthBits >> 3;
if (mFormat->vkImageFormat == VK_FORMAT_D24_UNORM_S8_UINT) if (mFormat->actualImageVkFormat == VK_FORMAT_D24_UNORM_S8_UINT)
{ {
pixelBytes = 5; pixelBytes = 5;
depthBytesPerPixel = 4; depthBytesPerPixel = 4;
...@@ -6701,16 +6702,17 @@ angle::Result ImageViewHelper::initSRGBReadViewsImpl(ContextVk *contextVk, ...@@ -6701,16 +6702,17 @@ angle::Result ImageViewHelper::initSRGBReadViewsImpl(ContextVk *contextVk,
// When we select the linear/srgb counterpart formats, we must first make sure they're // 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 // 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) // there is no counterpart format. (In this case, the relevant extension should not be exposed)
VkFormat srgbOverrideFormat = ConvertToSRGB(image.getFormat().vkImageFormat); VkFormat srgbOverrideFormat = ConvertToSRGB(image.getFormat().actualImageVkFormat);
ASSERT((srgbOverrideFormat == VK_FORMAT_UNDEFINED) || ASSERT((srgbOverrideFormat == VK_FORMAT_UNDEFINED) ||
(HasNonRenderableTextureFormatSupport(contextVk->getRenderer(), srgbOverrideFormat))); (HasNonRenderableTextureFormatSupport(contextVk->getRenderer(), srgbOverrideFormat)));
VkFormat linearOverrideFormat = ConvertToLinear(image.getFormat().vkImageFormat); VkFormat linearOverrideFormat = ConvertToLinear(image.getFormat().actualImageVkFormat);
ASSERT((linearOverrideFormat == VK_FORMAT_UNDEFINED) || ASSERT((linearOverrideFormat == VK_FORMAT_UNDEFINED) ||
(HasNonRenderableTextureFormatSupport(contextVk->getRenderer(), linearOverrideFormat))); (HasNonRenderableTextureFormatSupport(contextVk->getRenderer(), linearOverrideFormat)));
VkFormat linearFormat = VkFormat linearFormat = (linearOverrideFormat != VK_FORMAT_UNDEFINED)
(linearOverrideFormat != VK_FORMAT_UNDEFINED) ? linearOverrideFormat : format.vkImageFormat; ? linearOverrideFormat
: format.actualImageVkFormat;
ASSERT(linearFormat != VK_FORMAT_UNDEFINED); ASSERT(linearFormat != VK_FORMAT_UNDEFINED);
const VkImageAspectFlags aspectFlags = GetFormatAspectFlags(format.intendedFormat()); const VkImageAspectFlags aspectFlags = GetFormatAspectFlags(format.intendedFormat());
...@@ -6993,7 +6995,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk, ...@@ -6993,7 +6995,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk,
{ {
ASSERT(format.valid()); ASSERT(format.valid());
auto iter = mViews.find(format.vkBufferFormat); auto iter = mViews.find(format.actualBufferVkFormat);
if (iter != mViews.end()) if (iter != mViews.end())
{ {
*viewOut = &iter->second; *viewOut = &iter->second;
...@@ -7010,7 +7012,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk, ...@@ -7010,7 +7012,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk,
VkBufferViewCreateInfo viewCreateInfo = {}; VkBufferViewCreateInfo viewCreateInfo = {};
viewCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; viewCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
viewCreateInfo.buffer = buffer.getBuffer().getHandle(); viewCreateInfo.buffer = buffer.getBuffer().getHandle();
viewCreateInfo.format = format.vkBufferFormat; viewCreateInfo.format = format.actualBufferVkFormat;
viewCreateInfo.offset = mOffset; viewCreateInfo.offset = mOffset;
viewCreateInfo.range = size; viewCreateInfo.range = size;
...@@ -7018,7 +7020,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk, ...@@ -7018,7 +7020,7 @@ angle::Result BufferViewHelper::getView(ContextVk *contextVk,
ANGLE_VK_TRY(contextVk, view.init(contextVk->getDevice(), viewCreateInfo)); ANGLE_VK_TRY(contextVk, view.init(contextVk->getDevice(), viewCreateInfo));
// Cache the view // Cache the view
auto insertIter = mViews.insert({format.vkBufferFormat, std::move(view)}); auto insertIter = mViews.insert({format.actualBufferVkFormat, std::move(view)});
*viewOut = &insertIter.first->second; *viewOut = &insertIter.first->second;
ASSERT(insertIter.second); ASSERT(insertIter.second);
......
...@@ -989,7 +989,7 @@ void InitExternalSemaphoreCapabilitiesFunctions(VkInstance instance) ...@@ -989,7 +989,7 @@ void InitExternalSemaphoreCapabilitiesFunctions(VkInstance instance)
GLenum CalculateGenerateMipmapFilter(ContextVk *contextVk, const vk::Format &format) GLenum CalculateGenerateMipmapFilter(ContextVk *contextVk, const vk::Format &format)
{ {
const bool formatSupportsLinearFiltering = contextVk->getRenderer()->hasImageFormatFeatureBits( const bool formatSupportsLinearFiltering = contextVk->getRenderer()->hasImageFormatFeatureBits(
format.vkImageFormat, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); format.actualImageVkFormat, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT);
const bool hintFastest = contextVk->getState().getGenerateMipmapHint() == GL_FASTEST; const bool hintFastest = contextVk->getState().getGenerateMipmapHint() == GL_FASTEST;
return formatSupportsLinearFiltering && !hintFastest ? GL_LINEAR : GL_NEAREST; return formatSupportsLinearFiltering && !hintFastest ? GL_LINEAR : GL_NEAREST;
......
...@@ -152,7 +152,6 @@ egl::ConfigSet DisplayVkWin32::generateConfigs() ...@@ -152,7 +152,6 @@ egl::ConfigSet DisplayVkWin32::generateConfigs()
void DisplayVkWin32::checkConfigSupport(egl::Config *config) void DisplayVkWin32::checkConfigSupport(egl::Config *config)
{ {
const vk::Format &formatVk = this->getRenderer()->getFormat(config->renderTargetFormat); const vk::Format &formatVk = this->getRenderer()->getFormat(config->renderTargetFormat);
VkFormat nativeFormat = formatVk.vkImageFormat;
// If the format list includes just one entry of VK_FORMAT_UNDEFINED, // If the format list includes just one entry of VK_FORMAT_UNDEFINED,
// the surface has no preferred format. Otherwise, at least one // the surface has no preferred format. Otherwise, at least one
...@@ -164,7 +163,7 @@ void DisplayVkWin32::checkConfigSupport(egl::Config *config) ...@@ -164,7 +163,7 @@ void DisplayVkWin32::checkConfigSupport(egl::Config *config)
for (const VkSurfaceFormatKHR &surfaceFormat : mSurfaceFormats) for (const VkSurfaceFormatKHR &surfaceFormat : mSurfaceFormats)
{ {
if (surfaceFormat.format == nativeFormat) if (surfaceFormat.format == formatVk.actualImageVkFormat)
{ {
return; return;
} }
......
...@@ -73,17 +73,17 @@ TEST_P(VulkanFormatTablesTest, TestFormatSupport) ...@@ -73,17 +73,17 @@ TEST_P(VulkanFormatTablesTest, TestFormatSupport)
// Now let's verify that against vulkan. // Now let's verify that against vulkan.
VkFormatProperties formatProperties; VkFormatProperties formatProperties;
vkGetPhysicalDeviceFormatProperties(renderer->getPhysicalDevice(), vkGetPhysicalDeviceFormatProperties(renderer->getPhysicalDevice(),
vkFormat.vkImageFormat, &formatProperties); vkFormat.actualImageVkFormat, &formatProperties);
VkImageFormatProperties imageProperties; VkImageFormatProperties imageProperties;
// isTexturable? // isTexturable?
bool isTexturable = bool isTexturable =
vkGetPhysicalDeviceImageFormatProperties( vkGetPhysicalDeviceImageFormatProperties(
renderer->getPhysicalDevice(), vkFormat.vkImageFormat, params.imageType, renderer->getPhysicalDevice(), vkFormat.actualImageVkFormat, params.imageType,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT, params.createFlags, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT, params.createFlags,
&imageProperties) == VK_SUCCESS; &imageProperties) == VK_SUCCESS;
EXPECT_EQ(isTexturable, textureCaps.texturable) << vkFormat.vkImageFormat; EXPECT_EQ(isTexturable, textureCaps.texturable) << vkFormat.actualImageVkFormat;
// TODO(jmadill): Support ES3 textures. // TODO(jmadill): Support ES3 textures.
...@@ -91,23 +91,23 @@ TEST_P(VulkanFormatTablesTest, TestFormatSupport) ...@@ -91,23 +91,23 @@ TEST_P(VulkanFormatTablesTest, TestFormatSupport)
bool isFilterable = (formatProperties.optimalTilingFeatures & bool isFilterable = (formatProperties.optimalTilingFeatures &
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) == VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) ==
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
EXPECT_EQ(isFilterable, textureCaps.filterable) << vkFormat.vkImageFormat; EXPECT_EQ(isFilterable, textureCaps.filterable) << vkFormat.actualImageVkFormat;
// isRenderable? // isRenderable?
const bool isRenderableColor = const bool isRenderableColor =
(vkGetPhysicalDeviceImageFormatProperties( (vkGetPhysicalDeviceImageFormatProperties(
renderer->getPhysicalDevice(), vkFormat.vkImageFormat, params.imageType, renderer->getPhysicalDevice(), vkFormat.actualImageVkFormat, params.imageType,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
params.createFlags, &imageProperties)) == VK_SUCCESS; params.createFlags, &imageProperties)) == VK_SUCCESS;
const bool isRenderableDepthStencil = const bool isRenderableDepthStencil =
(vkGetPhysicalDeviceImageFormatProperties( (vkGetPhysicalDeviceImageFormatProperties(
renderer->getPhysicalDevice(), vkFormat.vkImageFormat, params.imageType, renderer->getPhysicalDevice(), vkFormat.actualImageVkFormat, params.imageType,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
params.createFlags, &imageProperties)) == VK_SUCCESS; params.createFlags, &imageProperties)) == VK_SUCCESS;
bool isRenderable = isRenderableColor || isRenderableDepthStencil; bool isRenderable = isRenderableColor || isRenderableDepthStencil;
EXPECT_EQ(isRenderable, textureCaps.textureAttachment) << vkFormat.vkImageFormat; EXPECT_EQ(isRenderable, textureCaps.textureAttachment) << vkFormat.actualImageVkFormat;
EXPECT_EQ(isRenderable, textureCaps.renderbuffer) << vkFormat.vkImageFormat; EXPECT_EQ(isRenderable, textureCaps.renderbuffer) << vkFormat.actualImageVkFormat;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment