Commit 2527b4d2 by Chris Forbes

Resolve identity swizzles at VkImageView creation time

Bug: b/119620767 Change-Id: Ia00deb9b225f38b7faf8bf0fb41d02b0f8b36ebc Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29849Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 30278952
...@@ -15,12 +15,25 @@ ...@@ -15,12 +15,25 @@
#include "VkImageView.hpp" #include "VkImageView.hpp"
#include "VkImage.hpp" #include "VkImage.hpp"
namespace
{
VkComponentMapping ResolveIdentityMapping(VkComponentMapping m)
{
return {
(m.r == VK_COMPONENT_SWIZZLE_IDENTITY) ? VK_COMPONENT_SWIZZLE_R : m.r,
(m.g == VK_COMPONENT_SWIZZLE_IDENTITY) ? VK_COMPONENT_SWIZZLE_G : m.g,
(m.b == VK_COMPONENT_SWIZZLE_IDENTITY) ? VK_COMPONENT_SWIZZLE_B : m.b,
(m.a == VK_COMPONENT_SWIZZLE_IDENTITY) ? VK_COMPONENT_SWIZZLE_A : m.a,
};
}
}
namespace vk namespace vk
{ {
ImageView::ImageView(const VkImageViewCreateInfo* pCreateInfo, void* mem) : ImageView::ImageView(const VkImageViewCreateInfo* pCreateInfo, void* mem) :
image(Cast(pCreateInfo->image)), viewType(pCreateInfo->viewType), format(pCreateInfo->format), image(Cast(pCreateInfo->image)), viewType(pCreateInfo->viewType), format(pCreateInfo->format),
components(pCreateInfo->components), subresourceRange(pCreateInfo->subresourceRange) components(ResolveIdentityMapping(pCreateInfo->components)), subresourceRange(pCreateInfo->subresourceRange)
{ {
} }
......
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