Skip to content

Commit

Permalink
Vulkan: correctly use getImageAspect everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Aug 6, 2022
1 parent c007eab commit c57f627
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
24 changes: 3 additions & 21 deletions RenderSystems/Vulkan/src/OgreVulkanMappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,28 +412,10 @@ namespace Ogre
// clang-format on
}
//-----------------------------------------------------------------------------------
VkImageAspectFlags VulkanMappings::getImageAspect( PixelFormat pf,
const bool bPreferDepthOverStencil )
VkImageAspectFlags VulkanMappings::getImageAspect(PixelFormat pf, const bool bPreferDepthOverStencil)
{
const uint32 pfFlags = PixelUtil::getFlags( pf );

VkImageAspectFlags retVal = 0;
if( pfFlags & ( PFF_DEPTH /*| PFF_STENCIL*/ ) )
{
if( pfFlags & PFF_DEPTH )
retVal = VK_IMAGE_ASPECT_DEPTH_BIT;
/*if( pfFlags & PFF_STENCIL )
{
if( !bPreferDepthOverStencil || !( pfFlags & PFF_DEPTH ) )
retVal |= VK_IMAGE_ASPECT_STENCIL_BIT;
}*/
}
else
{
retVal = VK_IMAGE_ASPECT_COLOR_BIT;
}

return retVal;
// we dont have a format corresponding to VK_IMAGE_ASPECT_STENCIL_BIT yet
return PixelUtil::isDepth(pf) ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
}
//-----------------------------------------------------------------------------------
VkAccessFlags VulkanMappings::get( const Texture *texture )
Expand Down
4 changes: 2 additions & 2 deletions RenderSystems/Vulkan/src/OgreVulkanTextureGpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace Ogre
region.bufferRowLength = 0;
region.bufferImageHeight = 0;

region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.imageSubresource.aspectMask = VulkanMappings::getImageAspect(mFormat);
region.imageSubresource.mipLevel = mLevel;
region.imageSubresource.baseArrayLayer = mFace;
region.imageSubresource.layerCount = 1;
Expand Down Expand Up @@ -154,7 +154,7 @@ namespace Ogre
region.bufferRowLength = 0;
region.bufferImageHeight = 0;

region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.imageSubresource.aspectMask = VulkanMappings::getImageAspect(mFormat);;
region.imageSubresource.mipLevel = 0;
region.imageSubresource.baseArrayLayer = 0;
region.imageSubresource.layerCount = 1;
Expand Down

0 comments on commit c57f627

Please sign in to comment.