-
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
Dynamically allocate Vulkan output window swapchain arrays #3524
Conversation
renderdoc/driver/vulkan/vk_replay.h
Outdated
@@ -550,7 +550,7 @@ class VulkanReplay : public IReplayDriver | |||
VkSurfaceKHR surface; | |||
VkSwapchainKHR swap; | |||
uint32_t numImgs; | |||
VkImage colimg[8]; | |||
VkImage colimg[12]; | |||
VkImageMemoryBarrier colBarrier[8]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't changed the size of colBarrier here so you're indexing out of bounds. At this point these should be replaced with rdcarray<VkImage>
and rdcarray<VkImageMemoryBarrier>
and resized properly (there was no reason to before really, it was probably just early bootstrap hardcoded max that never got changed because drivers were usually sane).
3ccce9f
to
5c8cd18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is missing updates to other places that access the colimg
/colBarrier
arrays - they are accessing the size via ARRAY_COUNT
and so will get the wrong count and will crash accessing invalid indices or not iterate enough.
|
||
VkImage *imgs = new VkImage[numImgs]; | ||
vkr = vt->GetSwapchainImagesKHR(Unwrap(device), Unwrap(swap), &numImgs, imgs); | ||
CHECK_VKR(driver, vkr); | ||
|
||
colimg.reserve(numImgs); | ||
colBarrier.reserve(numImgs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reserve
is not the correct call to make here. This isn't immediately broken because it still allocates the memory. The rdcarray
functions are named identically to vector
- you should call resize
.
5c8cd18
to
6baaba1
Compare
95066a7
to
8141d35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good now, I've left one super-minor comment but otherwise I think this is ready.
Vivo X90 devices provide 11 swapchain images. Dynamically allocate output window arrays to handle this.
8141d35
to
6c03fb6
Compare
Vivo X90 devices provide 11 swapchain images, increase the Vulkan OutputWindow properties to handle this