mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-21 05:05:44 +00:00
Read stencil in red component on vulkan, don't use swizzles
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user