-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Occasional invalid free() since 1d443867 when launching capture #1708
Comments
This actually crashes even before trying to capture for me, it crashes as soon as I launch the program. Is that what you're seeing, or does it only crash on capture for you? Ping @bjoeris who worked on those changes you bisected to (thank you for that!). I think this is an issue with the subresource state handling not properly considering an aspect mask of This patch seems to fix the issue, but I don't know if it is the only problem or if the aspect mask should get caught somewhere else, so I'd like Benson to weigh in on whether this is the right fix. It might work for you in the meantime. diff --git a/renderdoc/driver/vulkan/vk_resources.h b/renderdoc/driver/vulkan/vk_resources.h
index d7d94cec8..4f4f498ca 100644
--- a/renderdoc/driver/vulkan/vk_resources.h
+++ b/renderdoc/driver/vulkan/vk_resources.h
@@ -1252,7 +1252,13 @@ struct ImageSubresourceRange
}
void Sanitise(const ImageInfo &info)
{
- if(aspectMask & ~info.Aspects())
+ if(aspectMask == VK_IMAGE_ASPECT_COLOR_BIT &&
+ (info.Aspects() &
+ (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT)))
+ {
+ aspectMask = info.Aspects();
+ }
+ else if(aspectMask & ~info.Aspects())
{
if(aspectMask != VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM)
{ |
This also seems to reproduce on the |
Yes, it crashes as soon as I launch. Apologies for the wrong terminology. 🙂 I'll test your patch tomorrow. |
I can confirm the patch fixes the crash. |
I am also worried that there are likely other places in my image tracking change that likely handle multi-planar images similarly incorrectly. I'll take a look at this manually, but I don't think I have a test application that actually uses multi-planar images--VK_Video_Textures fails on my machine because VK_KHR_sampler_ycbcr_conversion is missing (Vega, latest AMD drivers) |
I did find one other place that needs an update, though it's not from your commit (just your commit relies on this more I think):
If you have an NV GPU available to you it has good support for ycbcr conversion and planar/subsampled formats. That said, VK_Video_Textures could also be refactored to not rely on VK_KHR_sampler_ycbcr_conversion - technically that's only required for the actual 'auto conversion' path, it looks like latest AMD drivers do still support a couple of planar formats at least for manual sampling which is better than nothing:
How would you like to approach this, do you think you'll be able to get a system that can run VK_Video_Textures to test further? |
I was worried that the image state tracking might be implicitly assuming the image aspect was color or depth/stencil, but this actually seems to be generally handled correctly. Also, I think I did spot one other spot that might have issues with multi-planar images: in I don't have easy access to an nvidia card for testing this week. I might be able to next week, if there are still issues here. |
Yeh I wasn't sure what was intended for Good point about I'll commit the patches above for now. If you don't think on the surface that there should be any other issues then we can leave it until other bugs come up. However I think this raises the priority of getting |
Description
After launching the capture the capture stops immediately most of the time and the application exits with:
I've also seen other memory management errors, but they are rarer.
The capture launches successfully roughly 20% of the time for me.
I've bisected the issue to be caused by 1d44386.
There's a single validation error regarding
vkUpdateDescriptorSets()
, which I believe might be erroneous, although I'm not sure. I'll be opening an issue against validation layers for it.Steps to reproduce
Sample
rd #1708.zip
Includes the source code and a compiled executable for Linux. Requires a X server, Vulkan 1.1 and Y'Cb'Cr sampling support from the driver.
Make sure that
test.yuv
is in the working directory of the executable.The sample loads test.yuv, uploads it to a buffer, copies it into an image with the format
VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM
and renders it onto a fullscreen quad using Y'Cb'Cr sampling fromVK_KHR_sampler_ycbcr_conversion
.Environment
Linux 5.4.0-3-amd64 #1 SMP Debian 5.4.13-1 (2020-01-19)
The text was updated successfully, but these errors were encountered: