Commit bd5543c9 by Jamie Madill Committed by Commit Bot

Vulkan: Add GetColorComponentFlags.

This small helper routine will be used when doing masked clears. Bug: angleproject:2455 Change-Id: Id309b48f2bc5958abb1276d140c9a3599fb7d2b9 Reviewed-on: https://chromium-review.googlesource.com/1024825Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 33e05bab
...@@ -729,14 +729,11 @@ void PipelineDesc::updateBlendFuncs(const gl::BlendState &blendState) ...@@ -729,14 +729,11 @@ void PipelineDesc::updateBlendFuncs(const gl::BlendState &blendState)
void PipelineDesc::updateColorWriteMask(const gl::BlendState &blendState) void PipelineDesc::updateColorWriteMask(const gl::BlendState &blendState)
{ {
for (auto &blendAttachmentState : mColorBlendStateInfo.attachments) uint8_t colorMask = static_cast<uint8_t>(gl_vk::GetColorComponentFlags(blendState));
{
int colorMask = blendState.colorMaskRed ? VK_COLOR_COMPONENT_R_BIT : 0;
colorMask |= blendState.colorMaskGreen ? VK_COLOR_COMPONENT_G_BIT : 0;
colorMask |= blendState.colorMaskBlue ? VK_COLOR_COMPONENT_B_BIT : 0;
colorMask |= blendState.colorMaskAlpha ? VK_COLOR_COMPONENT_A_BIT : 0;
blendAttachmentState.colorWriteMask = static_cast<uint8_t>(colorMask); for (PackedColorBlendAttachmentState &blendAttachmentState : mColorBlendStateInfo.attachments)
{
blendAttachmentState.colorWriteMask = colorMask;
} }
} }
......
...@@ -1363,6 +1363,14 @@ VkImageViewType GetImageViewType(gl::TextureType textureType) ...@@ -1363,6 +1363,14 @@ VkImageViewType GetImageViewType(gl::TextureType textureType)
return VK_IMAGE_VIEW_TYPE_MAX_ENUM; return VK_IMAGE_VIEW_TYPE_MAX_ENUM;
} }
} }
VkColorComponentFlags GetColorComponentFlags(const gl::BlendState &blendState)
{
return (blendState.colorMaskRed ? VK_COLOR_COMPONENT_R_BIT : 0) |
(blendState.colorMaskGreen ? VK_COLOR_COMPONENT_G_BIT : 0) |
(blendState.colorMaskBlue ? VK_COLOR_COMPONENT_B_BIT : 0) |
(blendState.colorMaskAlpha ? VK_COLOR_COMPONENT_A_BIT : 0);
}
} // namespace gl_vk } // namespace gl_vk
} // namespace rx } // namespace rx
......
...@@ -663,6 +663,7 @@ void GetOffset(const gl::Offset &glOffset, VkOffset3D *vkOffset); ...@@ -663,6 +663,7 @@ void GetOffset(const gl::Offset &glOffset, VkOffset3D *vkOffset);
void GetExtent(const gl::Extents &glExtent, VkExtent3D *vkExtent); void GetExtent(const gl::Extents &glExtent, VkExtent3D *vkExtent);
VkImageType GetImageType(gl::TextureType textureType); VkImageType GetImageType(gl::TextureType textureType);
VkImageViewType GetImageViewType(gl::TextureType textureType); VkImageViewType GetImageViewType(gl::TextureType textureType);
VkColorComponentFlags GetColorComponentFlags(const gl::BlendState &blendState);
} // namespace gl_vk } // namespace gl_vk
} // namespace rx } // namespace rx
......
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