Read stencil in red component on vulkan, don't use swizzles

This commit is contained in:
baldurk
2018-09-05 14:52:53 +01:00
parent 00c4294258
commit 8a9a07d8a5
2 changed files with 5 additions and 16 deletions
+4 -15
View File
@@ -67,21 +67,6 @@ void VulkanReplay::CreateTexImageView(VkImageAspectFlags aspectFlags, VkImage li
if(iminfo.type == VK_IMAGE_TYPE_3D)
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_3D;
if(aspectFlags == VK_IMAGE_ASPECT_DEPTH_BIT)
{
viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
viewInfo.components.g = VK_COMPONENT_SWIZZLE_ZERO;
viewInfo.components.b = VK_COMPONENT_SWIZZLE_ZERO;
viewInfo.components.a = VK_COMPONENT_SWIZZLE_ZERO;
}
else if(aspectFlags == VK_IMAGE_ASPECT_STENCIL_BIT)
{
viewInfo.components.r = VK_COMPONENT_SWIZZLE_ZERO;
viewInfo.components.g = VK_COMPONENT_SWIZZLE_R;
viewInfo.components.b = VK_COMPONENT_SWIZZLE_ZERO;
viewInfo.components.a = VK_COMPONENT_SWIZZLE_ZERO;
}
VkImageView view;
VkResult vkr = ObjDisp(dev)->CreateImageView(Unwrap(dev), &viewInfo, NULL, &view);
@@ -180,6 +165,10 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, VkRenderPassBeginIn
// rescale the range so that stencil seems to fit to 0-1
cfg.rangeMin *= 255.0f;
cfg.rangeMax *= 255.0f;
// shuffle the channel selection, since stencil comes back in red
cfg.red = true;
cfg.green = false;
}
}
+1 -1
View File
@@ -549,7 +549,7 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_
// only write stencil to .y
if(pass == 1)
{
pixel[1] = ((uint32_t *)pData)[1] / 255.0f;
pixel[1] = ((uint32_t *)pData)[0] / 255.0f;
}
else
{