diff options
| author | 2021-07-20 21:52:29 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:40 -0400 | |
| commit | a55ff22900c5261915eb8b88f2c0f18a4eb6f30f (patch) | |
| tree | 9d070945e45f5b2cc65cb785b08e62b052dbe643 /src | |
| parent | vulkan_device: Blacklist Volta and older from VK_KHR_push_descriptor (diff) | |
| download | yuzu-a55ff22900c5261915eb8b88f2c0f18a4eb6f30f.tar.gz yuzu-a55ff22900c5261915eb8b88f2c0f18a4eb6f30f.tar.xz yuzu-a55ff22900c5261915eb8b88f2c0f18a4eb6f30f.zip | |
vulkan/blit_image: Commit descriptor sets within worker thread
Fixes race condition caused. The descriptor pool is not thread safe, so
we have to commit descriptor sets within the same thread.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/blit_image.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index 4058f62cd..6c1b2f063 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp | |||
| @@ -376,11 +376,11 @@ void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, const ImageV | |||
| 376 | const VkImageView src_view = src_image_view.Handle(Shader::TextureType::Color2D); | 376 | const VkImageView src_view = src_image_view.Handle(Shader::TextureType::Color2D); |
| 377 | const VkSampler sampler = is_linear ? *linear_sampler : *nearest_sampler; | 377 | const VkSampler sampler = is_linear ? *linear_sampler : *nearest_sampler; |
| 378 | const VkPipeline pipeline = FindOrEmplacePipeline(key); | 378 | const VkPipeline pipeline = FindOrEmplacePipeline(key); |
| 379 | const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); | ||
| 380 | scheduler.RequestRenderpass(dst_framebuffer); | 379 | scheduler.RequestRenderpass(dst_framebuffer); |
| 381 | scheduler.Record([dst_region, src_region, pipeline, layout, sampler, src_view, descriptor_set, | 380 | scheduler.Record([this, dst_region, src_region, pipeline, layout, sampler, |
| 382 | &device = device](vk::CommandBuffer cmdbuf) { | 381 | src_view](vk::CommandBuffer cmdbuf) { |
| 383 | // TODO: Barriers | 382 | // TODO: Barriers |
| 383 | const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); | ||
| 384 | UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view); | 384 | UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view); |
| 385 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); | 385 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); |
| 386 | cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set, | 386 | cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set, |
| @@ -402,12 +402,11 @@ void BlitImageHelper::BlitDepthStencil(const Framebuffer* dst_framebuffer, | |||
| 402 | const VkPipelineLayout layout = *two_textures_pipeline_layout; | 402 | const VkPipelineLayout layout = *two_textures_pipeline_layout; |
| 403 | const VkSampler sampler = *nearest_sampler; | 403 | const VkSampler sampler = *nearest_sampler; |
| 404 | const VkPipeline pipeline = BlitDepthStencilPipeline(dst_framebuffer->RenderPass()); | 404 | const VkPipeline pipeline = BlitDepthStencilPipeline(dst_framebuffer->RenderPass()); |
| 405 | const VkDescriptorSet descriptor_set = two_textures_descriptor_allocator.Commit(); | ||
| 406 | scheduler.RequestRenderpass(dst_framebuffer); | 405 | scheduler.RequestRenderpass(dst_framebuffer); |
| 407 | scheduler.Record([dst_region, src_region, pipeline, layout, sampler, src_depth_view, | 406 | scheduler.Record([dst_region, src_region, pipeline, layout, sampler, src_depth_view, |
| 408 | src_stencil_view, descriptor_set, | 407 | src_stencil_view, this](vk::CommandBuffer cmdbuf) { |
| 409 | &device = device](vk::CommandBuffer cmdbuf) { | ||
| 410 | // TODO: Barriers | 408 | // TODO: Barriers |
| 409 | const VkDescriptorSet descriptor_set = two_textures_descriptor_allocator.Commit(); | ||
| 411 | UpdateTwoTexturesDescriptorSet(device, descriptor_set, sampler, src_depth_view, | 410 | UpdateTwoTexturesDescriptorSet(device, descriptor_set, sampler, src_depth_view, |
| 412 | src_stencil_view); | 411 | src_stencil_view); |
| 413 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); | 412 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); |
| @@ -448,14 +447,12 @@ void BlitImageHelper::Convert(VkPipeline pipeline, const Framebuffer* dst_frameb | |||
| 448 | const VkPipelineLayout layout = *one_texture_pipeline_layout; | 447 | const VkPipelineLayout layout = *one_texture_pipeline_layout; |
| 449 | const VkImageView src_view = src_image_view.Handle(Shader::TextureType::Color2D); | 448 | const VkImageView src_view = src_image_view.Handle(Shader::TextureType::Color2D); |
| 450 | const VkSampler sampler = *nearest_sampler; | 449 | const VkSampler sampler = *nearest_sampler; |
| 451 | const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); | ||
| 452 | const VkExtent2D extent{ | 450 | const VkExtent2D extent{ |
| 453 | .width = src_image_view.size.width, | 451 | .width = src_image_view.size.width, |
| 454 | .height = src_image_view.size.height, | 452 | .height = src_image_view.size.height, |
| 455 | }; | 453 | }; |
| 456 | scheduler.RequestRenderpass(dst_framebuffer); | 454 | scheduler.RequestRenderpass(dst_framebuffer); |
| 457 | scheduler.Record([pipeline, layout, sampler, src_view, descriptor_set, extent, | 455 | scheduler.Record([pipeline, layout, sampler, src_view, extent, this](vk::CommandBuffer cmdbuf) { |
| 458 | &device = device](vk::CommandBuffer cmdbuf) { | ||
| 459 | const VkOffset2D offset{ | 456 | const VkOffset2D offset{ |
| 460 | .x = 0, | 457 | .x = 0, |
| 461 | .y = 0, | 458 | .y = 0, |
| @@ -476,6 +473,7 @@ void BlitImageHelper::Convert(VkPipeline pipeline, const Framebuffer* dst_frameb | |||
| 476 | .tex_scale = {viewport.width, viewport.height}, | 473 | .tex_scale = {viewport.width, viewport.height}, |
| 477 | .tex_offset = {0.0f, 0.0f}, | 474 | .tex_offset = {0.0f, 0.0f}, |
| 478 | }; | 475 | }; |
| 476 | const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); | ||
| 479 | UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view); | 477 | UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view); |
| 480 | 478 | ||
| 481 | // TODO: Barriers | 479 | // TODO: Barriers |