diff options
| author | 2022-06-28 16:59:33 -0700 | |
|---|---|---|
| committer | 2022-06-28 16:59:33 -0700 | |
| commit | 01bc0c84f021ad389309aeb23bdb063070aeb2fe (patch) | |
| tree | 720dc203d1eeb85e47c6f9b0d57cd00ec8a69038 /src/video_core | |
| parent | Merge pull request #8504 from comex/mesosphere-current-process (diff) | |
| parent | video_core: Replace VKUpdateDescriptorQueue with UpdateDescriptorQueue (diff) | |
| download | yuzu-01bc0c84f021ad389309aeb23bdb063070aeb2fe.tar.gz yuzu-01bc0c84f021ad389309aeb23bdb063070aeb2fe.tar.xz yuzu-01bc0c84f021ad389309aeb23bdb063070aeb2fe.zip | |
Merge pull request #8512 from german77/nnResult
Replace multiple names with a better name
Diffstat (limited to 'src/video_core')
36 files changed, 238 insertions, 243 deletions
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index 5d35366f7..3f2b139e0 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp | |||
| @@ -349,7 +349,7 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) { | |||
| 349 | } | 349 | } |
| 350 | } // Anonymous namespace | 350 | } // Anonymous namespace |
| 351 | 351 | ||
| 352 | BlitImageHelper::BlitImageHelper(const Device& device_, VKScheduler& scheduler_, | 352 | BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, |
| 353 | StateTracker& state_tracker_, DescriptorPool& descriptor_pool) | 353 | StateTracker& state_tracker_, DescriptorPool& descriptor_pool) |
| 354 | : device{device_}, scheduler{scheduler_}, state_tracker{state_tracker_}, | 354 | : device{device_}, scheduler{scheduler_}, state_tracker{state_tracker_}, |
| 355 | one_texture_set_layout(device.GetLogical().CreateDescriptorSetLayout( | 355 | one_texture_set_layout(device.GetLogical().CreateDescriptorSetLayout( |
diff --git a/src/video_core/renderer_vulkan/blit_image.h b/src/video_core/renderer_vulkan/blit_image.h index 21e9d7d69..5df679fb4 100644 --- a/src/video_core/renderer_vulkan/blit_image.h +++ b/src/video_core/renderer_vulkan/blit_image.h | |||
| @@ -16,7 +16,7 @@ class Device; | |||
| 16 | class Framebuffer; | 16 | class Framebuffer; |
| 17 | class ImageView; | 17 | class ImageView; |
| 18 | class StateTracker; | 18 | class StateTracker; |
| 19 | class VKScheduler; | 19 | class Scheduler; |
| 20 | 20 | ||
| 21 | struct BlitImagePipelineKey { | 21 | struct BlitImagePipelineKey { |
| 22 | constexpr auto operator<=>(const BlitImagePipelineKey&) const noexcept = default; | 22 | constexpr auto operator<=>(const BlitImagePipelineKey&) const noexcept = default; |
| @@ -27,7 +27,7 @@ struct BlitImagePipelineKey { | |||
| 27 | 27 | ||
| 28 | class BlitImageHelper { | 28 | class BlitImageHelper { |
| 29 | public: | 29 | public: |
| 30 | explicit BlitImageHelper(const Device& device, VKScheduler& scheduler, | 30 | explicit BlitImageHelper(const Device& device, Scheduler& scheduler, |
| 31 | StateTracker& state_tracker, DescriptorPool& descriptor_pool); | 31 | StateTracker& state_tracker, DescriptorPool& descriptor_pool); |
| 32 | ~BlitImageHelper(); | 32 | ~BlitImageHelper(); |
| 33 | 33 | ||
| @@ -82,7 +82,7 @@ private: | |||
| 82 | vk::ShaderModule& module); | 82 | vk::ShaderModule& module); |
| 83 | 83 | ||
| 84 | const Device& device; | 84 | const Device& device; |
| 85 | VKScheduler& scheduler; | 85 | Scheduler& scheduler; |
| 86 | StateTracker& state_tracker; | 86 | StateTracker& state_tracker; |
| 87 | 87 | ||
| 88 | vk::DescriptorSetLayout one_texture_set_layout; | 88 | vk::DescriptorSetLayout one_texture_set_layout; |
diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index 9d676612c..b24f3424a 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h | |||
| @@ -168,7 +168,7 @@ private: | |||
| 168 | }; | 168 | }; |
| 169 | 169 | ||
| 170 | inline void PushImageDescriptors(TextureCache& texture_cache, | 170 | inline void PushImageDescriptors(TextureCache& texture_cache, |
| 171 | VKUpdateDescriptorQueue& update_descriptor_queue, | 171 | UpdateDescriptorQueue& update_descriptor_queue, |
| 172 | const Shader::Info& info, RescalingPushConstant& rescaling, | 172 | const Shader::Info& info, RescalingPushConstant& rescaling, |
| 173 | const VkSampler*& samplers, | 173 | const VkSampler*& samplers, |
| 174 | const VideoCommon::ImageViewInOut*& views) { | 174 | const VideoCommon::ImageViewInOut*& views) { |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index 8a8cb347c..e7bfecb20 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h | |||
| @@ -65,14 +65,14 @@ private: | |||
| 65 | vk::DebugUtilsMessenger debug_callback; | 65 | vk::DebugUtilsMessenger debug_callback; |
| 66 | vk::SurfaceKHR surface; | 66 | vk::SurfaceKHR surface; |
| 67 | 67 | ||
| 68 | VKScreenInfo screen_info; | 68 | ScreenInfo screen_info; |
| 69 | 69 | ||
| 70 | Device device; | 70 | Device device; |
| 71 | MemoryAllocator memory_allocator; | 71 | MemoryAllocator memory_allocator; |
| 72 | StateTracker state_tracker; | 72 | StateTracker state_tracker; |
| 73 | VKScheduler scheduler; | 73 | Scheduler scheduler; |
| 74 | VKSwapchain swapchain; | 74 | Swapchain swapchain; |
| 75 | VKBlitScreen blit_screen; | 75 | BlitScreen blit_screen; |
| 76 | RasterizerVulkan rasterizer; | 76 | RasterizerVulkan rasterizer; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 289bfd7b6..1ec8392e1 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -108,7 +108,7 @@ VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { | |||
| 108 | 108 | ||
| 109 | } // Anonymous namespace | 109 | } // Anonymous namespace |
| 110 | 110 | ||
| 111 | struct VKBlitScreen::BufferData { | 111 | struct BlitScreen::BufferData { |
| 112 | struct { | 112 | struct { |
| 113 | std::array<f32, 4 * 4> modelview_matrix; | 113 | std::array<f32, 4 * 4> modelview_matrix; |
| 114 | } uniform; | 114 | } uniform; |
| @@ -118,10 +118,9 @@ struct VKBlitScreen::BufferData { | |||
| 118 | // Unaligned image data goes here | 118 | // Unaligned image data goes here |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
| 121 | VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_, | 121 | BlitScreen::BlitScreen(Core::Memory::Memory& cpu_memory_, Core::Frontend::EmuWindow& render_window_, |
| 122 | Core::Frontend::EmuWindow& render_window_, const Device& device_, | 122 | const Device& device_, MemoryAllocator& memory_allocator_, |
| 123 | MemoryAllocator& memory_allocator_, VKSwapchain& swapchain_, | 123 | Swapchain& swapchain_, Scheduler& scheduler_, const ScreenInfo& screen_info_) |
| 124 | VKScheduler& scheduler_, const VKScreenInfo& screen_info_) | ||
| 125 | : cpu_memory{cpu_memory_}, render_window{render_window_}, device{device_}, | 124 | : cpu_memory{cpu_memory_}, render_window{render_window_}, device{device_}, |
| 126 | memory_allocator{memory_allocator_}, swapchain{swapchain_}, scheduler{scheduler_}, | 125 | memory_allocator{memory_allocator_}, swapchain{swapchain_}, scheduler{scheduler_}, |
| 127 | image_count{swapchain.GetImageCount()}, screen_info{screen_info_} { | 126 | image_count{swapchain.GetImageCount()}, screen_info{screen_info_} { |
| @@ -131,16 +130,16 @@ VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_, | |||
| 131 | CreateDynamicResources(); | 130 | CreateDynamicResources(); |
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | VKBlitScreen::~VKBlitScreen() = default; | 133 | BlitScreen::~BlitScreen() = default; |
| 135 | 134 | ||
| 136 | void VKBlitScreen::Recreate() { | 135 | void BlitScreen::Recreate() { |
| 137 | CreateDynamicResources(); | 136 | CreateDynamicResources(); |
| 138 | } | 137 | } |
| 139 | 138 | ||
| 140 | VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, | 139 | VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, |
| 141 | const VkFramebuffer& host_framebuffer, | 140 | const VkFramebuffer& host_framebuffer, |
| 142 | const Layout::FramebufferLayout layout, VkExtent2D render_area, | 141 | const Layout::FramebufferLayout layout, VkExtent2D render_area, |
| 143 | bool use_accelerated) { | 142 | bool use_accelerated) { |
| 144 | RefreshResources(framebuffer); | 143 | RefreshResources(framebuffer); |
| 145 | 144 | ||
| 146 | // Finish any pending renderpass | 145 | // Finish any pending renderpass |
| @@ -419,20 +418,20 @@ VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, | |||
| 419 | return *semaphores[image_index]; | 418 | return *semaphores[image_index]; |
| 420 | } | 419 | } |
| 421 | 420 | ||
| 422 | VkSemaphore VKBlitScreen::DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer, | 421 | VkSemaphore BlitScreen::DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer, |
| 423 | bool use_accelerated) { | 422 | bool use_accelerated) { |
| 424 | const std::size_t image_index = swapchain.GetImageIndex(); | 423 | const std::size_t image_index = swapchain.GetImageIndex(); |
| 425 | const VkExtent2D render_area = swapchain.GetSize(); | 424 | const VkExtent2D render_area = swapchain.GetSize(); |
| 426 | const Layout::FramebufferLayout layout = render_window.GetFramebufferLayout(); | 425 | const Layout::FramebufferLayout layout = render_window.GetFramebufferLayout(); |
| 427 | return Draw(framebuffer, *framebuffers[image_index], layout, render_area, use_accelerated); | 426 | return Draw(framebuffer, *framebuffers[image_index], layout, render_area, use_accelerated); |
| 428 | } | 427 | } |
| 429 | 428 | ||
| 430 | vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent) { | 429 | vk::Framebuffer BlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent) { |
| 431 | return CreateFramebuffer(image_view, extent, renderpass); | 430 | return CreateFramebuffer(image_view, extent, renderpass); |
| 432 | } | 431 | } |
| 433 | 432 | ||
| 434 | vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent, | 433 | vk::Framebuffer BlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent, |
| 435 | vk::RenderPass& rd) { | 434 | vk::RenderPass& rd) { |
| 436 | return device.GetLogical().CreateFramebuffer(VkFramebufferCreateInfo{ | 435 | return device.GetLogical().CreateFramebuffer(VkFramebufferCreateInfo{ |
| 437 | .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, | 436 | .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, |
| 438 | .pNext = nullptr, | 437 | .pNext = nullptr, |
| @@ -446,7 +445,7 @@ vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, V | |||
| 446 | }); | 445 | }); |
| 447 | } | 446 | } |
| 448 | 447 | ||
| 449 | void VKBlitScreen::CreateStaticResources() { | 448 | void BlitScreen::CreateStaticResources() { |
| 450 | CreateShaders(); | 449 | CreateShaders(); |
| 451 | CreateSemaphores(); | 450 | CreateSemaphores(); |
| 452 | CreateDescriptorPool(); | 451 | CreateDescriptorPool(); |
| @@ -456,7 +455,7 @@ void VKBlitScreen::CreateStaticResources() { | |||
| 456 | CreateSampler(); | 455 | CreateSampler(); |
| 457 | } | 456 | } |
| 458 | 457 | ||
| 459 | void VKBlitScreen::CreateDynamicResources() { | 458 | void BlitScreen::CreateDynamicResources() { |
| 460 | CreateRenderPass(); | 459 | CreateRenderPass(); |
| 461 | CreateFramebuffers(); | 460 | CreateFramebuffers(); |
| 462 | CreateGraphicsPipeline(); | 461 | CreateGraphicsPipeline(); |
| @@ -466,7 +465,7 @@ void VKBlitScreen::CreateDynamicResources() { | |||
| 466 | } | 465 | } |
| 467 | } | 466 | } |
| 468 | 467 | ||
| 469 | void VKBlitScreen::RefreshResources(const Tegra::FramebufferConfig& framebuffer) { | 468 | void BlitScreen::RefreshResources(const Tegra::FramebufferConfig& framebuffer) { |
| 470 | if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) { | 469 | if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) { |
| 471 | if (!fsr) { | 470 | if (!fsr) { |
| 472 | CreateFSR(); | 471 | CreateFSR(); |
| @@ -486,7 +485,7 @@ void VKBlitScreen::RefreshResources(const Tegra::FramebufferConfig& framebuffer) | |||
| 486 | CreateRawImages(framebuffer); | 485 | CreateRawImages(framebuffer); |
| 487 | } | 486 | } |
| 488 | 487 | ||
| 489 | void VKBlitScreen::CreateShaders() { | 488 | void BlitScreen::CreateShaders() { |
| 490 | vertex_shader = BuildShader(device, VULKAN_PRESENT_VERT_SPV); | 489 | vertex_shader = BuildShader(device, VULKAN_PRESENT_VERT_SPV); |
| 491 | fxaa_vertex_shader = BuildShader(device, FXAA_VERT_SPV); | 490 | fxaa_vertex_shader = BuildShader(device, FXAA_VERT_SPV); |
| 492 | fxaa_fragment_shader = BuildShader(device, FXAA_FRAG_SPV); | 491 | fxaa_fragment_shader = BuildShader(device, FXAA_FRAG_SPV); |
| @@ -500,12 +499,12 @@ void VKBlitScreen::CreateShaders() { | |||
| 500 | } | 499 | } |
| 501 | } | 500 | } |
| 502 | 501 | ||
| 503 | void VKBlitScreen::CreateSemaphores() { | 502 | void BlitScreen::CreateSemaphores() { |
| 504 | semaphores.resize(image_count); | 503 | semaphores.resize(image_count); |
| 505 | std::ranges::generate(semaphores, [this] { return device.GetLogical().CreateSemaphore(); }); | 504 | std::ranges::generate(semaphores, [this] { return device.GetLogical().CreateSemaphore(); }); |
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | void VKBlitScreen::CreateDescriptorPool() { | 507 | void BlitScreen::CreateDescriptorPool() { |
| 509 | const std::array<VkDescriptorPoolSize, 2> pool_sizes{{ | 508 | const std::array<VkDescriptorPoolSize, 2> pool_sizes{{ |
| 510 | { | 509 | { |
| 511 | .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, | 510 | .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, |
| @@ -545,11 +544,11 @@ void VKBlitScreen::CreateDescriptorPool() { | |||
| 545 | aa_descriptor_pool = device.GetLogical().CreateDescriptorPool(ci_aa); | 544 | aa_descriptor_pool = device.GetLogical().CreateDescriptorPool(ci_aa); |
| 546 | } | 545 | } |
| 547 | 546 | ||
| 548 | void VKBlitScreen::CreateRenderPass() { | 547 | void BlitScreen::CreateRenderPass() { |
| 549 | renderpass = CreateRenderPassImpl(swapchain.GetImageViewFormat()); | 548 | renderpass = CreateRenderPassImpl(swapchain.GetImageViewFormat()); |
| 550 | } | 549 | } |
| 551 | 550 | ||
| 552 | vk::RenderPass VKBlitScreen::CreateRenderPassImpl(VkFormat format, bool is_present) { | 551 | vk::RenderPass BlitScreen::CreateRenderPassImpl(VkFormat format, bool is_present) { |
| 553 | const VkAttachmentDescription color_attachment{ | 552 | const VkAttachmentDescription color_attachment{ |
| 554 | .flags = 0, | 553 | .flags = 0, |
| 555 | .format = format, | 554 | .format = format, |
| @@ -605,7 +604,7 @@ vk::RenderPass VKBlitScreen::CreateRenderPassImpl(VkFormat format, bool is_prese | |||
| 605 | return device.GetLogical().CreateRenderPass(renderpass_ci); | 604 | return device.GetLogical().CreateRenderPass(renderpass_ci); |
| 606 | } | 605 | } |
| 607 | 606 | ||
| 608 | void VKBlitScreen::CreateDescriptorSetLayout() { | 607 | void BlitScreen::CreateDescriptorSetLayout() { |
| 609 | const std::array<VkDescriptorSetLayoutBinding, 2> layout_bindings{{ | 608 | const std::array<VkDescriptorSetLayoutBinding, 2> layout_bindings{{ |
| 610 | { | 609 | { |
| 611 | .binding = 0, | 610 | .binding = 0, |
| @@ -660,7 +659,7 @@ void VKBlitScreen::CreateDescriptorSetLayout() { | |||
| 660 | aa_descriptor_set_layout = device.GetLogical().CreateDescriptorSetLayout(ci_aa); | 659 | aa_descriptor_set_layout = device.GetLogical().CreateDescriptorSetLayout(ci_aa); |
| 661 | } | 660 | } |
| 662 | 661 | ||
| 663 | void VKBlitScreen::CreateDescriptorSets() { | 662 | void BlitScreen::CreateDescriptorSets() { |
| 664 | const std::vector layouts(image_count, *descriptor_set_layout); | 663 | const std::vector layouts(image_count, *descriptor_set_layout); |
| 665 | const std::vector layouts_aa(image_count, *aa_descriptor_set_layout); | 664 | const std::vector layouts_aa(image_count, *aa_descriptor_set_layout); |
| 666 | 665 | ||
| @@ -684,7 +683,7 @@ void VKBlitScreen::CreateDescriptorSets() { | |||
| 684 | aa_descriptor_sets = aa_descriptor_pool.Allocate(ai_aa); | 683 | aa_descriptor_sets = aa_descriptor_pool.Allocate(ai_aa); |
| 685 | } | 684 | } |
| 686 | 685 | ||
| 687 | void VKBlitScreen::CreatePipelineLayout() { | 686 | void BlitScreen::CreatePipelineLayout() { |
| 688 | const VkPipelineLayoutCreateInfo ci{ | 687 | const VkPipelineLayoutCreateInfo ci{ |
| 689 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, | 688 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, |
| 690 | .pNext = nullptr, | 689 | .pNext = nullptr, |
| @@ -707,7 +706,7 @@ void VKBlitScreen::CreatePipelineLayout() { | |||
| 707 | aa_pipeline_layout = device.GetLogical().CreatePipelineLayout(ci_aa); | 706 | aa_pipeline_layout = device.GetLogical().CreatePipelineLayout(ci_aa); |
| 708 | } | 707 | } |
| 709 | 708 | ||
| 710 | void VKBlitScreen::CreateGraphicsPipeline() { | 709 | void BlitScreen::CreateGraphicsPipeline() { |
| 711 | const std::array<VkPipelineShaderStageCreateInfo, 2> bilinear_shader_stages{{ | 710 | const std::array<VkPipelineShaderStageCreateInfo, 2> bilinear_shader_stages{{ |
| 712 | { | 711 | { |
| 713 | .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, | 712 | .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, |
| @@ -980,7 +979,7 @@ void VKBlitScreen::CreateGraphicsPipeline() { | |||
| 980 | scaleforce_pipeline = device.GetLogical().CreateGraphicsPipeline(scaleforce_pipeline_ci); | 979 | scaleforce_pipeline = device.GetLogical().CreateGraphicsPipeline(scaleforce_pipeline_ci); |
| 981 | } | 980 | } |
| 982 | 981 | ||
| 983 | void VKBlitScreen::CreateSampler() { | 982 | void BlitScreen::CreateSampler() { |
| 984 | const VkSamplerCreateInfo ci{ | 983 | const VkSamplerCreateInfo ci{ |
| 985 | .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, | 984 | .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, |
| 986 | .pNext = nullptr, | 985 | .pNext = nullptr, |
| @@ -1027,7 +1026,7 @@ void VKBlitScreen::CreateSampler() { | |||
| 1027 | nn_sampler = device.GetLogical().CreateSampler(ci_nn); | 1026 | nn_sampler = device.GetLogical().CreateSampler(ci_nn); |
| 1028 | } | 1027 | } |
| 1029 | 1028 | ||
| 1030 | void VKBlitScreen::CreateFramebuffers() { | 1029 | void BlitScreen::CreateFramebuffers() { |
| 1031 | const VkExtent2D size{swapchain.GetSize()}; | 1030 | const VkExtent2D size{swapchain.GetSize()}; |
| 1032 | framebuffers.resize(image_count); | 1031 | framebuffers.resize(image_count); |
| 1033 | 1032 | ||
| @@ -1037,7 +1036,7 @@ void VKBlitScreen::CreateFramebuffers() { | |||
| 1037 | } | 1036 | } |
| 1038 | } | 1037 | } |
| 1039 | 1038 | ||
| 1040 | void VKBlitScreen::ReleaseRawImages() { | 1039 | void BlitScreen::ReleaseRawImages() { |
| 1041 | for (const u64 tick : resource_ticks) { | 1040 | for (const u64 tick : resource_ticks) { |
| 1042 | scheduler.Wait(tick); | 1041 | scheduler.Wait(tick); |
| 1043 | } | 1042 | } |
| @@ -1052,7 +1051,7 @@ void VKBlitScreen::ReleaseRawImages() { | |||
| 1052 | buffer_commit = MemoryCommit{}; | 1051 | buffer_commit = MemoryCommit{}; |
| 1053 | } | 1052 | } |
| 1054 | 1053 | ||
| 1055 | void VKBlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuffer) { | 1054 | void BlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuffer) { |
| 1056 | const VkBufferCreateInfo ci{ | 1055 | const VkBufferCreateInfo ci{ |
| 1057 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, | 1056 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, |
| 1058 | .pNext = nullptr, | 1057 | .pNext = nullptr, |
| @@ -1069,7 +1068,7 @@ void VKBlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuff | |||
| 1069 | buffer_commit = memory_allocator.Commit(buffer, MemoryUsage::Upload); | 1068 | buffer_commit = memory_allocator.Commit(buffer, MemoryUsage::Upload); |
| 1070 | } | 1069 | } |
| 1071 | 1070 | ||
| 1072 | void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) { | 1071 | void BlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) { |
| 1073 | raw_images.resize(image_count); | 1072 | raw_images.resize(image_count); |
| 1074 | raw_image_views.resize(image_count); | 1073 | raw_image_views.resize(image_count); |
| 1075 | raw_buffer_commits.resize(image_count); | 1074 | raw_buffer_commits.resize(image_count); |
| @@ -1294,8 +1293,8 @@ void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) | |||
| 1294 | aa_pipeline = device.GetLogical().CreateGraphicsPipeline(fxaa_pipeline_ci); | 1293 | aa_pipeline = device.GetLogical().CreateGraphicsPipeline(fxaa_pipeline_ci); |
| 1295 | } | 1294 | } |
| 1296 | 1295 | ||
| 1297 | void VKBlitScreen::UpdateAADescriptorSet(std::size_t image_index, VkImageView image_view, | 1296 | void BlitScreen::UpdateAADescriptorSet(std::size_t image_index, VkImageView image_view, |
| 1298 | bool nn) const { | 1297 | bool nn) const { |
| 1299 | const VkDescriptorImageInfo image_info{ | 1298 | const VkDescriptorImageInfo image_info{ |
| 1300 | .sampler = nn ? *nn_sampler : *sampler, | 1299 | .sampler = nn ? *nn_sampler : *sampler, |
| 1301 | .imageView = image_view, | 1300 | .imageView = image_view, |
| @@ -1331,8 +1330,8 @@ void VKBlitScreen::UpdateAADescriptorSet(std::size_t image_index, VkImageView im | |||
| 1331 | device.GetLogical().UpdateDescriptorSets(std::array{sampler_write, sampler_write_2}, {}); | 1330 | device.GetLogical().UpdateDescriptorSets(std::array{sampler_write, sampler_write_2}, {}); |
| 1332 | } | 1331 | } |
| 1333 | 1332 | ||
| 1334 | void VKBlitScreen::UpdateDescriptorSet(std::size_t image_index, VkImageView image_view, | 1333 | void BlitScreen::UpdateDescriptorSet(std::size_t image_index, VkImageView image_view, |
| 1335 | bool nn) const { | 1334 | bool nn) const { |
| 1336 | const VkDescriptorBufferInfo buffer_info{ | 1335 | const VkDescriptorBufferInfo buffer_info{ |
| 1337 | .buffer = *buffer, | 1336 | .buffer = *buffer, |
| 1338 | .offset = offsetof(BufferData, uniform), | 1337 | .offset = offsetof(BufferData, uniform), |
| @@ -1374,13 +1373,13 @@ void VKBlitScreen::UpdateDescriptorSet(std::size_t image_index, VkImageView imag | |||
| 1374 | device.GetLogical().UpdateDescriptorSets(std::array{ubo_write, sampler_write}, {}); | 1373 | device.GetLogical().UpdateDescriptorSets(std::array{ubo_write, sampler_write}, {}); |
| 1375 | } | 1374 | } |
| 1376 | 1375 | ||
| 1377 | void VKBlitScreen::SetUniformData(BufferData& data, const Layout::FramebufferLayout layout) const { | 1376 | void BlitScreen::SetUniformData(BufferData& data, const Layout::FramebufferLayout layout) const { |
| 1378 | data.uniform.modelview_matrix = | 1377 | data.uniform.modelview_matrix = |
| 1379 | MakeOrthographicMatrix(static_cast<f32>(layout.width), static_cast<f32>(layout.height)); | 1378 | MakeOrthographicMatrix(static_cast<f32>(layout.width), static_cast<f32>(layout.height)); |
| 1380 | } | 1379 | } |
| 1381 | 1380 | ||
| 1382 | void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfig& framebuffer, | 1381 | void BlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfig& framebuffer, |
| 1383 | const Layout::FramebufferLayout layout) const { | 1382 | const Layout::FramebufferLayout layout) const { |
| 1384 | const auto& framebuffer_transform_flags = framebuffer.transform_flags; | 1383 | const auto& framebuffer_transform_flags = framebuffer.transform_flags; |
| 1385 | const auto& framebuffer_crop_rect = framebuffer.crop_rect; | 1384 | const auto& framebuffer_crop_rect = framebuffer.crop_rect; |
| 1386 | 1385 | ||
| @@ -1432,7 +1431,7 @@ void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfi | |||
| 1432 | data.vertices[3] = ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v); | 1431 | data.vertices[3] = ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v); |
| 1433 | } | 1432 | } |
| 1434 | 1433 | ||
| 1435 | void VKBlitScreen::CreateFSR() { | 1434 | void BlitScreen::CreateFSR() { |
| 1436 | const auto& layout = render_window.GetFramebufferLayout(); | 1435 | const auto& layout = render_window.GetFramebufferLayout(); |
| 1437 | const VkExtent2D fsr_size{ | 1436 | const VkExtent2D fsr_size{ |
| 1438 | .width = layout.screen.GetWidth(), | 1437 | .width = layout.screen.GetWidth(), |
| @@ -1441,12 +1440,12 @@ void VKBlitScreen::CreateFSR() { | |||
| 1441 | fsr = std::make_unique<FSR>(device, memory_allocator, image_count, fsr_size); | 1440 | fsr = std::make_unique<FSR>(device, memory_allocator, image_count, fsr_size); |
| 1442 | } | 1441 | } |
| 1443 | 1442 | ||
| 1444 | u64 VKBlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer) const { | 1443 | u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer) const { |
| 1445 | return sizeof(BufferData) + GetSizeInBytes(framebuffer) * image_count; | 1444 | return sizeof(BufferData) + GetSizeInBytes(framebuffer) * image_count; |
| 1446 | } | 1445 | } |
| 1447 | 1446 | ||
| 1448 | u64 VKBlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer, | 1447 | u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer, |
| 1449 | std::size_t image_index) const { | 1448 | std::size_t image_index) const { |
| 1450 | constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData)); | 1449 | constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData)); |
| 1451 | return first_image_offset + GetSizeInBytes(framebuffer) * image_index; | 1450 | return first_image_offset + GetSizeInBytes(framebuffer) * image_index; |
| 1452 | } | 1451 | } |
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.h b/src/video_core/renderer_vulkan/vk_blit_screen.h index 1b4260f36..b8c67bef0 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.h +++ b/src/video_core/renderer_vulkan/vk_blit_screen.h | |||
| @@ -35,23 +35,22 @@ struct ScreenInfo; | |||
| 35 | class Device; | 35 | class Device; |
| 36 | class FSR; | 36 | class FSR; |
| 37 | class RasterizerVulkan; | 37 | class RasterizerVulkan; |
| 38 | class VKScheduler; | 38 | class Scheduler; |
| 39 | class VKSwapchain; | 39 | class Swapchain; |
| 40 | 40 | ||
| 41 | struct VKScreenInfo { | 41 | struct ScreenInfo { |
| 42 | VkImageView image_view{}; | 42 | VkImageView image_view{}; |
| 43 | u32 width{}; | 43 | u32 width{}; |
| 44 | u32 height{}; | 44 | u32 height{}; |
| 45 | bool is_srgb{}; | 45 | bool is_srgb{}; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | class VKBlitScreen { | 48 | class BlitScreen { |
| 49 | public: | 49 | public: |
| 50 | explicit VKBlitScreen(Core::Memory::Memory& cpu_memory, | 50 | explicit BlitScreen(Core::Memory::Memory& cpu_memory, Core::Frontend::EmuWindow& render_window, |
| 51 | Core::Frontend::EmuWindow& render_window, const Device& device, | 51 | const Device& device, MemoryAllocator& memory_manager, Swapchain& swapchain, |
| 52 | MemoryAllocator& memory_manager, VKSwapchain& swapchain, | 52 | Scheduler& scheduler, const ScreenInfo& screen_info); |
| 53 | VKScheduler& scheduler, const VKScreenInfo& screen_info); | 53 | ~BlitScreen(); |
| 54 | ~VKBlitScreen(); | ||
| 55 | 54 | ||
| 56 | void Recreate(); | 55 | void Recreate(); |
| 57 | 56 | ||
| @@ -108,10 +107,10 @@ private: | |||
| 108 | Core::Frontend::EmuWindow& render_window; | 107 | Core::Frontend::EmuWindow& render_window; |
| 109 | const Device& device; | 108 | const Device& device; |
| 110 | MemoryAllocator& memory_allocator; | 109 | MemoryAllocator& memory_allocator; |
| 111 | VKSwapchain& swapchain; | 110 | Swapchain& swapchain; |
| 112 | VKScheduler& scheduler; | 111 | Scheduler& scheduler; |
| 113 | const std::size_t image_count; | 112 | const std::size_t image_count; |
| 114 | const VKScreenInfo& screen_info; | 113 | const ScreenInfo& screen_info; |
| 115 | 114 | ||
| 116 | vk::ShaderModule vertex_shader; | 115 | vk::ShaderModule vertex_shader; |
| 117 | vk::ShaderModule fxaa_vertex_shader; | 116 | vk::ShaderModule fxaa_vertex_shader; |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 450905197..558b8db56 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -124,8 +124,8 @@ VkBufferView Buffer::View(u32 offset, u32 size, VideoCore::Surface::PixelFormat | |||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | BufferCacheRuntime::BufferCacheRuntime(const Device& device_, MemoryAllocator& memory_allocator_, | 126 | BufferCacheRuntime::BufferCacheRuntime(const Device& device_, MemoryAllocator& memory_allocator_, |
| 127 | VKScheduler& scheduler_, StagingBufferPool& staging_pool_, | 127 | Scheduler& scheduler_, StagingBufferPool& staging_pool_, |
| 128 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 128 | UpdateDescriptorQueue& update_descriptor_queue_, |
| 129 | DescriptorPool& descriptor_pool) | 129 | DescriptorPool& descriptor_pool) |
| 130 | : device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_}, | 130 | : device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_}, |
| 131 | staging_pool{staging_pool_}, update_descriptor_queue{update_descriptor_queue_}, | 131 | staging_pool{staging_pool_}, update_descriptor_queue{update_descriptor_queue_}, |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 6fa618f18..a15c8b39b 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -16,7 +16,7 @@ namespace Vulkan { | |||
| 16 | 16 | ||
| 17 | class Device; | 17 | class Device; |
| 18 | class DescriptorPool; | 18 | class DescriptorPool; |
| 19 | class VKScheduler; | 19 | class Scheduler; |
| 20 | 20 | ||
| 21 | class BufferCacheRuntime; | 21 | class BufferCacheRuntime; |
| 22 | 22 | ||
| @@ -58,8 +58,8 @@ class BufferCacheRuntime { | |||
| 58 | 58 | ||
| 59 | public: | 59 | public: |
| 60 | explicit BufferCacheRuntime(const Device& device_, MemoryAllocator& memory_manager_, | 60 | explicit BufferCacheRuntime(const Device& device_, MemoryAllocator& memory_manager_, |
| 61 | VKScheduler& scheduler_, StagingBufferPool& staging_pool_, | 61 | Scheduler& scheduler_, StagingBufferPool& staging_pool_, |
| 62 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 62 | UpdateDescriptorQueue& update_descriptor_queue_, |
| 63 | DescriptorPool& descriptor_pool); | 63 | DescriptorPool& descriptor_pool); |
| 64 | 64 | ||
| 65 | void Finish(); | 65 | void Finish(); |
| @@ -124,9 +124,9 @@ private: | |||
| 124 | 124 | ||
| 125 | const Device& device; | 125 | const Device& device; |
| 126 | MemoryAllocator& memory_allocator; | 126 | MemoryAllocator& memory_allocator; |
| 127 | VKScheduler& scheduler; | 127 | Scheduler& scheduler; |
| 128 | StagingBufferPool& staging_pool; | 128 | StagingBufferPool& staging_pool; |
| 129 | VKUpdateDescriptorQueue& update_descriptor_queue; | 129 | UpdateDescriptorQueue& update_descriptor_queue; |
| 130 | 130 | ||
| 131 | vk::Buffer quad_array_lut; | 131 | vk::Buffer quad_array_lut; |
| 132 | MemoryCommit quad_array_lut_commit; | 132 | MemoryCommit quad_array_lut_commit; |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 4cba777e6..f17a5ccd6 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp | |||
| @@ -200,9 +200,9 @@ ComputePass::ComputePass(const Device& device_, DescriptorPool& descriptor_pool, | |||
| 200 | 200 | ||
| 201 | ComputePass::~ComputePass() = default; | 201 | ComputePass::~ComputePass() = default; |
| 202 | 202 | ||
| 203 | Uint8Pass::Uint8Pass(const Device& device_, VKScheduler& scheduler_, | 203 | Uint8Pass::Uint8Pass(const Device& device_, Scheduler& scheduler_, DescriptorPool& descriptor_pool, |
| 204 | DescriptorPool& descriptor_pool, StagingBufferPool& staging_buffer_pool_, | 204 | StagingBufferPool& staging_buffer_pool_, |
| 205 | VKUpdateDescriptorQueue& update_descriptor_queue_) | 205 | UpdateDescriptorQueue& update_descriptor_queue_) |
| 206 | : ComputePass(device_, descriptor_pool, INPUT_OUTPUT_DESCRIPTOR_SET_BINDINGS, | 206 | : ComputePass(device_, descriptor_pool, INPUT_OUTPUT_DESCRIPTOR_SET_BINDINGS, |
| 207 | INPUT_OUTPUT_DESCRIPTOR_UPDATE_TEMPLATE, INPUT_OUTPUT_BANK_INFO, {}, | 207 | INPUT_OUTPUT_DESCRIPTOR_UPDATE_TEMPLATE, INPUT_OUTPUT_BANK_INFO, {}, |
| 208 | VULKAN_UINT8_COMP_SPV), | 208 | VULKAN_UINT8_COMP_SPV), |
| @@ -241,10 +241,10 @@ std::pair<VkBuffer, VkDeviceSize> Uint8Pass::Assemble(u32 num_vertices, VkBuffer | |||
| 241 | return {staging.buffer, staging.offset}; | 241 | return {staging.buffer, staging.offset}; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | QuadIndexedPass::QuadIndexedPass(const Device& device_, VKScheduler& scheduler_, | 244 | QuadIndexedPass::QuadIndexedPass(const Device& device_, Scheduler& scheduler_, |
| 245 | DescriptorPool& descriptor_pool_, | 245 | DescriptorPool& descriptor_pool_, |
| 246 | StagingBufferPool& staging_buffer_pool_, | 246 | StagingBufferPool& staging_buffer_pool_, |
| 247 | VKUpdateDescriptorQueue& update_descriptor_queue_) | 247 | UpdateDescriptorQueue& update_descriptor_queue_) |
| 248 | : ComputePass(device_, descriptor_pool_, INPUT_OUTPUT_DESCRIPTOR_SET_BINDINGS, | 248 | : ComputePass(device_, descriptor_pool_, INPUT_OUTPUT_DESCRIPTOR_SET_BINDINGS, |
| 249 | INPUT_OUTPUT_DESCRIPTOR_UPDATE_TEMPLATE, INPUT_OUTPUT_BANK_INFO, | 249 | INPUT_OUTPUT_DESCRIPTOR_UPDATE_TEMPLATE, INPUT_OUTPUT_BANK_INFO, |
| 250 | COMPUTE_PUSH_CONSTANT_RANGE<sizeof(u32) * 2>, VULKAN_QUAD_INDEXED_COMP_SPV), | 250 | COMPUTE_PUSH_CONSTANT_RANGE<sizeof(u32) * 2>, VULKAN_QUAD_INDEXED_COMP_SPV), |
| @@ -303,10 +303,10 @@ std::pair<VkBuffer, VkDeviceSize> QuadIndexedPass::Assemble( | |||
| 303 | return {staging.buffer, staging.offset}; | 303 | return {staging.buffer, staging.offset}; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | ASTCDecoderPass::ASTCDecoderPass(const Device& device_, VKScheduler& scheduler_, | 306 | ASTCDecoderPass::ASTCDecoderPass(const Device& device_, Scheduler& scheduler_, |
| 307 | DescriptorPool& descriptor_pool_, | 307 | DescriptorPool& descriptor_pool_, |
| 308 | StagingBufferPool& staging_buffer_pool_, | 308 | StagingBufferPool& staging_buffer_pool_, |
| 309 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 309 | UpdateDescriptorQueue& update_descriptor_queue_, |
| 310 | MemoryAllocator& memory_allocator_) | 310 | MemoryAllocator& memory_allocator_) |
| 311 | : ComputePass(device_, descriptor_pool_, ASTC_DESCRIPTOR_SET_BINDINGS, | 311 | : ComputePass(device_, descriptor_pool_, ASTC_DESCRIPTOR_SET_BINDINGS, |
| 312 | ASTC_PASS_DESCRIPTOR_UPDATE_TEMPLATE_ENTRY, ASTC_BANK_INFO, | 312 | ASTC_PASS_DESCRIPTOR_UPDATE_TEMPLATE_ENTRY, ASTC_BANK_INFO, |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.h b/src/video_core/renderer_vulkan/vk_compute_pass.h index 1c6aa0805..dcc691a8e 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.h +++ b/src/video_core/renderer_vulkan/vk_compute_pass.h | |||
| @@ -20,8 +20,8 @@ namespace Vulkan { | |||
| 20 | 20 | ||
| 21 | class Device; | 21 | class Device; |
| 22 | class StagingBufferPool; | 22 | class StagingBufferPool; |
| 23 | class VKScheduler; | 23 | class Scheduler; |
| 24 | class VKUpdateDescriptorQueue; | 24 | class UpdateDescriptorQueue; |
| 25 | class Image; | 25 | class Image; |
| 26 | struct StagingBufferRef; | 26 | struct StagingBufferRef; |
| 27 | 27 | ||
| @@ -48,9 +48,9 @@ private: | |||
| 48 | 48 | ||
| 49 | class Uint8Pass final : public ComputePass { | 49 | class Uint8Pass final : public ComputePass { |
| 50 | public: | 50 | public: |
| 51 | explicit Uint8Pass(const Device& device_, VKScheduler& scheduler_, | 51 | explicit Uint8Pass(const Device& device_, Scheduler& scheduler_, |
| 52 | DescriptorPool& descriptor_pool_, StagingBufferPool& staging_buffer_pool_, | 52 | DescriptorPool& descriptor_pool_, StagingBufferPool& staging_buffer_pool_, |
| 53 | VKUpdateDescriptorQueue& update_descriptor_queue_); | 53 | UpdateDescriptorQueue& update_descriptor_queue_); |
| 54 | ~Uint8Pass(); | 54 | ~Uint8Pass(); |
| 55 | 55 | ||
| 56 | /// Assemble uint8 indices into an uint16 index buffer | 56 | /// Assemble uint8 indices into an uint16 index buffer |
| @@ -59,17 +59,17 @@ public: | |||
| 59 | u32 src_offset); | 59 | u32 src_offset); |
| 60 | 60 | ||
| 61 | private: | 61 | private: |
| 62 | VKScheduler& scheduler; | 62 | Scheduler& scheduler; |
| 63 | StagingBufferPool& staging_buffer_pool; | 63 | StagingBufferPool& staging_buffer_pool; |
| 64 | VKUpdateDescriptorQueue& update_descriptor_queue; | 64 | UpdateDescriptorQueue& update_descriptor_queue; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | class QuadIndexedPass final : public ComputePass { | 67 | class QuadIndexedPass final : public ComputePass { |
| 68 | public: | 68 | public: |
| 69 | explicit QuadIndexedPass(const Device& device_, VKScheduler& scheduler_, | 69 | explicit QuadIndexedPass(const Device& device_, Scheduler& scheduler_, |
| 70 | DescriptorPool& descriptor_pool_, | 70 | DescriptorPool& descriptor_pool_, |
| 71 | StagingBufferPool& staging_buffer_pool_, | 71 | StagingBufferPool& staging_buffer_pool_, |
| 72 | VKUpdateDescriptorQueue& update_descriptor_queue_); | 72 | UpdateDescriptorQueue& update_descriptor_queue_); |
| 73 | ~QuadIndexedPass(); | 73 | ~QuadIndexedPass(); |
| 74 | 74 | ||
| 75 | std::pair<VkBuffer, VkDeviceSize> Assemble( | 75 | std::pair<VkBuffer, VkDeviceSize> Assemble( |
| @@ -77,17 +77,17 @@ public: | |||
| 77 | u32 base_vertex, VkBuffer src_buffer, u32 src_offset); | 77 | u32 base_vertex, VkBuffer src_buffer, u32 src_offset); |
| 78 | 78 | ||
| 79 | private: | 79 | private: |
| 80 | VKScheduler& scheduler; | 80 | Scheduler& scheduler; |
| 81 | StagingBufferPool& staging_buffer_pool; | 81 | StagingBufferPool& staging_buffer_pool; |
| 82 | VKUpdateDescriptorQueue& update_descriptor_queue; | 82 | UpdateDescriptorQueue& update_descriptor_queue; |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | class ASTCDecoderPass final : public ComputePass { | 85 | class ASTCDecoderPass final : public ComputePass { |
| 86 | public: | 86 | public: |
| 87 | explicit ASTCDecoderPass(const Device& device_, VKScheduler& scheduler_, | 87 | explicit ASTCDecoderPass(const Device& device_, Scheduler& scheduler_, |
| 88 | DescriptorPool& descriptor_pool_, | 88 | DescriptorPool& descriptor_pool_, |
| 89 | StagingBufferPool& staging_buffer_pool_, | 89 | StagingBufferPool& staging_buffer_pool_, |
| 90 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 90 | UpdateDescriptorQueue& update_descriptor_queue_, |
| 91 | MemoryAllocator& memory_allocator_); | 91 | MemoryAllocator& memory_allocator_); |
| 92 | ~ASTCDecoderPass(); | 92 | ~ASTCDecoderPass(); |
| 93 | 93 | ||
| @@ -95,9 +95,9 @@ public: | |||
| 95 | std::span<const VideoCommon::SwizzleParameters> swizzles); | 95 | std::span<const VideoCommon::SwizzleParameters> swizzles); |
| 96 | 96 | ||
| 97 | private: | 97 | private: |
| 98 | VKScheduler& scheduler; | 98 | Scheduler& scheduler; |
| 99 | StagingBufferPool& staging_buffer_pool; | 99 | StagingBufferPool& staging_buffer_pool; |
| 100 | VKUpdateDescriptorQueue& update_descriptor_queue; | 100 | UpdateDescriptorQueue& update_descriptor_queue; |
| 101 | MemoryAllocator& memory_allocator; | 101 | MemoryAllocator& memory_allocator; |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 6c497b5d4..6447210e2 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |||
| @@ -25,7 +25,7 @@ using Shader::Backend::SPIRV::RESCALING_LAYOUT_WORDS_OFFSET; | |||
| 25 | using Tegra::Texture::TexturePair; | 25 | using Tegra::Texture::TexturePair; |
| 26 | 26 | ||
| 27 | ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descriptor_pool, | 27 | ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descriptor_pool, |
| 28 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 28 | UpdateDescriptorQueue& update_descriptor_queue_, |
| 29 | Common::ThreadWorker* thread_worker, | 29 | Common::ThreadWorker* thread_worker, |
| 30 | PipelineStatistics* pipeline_statistics, | 30 | PipelineStatistics* pipeline_statistics, |
| 31 | VideoCore::ShaderNotify* shader_notify, const Shader::Info& info_, | 31 | VideoCore::ShaderNotify* shader_notify, const Shader::Info& info_, |
| @@ -91,7 +91,7 @@ ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descript | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, | 93 | void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, |
| 94 | Tegra::MemoryManager& gpu_memory, VKScheduler& scheduler, | 94 | Tegra::MemoryManager& gpu_memory, Scheduler& scheduler, |
| 95 | BufferCache& buffer_cache, TextureCache& texture_cache) { | 95 | BufferCache& buffer_cache, TextureCache& texture_cache) { |
| 96 | update_descriptor_queue.Acquire(); | 96 | update_descriptor_queue.Acquire(); |
| 97 | 97 | ||
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.h b/src/video_core/renderer_vulkan/vk_compute_pipeline.h index d4c0e2015..9879735fe 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.h | |||
| @@ -24,12 +24,12 @@ namespace Vulkan { | |||
| 24 | 24 | ||
| 25 | class Device; | 25 | class Device; |
| 26 | class PipelineStatistics; | 26 | class PipelineStatistics; |
| 27 | class VKScheduler; | 27 | class Scheduler; |
| 28 | 28 | ||
| 29 | class ComputePipeline { | 29 | class ComputePipeline { |
| 30 | public: | 30 | public: |
| 31 | explicit ComputePipeline(const Device& device, DescriptorPool& descriptor_pool, | 31 | explicit ComputePipeline(const Device& device, DescriptorPool& descriptor_pool, |
| 32 | VKUpdateDescriptorQueue& update_descriptor_queue, | 32 | UpdateDescriptorQueue& update_descriptor_queue, |
| 33 | Common::ThreadWorker* thread_worker, | 33 | Common::ThreadWorker* thread_worker, |
| 34 | PipelineStatistics* pipeline_statistics, | 34 | PipelineStatistics* pipeline_statistics, |
| 35 | VideoCore::ShaderNotify* shader_notify, const Shader::Info& info, | 35 | VideoCore::ShaderNotify* shader_notify, const Shader::Info& info, |
| @@ -42,11 +42,11 @@ public: | |||
| 42 | ComputePipeline(const ComputePipeline&) = delete; | 42 | ComputePipeline(const ComputePipeline&) = delete; |
| 43 | 43 | ||
| 44 | void Configure(Tegra::Engines::KeplerCompute& kepler_compute, Tegra::MemoryManager& gpu_memory, | 44 | void Configure(Tegra::Engines::KeplerCompute& kepler_compute, Tegra::MemoryManager& gpu_memory, |
| 45 | VKScheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache); | 45 | Scheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache); |
| 46 | 46 | ||
| 47 | private: | 47 | private: |
| 48 | const Device& device; | 48 | const Device& device; |
| 49 | VKUpdateDescriptorQueue& update_descriptor_queue; | 49 | UpdateDescriptorQueue& update_descriptor_queue; |
| 50 | Shader::Info info; | 50 | Shader::Info info; |
| 51 | 51 | ||
| 52 | VideoCommon::ComputeUniformBufferSizes uniform_buffer_sizes{}; | 52 | VideoCommon::ComputeUniformBufferSizes uniform_buffer_sizes{}; |
diff --git a/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp b/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp index 7073a874b..c7196b64e 100644 --- a/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp | |||
| @@ -121,7 +121,7 @@ vk::DescriptorSets DescriptorAllocator::AllocateDescriptors(size_t count) { | |||
| 121 | throw vk::Exception(VK_ERROR_OUT_OF_POOL_MEMORY); | 121 | throw vk::Exception(VK_ERROR_OUT_OF_POOL_MEMORY); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | DescriptorPool::DescriptorPool(const Device& device_, VKScheduler& scheduler) | 124 | DescriptorPool::DescriptorPool(const Device& device_, Scheduler& scheduler) |
| 125 | : device{device_}, master_semaphore{scheduler.GetMasterSemaphore()} {} | 125 | : device{device_}, master_semaphore{scheduler.GetMasterSemaphore()} {} |
| 126 | 126 | ||
| 127 | DescriptorPool::~DescriptorPool() = default; | 127 | DescriptorPool::~DescriptorPool() = default; |
diff --git a/src/video_core/renderer_vulkan/vk_descriptor_pool.h b/src/video_core/renderer_vulkan/vk_descriptor_pool.h index 30895f259..bd6696b07 100644 --- a/src/video_core/renderer_vulkan/vk_descriptor_pool.h +++ b/src/video_core/renderer_vulkan/vk_descriptor_pool.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | namespace Vulkan { | 14 | namespace Vulkan { |
| 15 | 15 | ||
| 16 | class Device; | 16 | class Device; |
| 17 | class VKScheduler; | 17 | class Scheduler; |
| 18 | 18 | ||
| 19 | struct DescriptorBank; | 19 | struct DescriptorBank; |
| 20 | 20 | ||
| @@ -62,7 +62,7 @@ private: | |||
| 62 | 62 | ||
| 63 | class DescriptorPool { | 63 | class DescriptorPool { |
| 64 | public: | 64 | public: |
| 65 | explicit DescriptorPool(const Device& device, VKScheduler& scheduler); | 65 | explicit DescriptorPool(const Device& device, Scheduler& scheduler); |
| 66 | ~DescriptorPool(); | 66 | ~DescriptorPool(); |
| 67 | 67 | ||
| 68 | DescriptorPool& operator=(const DescriptorPool&) = delete; | 68 | DescriptorPool& operator=(const DescriptorPool&) = delete; |
diff --git a/src/video_core/renderer_vulkan/vk_fence_manager.cpp b/src/video_core/renderer_vulkan/vk_fence_manager.cpp index 96335f22c..c249b34d4 100644 --- a/src/video_core/renderer_vulkan/vk_fence_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_fence_manager.cpp | |||
| @@ -11,10 +11,10 @@ | |||
| 11 | 11 | ||
| 12 | namespace Vulkan { | 12 | namespace Vulkan { |
| 13 | 13 | ||
| 14 | InnerFence::InnerFence(VKScheduler& scheduler_, u32 payload_, bool is_stubbed_) | 14 | InnerFence::InnerFence(Scheduler& scheduler_, u32 payload_, bool is_stubbed_) |
| 15 | : FenceBase{payload_, is_stubbed_}, scheduler{scheduler_} {} | 15 | : FenceBase{payload_, is_stubbed_}, scheduler{scheduler_} {} |
| 16 | 16 | ||
| 17 | InnerFence::InnerFence(VKScheduler& scheduler_, GPUVAddr address_, u32 payload_, bool is_stubbed_) | 17 | InnerFence::InnerFence(Scheduler& scheduler_, GPUVAddr address_, u32 payload_, bool is_stubbed_) |
| 18 | : FenceBase{address_, payload_, is_stubbed_}, scheduler{scheduler_} {} | 18 | : FenceBase{address_, payload_, is_stubbed_}, scheduler{scheduler_} {} |
| 19 | 19 | ||
| 20 | InnerFence::~InnerFence() = default; | 20 | InnerFence::~InnerFence() = default; |
| @@ -42,30 +42,29 @@ void InnerFence::Wait() { | |||
| 42 | scheduler.Wait(wait_tick); | 42 | scheduler.Wait(wait_tick); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | VKFenceManager::VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, | 45 | FenceManager::FenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, |
| 46 | TextureCache& texture_cache_, BufferCache& buffer_cache_, | 46 | TextureCache& texture_cache_, BufferCache& buffer_cache_, |
| 47 | VKQueryCache& query_cache_, const Device& device_, | 47 | QueryCache& query_cache_, const Device& device_, Scheduler& scheduler_) |
| 48 | VKScheduler& scheduler_) | ||
| 49 | : GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_}, | 48 | : GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_}, |
| 50 | scheduler{scheduler_} {} | 49 | scheduler{scheduler_} {} |
| 51 | 50 | ||
| 52 | Fence VKFenceManager::CreateFence(u32 value, bool is_stubbed) { | 51 | Fence FenceManager::CreateFence(u32 value, bool is_stubbed) { |
| 53 | return std::make_shared<InnerFence>(scheduler, value, is_stubbed); | 52 | return std::make_shared<InnerFence>(scheduler, value, is_stubbed); |
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | Fence VKFenceManager::CreateFence(GPUVAddr addr, u32 value, bool is_stubbed) { | 55 | Fence FenceManager::CreateFence(GPUVAddr addr, u32 value, bool is_stubbed) { |
| 57 | return std::make_shared<InnerFence>(scheduler, addr, value, is_stubbed); | 56 | return std::make_shared<InnerFence>(scheduler, addr, value, is_stubbed); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | void VKFenceManager::QueueFence(Fence& fence) { | 59 | void FenceManager::QueueFence(Fence& fence) { |
| 61 | fence->Queue(); | 60 | fence->Queue(); |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | bool VKFenceManager::IsFenceSignaled(Fence& fence) const { | 63 | bool FenceManager::IsFenceSignaled(Fence& fence) const { |
| 65 | return fence->IsSignaled(); | 64 | return fence->IsSignaled(); |
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | void VKFenceManager::WaitFence(Fence& fence) { | 67 | void FenceManager::WaitFence(Fence& fence) { |
| 69 | fence->Wait(); | 68 | fence->Wait(); |
| 70 | } | 69 | } |
| 71 | 70 | ||
diff --git a/src/video_core/renderer_vulkan/vk_fence_manager.h b/src/video_core/renderer_vulkan/vk_fence_manager.h index 04eb575ce..7c0bbd80a 100644 --- a/src/video_core/renderer_vulkan/vk_fence_manager.h +++ b/src/video_core/renderer_vulkan/vk_fence_manager.h | |||
| @@ -20,13 +20,13 @@ class RasterizerInterface; | |||
| 20 | namespace Vulkan { | 20 | namespace Vulkan { |
| 21 | 21 | ||
| 22 | class Device; | 22 | class Device; |
| 23 | class VKQueryCache; | 23 | class QueryCache; |
| 24 | class VKScheduler; | 24 | class Scheduler; |
| 25 | 25 | ||
| 26 | class InnerFence : public VideoCommon::FenceBase { | 26 | class InnerFence : public VideoCommon::FenceBase { |
| 27 | public: | 27 | public: |
| 28 | explicit InnerFence(VKScheduler& scheduler_, u32 payload_, bool is_stubbed_); | 28 | explicit InnerFence(Scheduler& scheduler_, u32 payload_, bool is_stubbed_); |
| 29 | explicit InnerFence(VKScheduler& scheduler_, GPUVAddr address_, u32 payload_, bool is_stubbed_); | 29 | explicit InnerFence(Scheduler& scheduler_, GPUVAddr address_, u32 payload_, bool is_stubbed_); |
| 30 | ~InnerFence(); | 30 | ~InnerFence(); |
| 31 | 31 | ||
| 32 | void Queue(); | 32 | void Queue(); |
| @@ -36,20 +36,18 @@ public: | |||
| 36 | void Wait(); | 36 | void Wait(); |
| 37 | 37 | ||
| 38 | private: | 38 | private: |
| 39 | VKScheduler& scheduler; | 39 | Scheduler& scheduler; |
| 40 | u64 wait_tick = 0; | 40 | u64 wait_tick = 0; |
| 41 | }; | 41 | }; |
| 42 | using Fence = std::shared_ptr<InnerFence>; | 42 | using Fence = std::shared_ptr<InnerFence>; |
| 43 | 43 | ||
| 44 | using GenericFenceManager = | 44 | using GenericFenceManager = VideoCommon::FenceManager<Fence, TextureCache, BufferCache, QueryCache>; |
| 45 | VideoCommon::FenceManager<Fence, TextureCache, BufferCache, VKQueryCache>; | ||
| 46 | 45 | ||
| 47 | class VKFenceManager final : public GenericFenceManager { | 46 | class FenceManager final : public GenericFenceManager { |
| 48 | public: | 47 | public: |
| 49 | explicit VKFenceManager(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu, | 48 | explicit FenceManager(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu, |
| 50 | TextureCache& texture_cache, BufferCache& buffer_cache, | 49 | TextureCache& texture_cache, BufferCache& buffer_cache, |
| 51 | VKQueryCache& query_cache, const Device& device, | 50 | QueryCache& query_cache, const Device& device, Scheduler& scheduler); |
| 52 | VKScheduler& scheduler); | ||
| 53 | 51 | ||
| 54 | protected: | 52 | protected: |
| 55 | Fence CreateFence(u32 value, bool is_stubbed) override; | 53 | Fence CreateFence(u32 value, bool is_stubbed) override; |
| @@ -59,7 +57,7 @@ protected: | |||
| 59 | void WaitFence(Fence& fence) override; | 57 | void WaitFence(Fence& fence) override; |
| 60 | 58 | ||
| 61 | private: | 59 | private: |
| 62 | VKScheduler& scheduler; | 60 | Scheduler& scheduler; |
| 63 | }; | 61 | }; |
| 64 | 62 | ||
| 65 | } // namespace Vulkan | 63 | } // namespace Vulkan |
diff --git a/src/video_core/renderer_vulkan/vk_fsr.cpp b/src/video_core/renderer_vulkan/vk_fsr.cpp index b563bd51d..dd450169e 100644 --- a/src/video_core/renderer_vulkan/vk_fsr.cpp +++ b/src/video_core/renderer_vulkan/vk_fsr.cpp | |||
| @@ -172,7 +172,7 @@ FSR::FSR(const Device& device_, MemoryAllocator& memory_allocator_, size_t image | |||
| 172 | CreatePipeline(); | 172 | CreatePipeline(); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | VkImageView FSR::Draw(VKScheduler& scheduler, size_t image_index, VkImageView image_view, | 175 | VkImageView FSR::Draw(Scheduler& scheduler, size_t image_index, VkImageView image_view, |
| 176 | VkExtent2D input_image_extent, const Common::Rectangle<int>& crop_rect) { | 176 | VkExtent2D input_image_extent, const Common::Rectangle<int>& crop_rect) { |
| 177 | 177 | ||
| 178 | UpdateDescriptorSet(image_index, image_view); | 178 | UpdateDescriptorSet(image_index, image_view); |
diff --git a/src/video_core/renderer_vulkan/vk_fsr.h b/src/video_core/renderer_vulkan/vk_fsr.h index 836592cb3..5d872861f 100644 --- a/src/video_core/renderer_vulkan/vk_fsr.h +++ b/src/video_core/renderer_vulkan/vk_fsr.h | |||
| @@ -10,13 +10,13 @@ | |||
| 10 | namespace Vulkan { | 10 | namespace Vulkan { |
| 11 | 11 | ||
| 12 | class Device; | 12 | class Device; |
| 13 | class VKScheduler; | 13 | class Scheduler; |
| 14 | 14 | ||
| 15 | class FSR { | 15 | class FSR { |
| 16 | public: | 16 | public: |
| 17 | explicit FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, | 17 | explicit FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, |
| 18 | VkExtent2D output_size); | 18 | VkExtent2D output_size); |
| 19 | VkImageView Draw(VKScheduler& scheduler, size_t image_index, VkImageView image_view, | 19 | VkImageView Draw(Scheduler& scheduler, size_t image_index, VkImageView image_view, |
| 20 | VkExtent2D input_image_extent, const Common::Rectangle<int>& crop_rect); | 20 | VkExtent2D input_image_extent, const Common::Rectangle<int>& crop_rect); |
| 21 | 21 | ||
| 22 | private: | 22 | private: |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 0179679c8..682f05335 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -215,10 +215,10 @@ ConfigureFuncPtr ConfigureFunc(const std::array<vk::ShaderModule, NUM_STAGES>& m | |||
| 215 | } // Anonymous namespace | 215 | } // Anonymous namespace |
| 216 | 216 | ||
| 217 | GraphicsPipeline::GraphicsPipeline( | 217 | GraphicsPipeline::GraphicsPipeline( |
| 218 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, | 218 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, Scheduler& scheduler_, |
| 219 | VKScheduler& scheduler_, BufferCache& buffer_cache_, TextureCache& texture_cache_, | 219 | BufferCache& buffer_cache_, TextureCache& texture_cache_, |
| 220 | VideoCore::ShaderNotify* shader_notify, const Device& device_, DescriptorPool& descriptor_pool, | 220 | VideoCore::ShaderNotify* shader_notify, const Device& device_, DescriptorPool& descriptor_pool, |
| 221 | VKUpdateDescriptorQueue& update_descriptor_queue_, Common::ThreadWorker* worker_thread, | 221 | UpdateDescriptorQueue& update_descriptor_queue_, Common::ThreadWorker* worker_thread, |
| 222 | PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache, | 222 | PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache, |
| 223 | const GraphicsPipelineCacheKey& key_, std::array<vk::ShaderModule, NUM_STAGES> stages, | 223 | const GraphicsPipelineCacheKey& key_, std::array<vk::ShaderModule, NUM_STAGES> stages, |
| 224 | const std::array<const Shader::Info*, NUM_STAGES>& infos) | 224 | const std::array<const Shader::Info*, NUM_STAGES>& infos) |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h index b3bcb0a2d..e8949a9ab 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h | |||
| @@ -62,8 +62,8 @@ class Device; | |||
| 62 | class PipelineStatistics; | 62 | class PipelineStatistics; |
| 63 | class RenderPassCache; | 63 | class RenderPassCache; |
| 64 | class RescalingPushConstant; | 64 | class RescalingPushConstant; |
| 65 | class VKScheduler; | 65 | class Scheduler; |
| 66 | class VKUpdateDescriptorQueue; | 66 | class UpdateDescriptorQueue; |
| 67 | 67 | ||
| 68 | class GraphicsPipeline { | 68 | class GraphicsPipeline { |
| 69 | static constexpr size_t NUM_STAGES = Tegra::Engines::Maxwell3D::Regs::MaxShaderStage; | 69 | static constexpr size_t NUM_STAGES = Tegra::Engines::Maxwell3D::Regs::MaxShaderStage; |
| @@ -71,9 +71,9 @@ class GraphicsPipeline { | |||
| 71 | public: | 71 | public: |
| 72 | explicit GraphicsPipeline( | 72 | explicit GraphicsPipeline( |
| 73 | Tegra::Engines::Maxwell3D& maxwell3d, Tegra::MemoryManager& gpu_memory, | 73 | Tegra::Engines::Maxwell3D& maxwell3d, Tegra::MemoryManager& gpu_memory, |
| 74 | VKScheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache, | 74 | Scheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache, |
| 75 | VideoCore::ShaderNotify* shader_notify, const Device& device, | 75 | VideoCore::ShaderNotify* shader_notify, const Device& device, |
| 76 | DescriptorPool& descriptor_pool, VKUpdateDescriptorQueue& update_descriptor_queue, | 76 | DescriptorPool& descriptor_pool, UpdateDescriptorQueue& update_descriptor_queue, |
| 77 | Common::ThreadWorker* worker_thread, PipelineStatistics* pipeline_statistics, | 77 | Common::ThreadWorker* worker_thread, PipelineStatistics* pipeline_statistics, |
| 78 | RenderPassCache& render_pass_cache, const GraphicsPipelineCacheKey& key, | 78 | RenderPassCache& render_pass_cache, const GraphicsPipelineCacheKey& key, |
| 79 | std::array<vk::ShaderModule, NUM_STAGES> stages, | 79 | std::array<vk::ShaderModule, NUM_STAGES> stages, |
| @@ -125,8 +125,8 @@ private: | |||
| 125 | const Device& device; | 125 | const Device& device; |
| 126 | TextureCache& texture_cache; | 126 | TextureCache& texture_cache; |
| 127 | BufferCache& buffer_cache; | 127 | BufferCache& buffer_cache; |
| 128 | VKScheduler& scheduler; | 128 | Scheduler& scheduler; |
| 129 | VKUpdateDescriptorQueue& update_descriptor_queue; | 129 | UpdateDescriptorQueue& update_descriptor_queue; |
| 130 | 130 | ||
| 131 | void (*configure_func)(GraphicsPipeline*, bool){}; | 131 | void (*configure_func)(GraphicsPipeline*, bool){}; |
| 132 | 132 | ||
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 978e827f5..09e035799 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -262,8 +262,8 @@ bool GraphicsPipelineCacheKey::operator==(const GraphicsPipelineCacheKey& rhs) c | |||
| 262 | PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxwell3D& maxwell3d_, | 262 | PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxwell3D& maxwell3d_, |
| 263 | Tegra::Engines::KeplerCompute& kepler_compute_, | 263 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 264 | Tegra::MemoryManager& gpu_memory_, const Device& device_, | 264 | Tegra::MemoryManager& gpu_memory_, const Device& device_, |
| 265 | VKScheduler& scheduler_, DescriptorPool& descriptor_pool_, | 265 | Scheduler& scheduler_, DescriptorPool& descriptor_pool_, |
| 266 | VKUpdateDescriptorQueue& update_descriptor_queue_, | 266 | UpdateDescriptorQueue& update_descriptor_queue_, |
| 267 | RenderPassCache& render_pass_cache_, BufferCache& buffer_cache_, | 267 | RenderPassCache& render_pass_cache_, BufferCache& buffer_cache_, |
| 268 | TextureCache& texture_cache_, VideoCore::ShaderNotify& shader_notify_) | 268 | TextureCache& texture_cache_, VideoCore::ShaderNotify& shader_notify_) |
| 269 | : VideoCommon::ShaderCache{rasterizer_, gpu_memory_, maxwell3d_, kepler_compute_}, | 269 | : VideoCommon::ShaderCache{rasterizer_, gpu_memory_, maxwell3d_, kepler_compute_}, |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index 5d3a9e496..127957dbf 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h | |||
| @@ -81,8 +81,8 @@ class Device; | |||
| 81 | class PipelineStatistics; | 81 | class PipelineStatistics; |
| 82 | class RasterizerVulkan; | 82 | class RasterizerVulkan; |
| 83 | class RenderPassCache; | 83 | class RenderPassCache; |
| 84 | class VKScheduler; | 84 | class Scheduler; |
| 85 | class VKUpdateDescriptorQueue; | 85 | class UpdateDescriptorQueue; |
| 86 | 86 | ||
| 87 | using VideoCommon::ShaderInfo; | 87 | using VideoCommon::ShaderInfo; |
| 88 | 88 | ||
| @@ -103,8 +103,8 @@ public: | |||
| 103 | explicit PipelineCache(RasterizerVulkan& rasterizer, Tegra::Engines::Maxwell3D& maxwell3d, | 103 | explicit PipelineCache(RasterizerVulkan& rasterizer, Tegra::Engines::Maxwell3D& maxwell3d, |
| 104 | Tegra::Engines::KeplerCompute& kepler_compute, | 104 | Tegra::Engines::KeplerCompute& kepler_compute, |
| 105 | Tegra::MemoryManager& gpu_memory, const Device& device, | 105 | Tegra::MemoryManager& gpu_memory, const Device& device, |
| 106 | VKScheduler& scheduler, DescriptorPool& descriptor_pool, | 106 | Scheduler& scheduler, DescriptorPool& descriptor_pool, |
| 107 | VKUpdateDescriptorQueue& update_descriptor_queue, | 107 | UpdateDescriptorQueue& update_descriptor_queue, |
| 108 | RenderPassCache& render_pass_cache, BufferCache& buffer_cache, | 108 | RenderPassCache& render_pass_cache, BufferCache& buffer_cache, |
| 109 | TextureCache& texture_cache, VideoCore::ShaderNotify& shader_notify_); | 109 | TextureCache& texture_cache, VideoCore::ShaderNotify& shader_notify_); |
| 110 | ~PipelineCache(); | 110 | ~PipelineCache(); |
| @@ -138,9 +138,9 @@ private: | |||
| 138 | bool build_in_parallel); | 138 | bool build_in_parallel); |
| 139 | 139 | ||
| 140 | const Device& device; | 140 | const Device& device; |
| 141 | VKScheduler& scheduler; | 141 | Scheduler& scheduler; |
| 142 | DescriptorPool& descriptor_pool; | 142 | DescriptorPool& descriptor_pool; |
| 143 | VKUpdateDescriptorQueue& update_descriptor_queue; | 143 | UpdateDescriptorQueue& update_descriptor_queue; |
| 144 | RenderPassCache& render_pass_cache; | 144 | RenderPassCache& render_pass_cache; |
| 145 | BufferCache& buffer_cache; | 145 | BufferCache& buffer_cache; |
| 146 | TextureCache& texture_cache; | 146 | TextureCache& texture_cache; |
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index ea989d3bc..2b859c6b8 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp | |||
| @@ -26,7 +26,7 @@ constexpr VkQueryType GetTarget(QueryType type) { | |||
| 26 | 26 | ||
| 27 | } // Anonymous namespace | 27 | } // Anonymous namespace |
| 28 | 28 | ||
| 29 | QueryPool::QueryPool(const Device& device_, VKScheduler& scheduler, QueryType type_) | 29 | QueryPool::QueryPool(const Device& device_, Scheduler& scheduler, QueryType type_) |
| 30 | : ResourcePool{scheduler.GetMasterSemaphore(), GROW_STEP}, device{device_}, type{type_} {} | 30 | : ResourcePool{scheduler.GetMasterSemaphore(), GROW_STEP}, device{device_}, type{type_} {} |
| 31 | 31 | ||
| 32 | QueryPool::~QueryPool() = default; | 32 | QueryPool::~QueryPool() = default; |
| @@ -65,15 +65,15 @@ void QueryPool::Reserve(std::pair<VkQueryPool, u32> query) { | |||
| 65 | usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false; | 65 | usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, | 68 | QueryCache::QueryCache(VideoCore::RasterizerInterface& rasterizer_, |
| 69 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, | 69 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, |
| 70 | const Device& device_, VKScheduler& scheduler_) | 70 | const Device& device_, Scheduler& scheduler_) |
| 71 | : QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_}, | 71 | : QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_}, |
| 72 | query_pools{ | 72 | query_pools{ |
| 73 | QueryPool{device_, scheduler_, QueryType::SamplesPassed}, | 73 | QueryPool{device_, scheduler_, QueryType::SamplesPassed}, |
| 74 | } {} | 74 | } {} |
| 75 | 75 | ||
| 76 | VKQueryCache::~VKQueryCache() { | 76 | QueryCache::~QueryCache() { |
| 77 | // TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class | 77 | // TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class |
| 78 | // destructor is called. The query cache should be redesigned to have a proper ownership model | 78 | // destructor is called. The query cache should be redesigned to have a proper ownership model |
| 79 | // instead of using shared pointers. | 79 | // instead of using shared pointers. |
| @@ -84,15 +84,15 @@ VKQueryCache::~VKQueryCache() { | |||
| 84 | } | 84 | } |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | std::pair<VkQueryPool, u32> VKQueryCache::AllocateQuery(QueryType type) { | 87 | std::pair<VkQueryPool, u32> QueryCache::AllocateQuery(QueryType type) { |
| 88 | return query_pools[static_cast<std::size_t>(type)].Commit(); | 88 | return query_pools[static_cast<std::size_t>(type)].Commit(); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | void VKQueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) { | 91 | void QueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) { |
| 92 | query_pools[static_cast<std::size_t>(type)].Reserve(query); | 92 | query_pools[static_cast<std::size_t>(type)].Reserve(query); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_, | 95 | HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
| 96 | QueryType type_) | 96 | QueryType type_) |
| 97 | : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, | 97 | : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, |
| 98 | query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} { | 98 | query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} { |
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.h b/src/video_core/renderer_vulkan/vk_query_cache.h index fc176d907..b0d86c4f8 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.h +++ b/src/video_core/renderer_vulkan/vk_query_cache.h | |||
| @@ -22,14 +22,14 @@ namespace Vulkan { | |||
| 22 | class CachedQuery; | 22 | class CachedQuery; |
| 23 | class Device; | 23 | class Device; |
| 24 | class HostCounter; | 24 | class HostCounter; |
| 25 | class VKQueryCache; | 25 | class QueryCache; |
| 26 | class VKScheduler; | 26 | class Scheduler; |
| 27 | 27 | ||
| 28 | using CounterStream = VideoCommon::CounterStreamBase<VKQueryCache, HostCounter>; | 28 | using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>; |
| 29 | 29 | ||
| 30 | class QueryPool final : public ResourcePool { | 30 | class QueryPool final : public ResourcePool { |
| 31 | public: | 31 | public: |
| 32 | explicit QueryPool(const Device& device, VKScheduler& scheduler, VideoCore::QueryType type); | 32 | explicit QueryPool(const Device& device, Scheduler& scheduler, VideoCore::QueryType type); |
| 33 | ~QueryPool() override; | 33 | ~QueryPool() override; |
| 34 | 34 | ||
| 35 | std::pair<VkQueryPool, u32> Commit(); | 35 | std::pair<VkQueryPool, u32> Commit(); |
| @@ -49,13 +49,13 @@ private: | |||
| 49 | std::vector<bool> usage; | 49 | std::vector<bool> usage; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | class VKQueryCache final | 52 | class QueryCache final |
| 53 | : public VideoCommon::QueryCacheBase<VKQueryCache, CachedQuery, CounterStream, HostCounter> { | 53 | : public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> { |
| 54 | public: | 54 | public: |
| 55 | explicit VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, | 55 | explicit QueryCache(VideoCore::RasterizerInterface& rasterizer_, |
| 56 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, | 56 | Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, |
| 57 | const Device& device_, VKScheduler& scheduler_); | 57 | const Device& device_, Scheduler& scheduler_); |
| 58 | ~VKQueryCache(); | 58 | ~QueryCache(); |
| 59 | 59 | ||
| 60 | std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type); | 60 | std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type); |
| 61 | 61 | ||
| @@ -65,19 +65,19 @@ public: | |||
| 65 | return device; | 65 | return device; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | VKScheduler& GetScheduler() const noexcept { | 68 | Scheduler& GetScheduler() const noexcept { |
| 69 | return scheduler; | 69 | return scheduler; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | private: | 72 | private: |
| 73 | const Device& device; | 73 | const Device& device; |
| 74 | VKScheduler& scheduler; | 74 | Scheduler& scheduler; |
| 75 | std::array<QueryPool, VideoCore::NumQueryTypes> query_pools; | 75 | std::array<QueryPool, VideoCore::NumQueryTypes> query_pools; |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | class HostCounter final : public VideoCommon::HostCounterBase<VKQueryCache, HostCounter> { | 78 | class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> { |
| 79 | public: | 79 | public: |
| 80 | explicit HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_, | 80 | explicit HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_, |
| 81 | VideoCore::QueryType type_); | 81 | VideoCore::QueryType type_); |
| 82 | ~HostCounter(); | 82 | ~HostCounter(); |
| 83 | 83 | ||
| @@ -86,7 +86,7 @@ public: | |||
| 86 | private: | 86 | private: |
| 87 | u64 BlockingQuery() const override; | 87 | u64 BlockingQuery() const override; |
| 88 | 88 | ||
| 89 | VKQueryCache& cache; | 89 | QueryCache& cache; |
| 90 | const VideoCore::QueryType type; | 90 | const VideoCore::QueryType type; |
| 91 | const std::pair<VkQueryPool, u32> query; | 91 | const std::pair<VkQueryPool, u32> query; |
| 92 | const u64 tick; | 92 | const u64 tick; |
| @@ -94,7 +94,7 @@ private: | |||
| 94 | 94 | ||
| 95 | class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> { | 95 | class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> { |
| 96 | public: | 96 | public: |
| 97 | explicit CachedQuery(VKQueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_) | 97 | explicit CachedQuery(QueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_) |
| 98 | : CachedQueryBase{cpu_addr_, host_ptr_} {} | 98 | : CachedQueryBase{cpu_addr_, host_ptr_} {} |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index ce6c853c1..10f9fe7fe 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -142,9 +142,9 @@ DrawParams MakeDrawParams(const Maxwell& regs, u32 num_instances, bool is_instan | |||
| 142 | 142 | ||
| 143 | RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, | 143 | RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 144 | Tegra::MemoryManager& gpu_memory_, | 144 | Tegra::MemoryManager& gpu_memory_, |
| 145 | Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_, | 145 | Core::Memory::Memory& cpu_memory_, ScreenInfo& screen_info_, |
| 146 | const Device& device_, MemoryAllocator& memory_allocator_, | 146 | const Device& device_, MemoryAllocator& memory_allocator_, |
| 147 | StateTracker& state_tracker_, VKScheduler& scheduler_) | 147 | StateTracker& state_tracker_, Scheduler& scheduler_) |
| 148 | : RasterizerAccelerated{cpu_memory_}, gpu{gpu_}, | 148 | : RasterizerAccelerated{cpu_memory_}, gpu{gpu_}, |
| 149 | gpu_memory{gpu_memory_}, maxwell3d{gpu.Maxwell3D()}, kepler_compute{gpu.KeplerCompute()}, | 149 | gpu_memory{gpu_memory_}, maxwell3d{gpu.Maxwell3D()}, kepler_compute{gpu.KeplerCompute()}, |
| 150 | screen_info{screen_info_}, device{device_}, memory_allocator{memory_allocator_}, | 150 | screen_info{screen_info_}, device{device_}, memory_allocator{memory_allocator_}, |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 97eeedd9e..0370ea39b 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -38,7 +38,7 @@ class Maxwell3D; | |||
| 38 | 38 | ||
| 39 | namespace Vulkan { | 39 | namespace Vulkan { |
| 40 | 40 | ||
| 41 | struct VKScreenInfo; | 41 | struct ScreenInfo; |
| 42 | 42 | ||
| 43 | class StateTracker; | 43 | class StateTracker; |
| 44 | 44 | ||
| @@ -58,9 +58,9 @@ class RasterizerVulkan final : public VideoCore::RasterizerAccelerated { | |||
| 58 | public: | 58 | public: |
| 59 | explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, | 59 | explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 60 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, | 60 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, |
| 61 | VKScreenInfo& screen_info_, const Device& device_, | 61 | ScreenInfo& screen_info_, const Device& device_, |
| 62 | MemoryAllocator& memory_allocator_, StateTracker& state_tracker_, | 62 | MemoryAllocator& memory_allocator_, StateTracker& state_tracker_, |
| 63 | VKScheduler& scheduler_); | 63 | Scheduler& scheduler_); |
| 64 | ~RasterizerVulkan() override; | 64 | ~RasterizerVulkan() override; |
| 65 | 65 | ||
| 66 | void Draw(bool is_indexed, bool is_instanced) override; | 66 | void Draw(bool is_indexed, bool is_instanced) override; |
| @@ -138,15 +138,15 @@ private: | |||
| 138 | Tegra::Engines::Maxwell3D& maxwell3d; | 138 | Tegra::Engines::Maxwell3D& maxwell3d; |
| 139 | Tegra::Engines::KeplerCompute& kepler_compute; | 139 | Tegra::Engines::KeplerCompute& kepler_compute; |
| 140 | 140 | ||
| 141 | VKScreenInfo& screen_info; | 141 | ScreenInfo& screen_info; |
| 142 | const Device& device; | 142 | const Device& device; |
| 143 | MemoryAllocator& memory_allocator; | 143 | MemoryAllocator& memory_allocator; |
| 144 | StateTracker& state_tracker; | 144 | StateTracker& state_tracker; |
| 145 | VKScheduler& scheduler; | 145 | Scheduler& scheduler; |
| 146 | 146 | ||
| 147 | StagingBufferPool staging_pool; | 147 | StagingBufferPool staging_pool; |
| 148 | DescriptorPool descriptor_pool; | 148 | DescriptorPool descriptor_pool; |
| 149 | VKUpdateDescriptorQueue update_descriptor_queue; | 149 | UpdateDescriptorQueue update_descriptor_queue; |
| 150 | BlitImageHelper blit_image; | 150 | BlitImageHelper blit_image; |
| 151 | ASTCDecoderPass astc_decoder_pass; | 151 | ASTCDecoderPass astc_decoder_pass; |
| 152 | RenderPassCache render_pass_cache; | 152 | RenderPassCache render_pass_cache; |
| @@ -156,9 +156,9 @@ private: | |||
| 156 | BufferCacheRuntime buffer_cache_runtime; | 156 | BufferCacheRuntime buffer_cache_runtime; |
| 157 | BufferCache buffer_cache; | 157 | BufferCache buffer_cache; |
| 158 | PipelineCache pipeline_cache; | 158 | PipelineCache pipeline_cache; |
| 159 | VKQueryCache query_cache; | 159 | QueryCache query_cache; |
| 160 | AccelerateDMA accelerate_dma; | 160 | AccelerateDMA accelerate_dma; |
| 161 | VKFenceManager fence_manager; | 161 | FenceManager fence_manager; |
| 162 | 162 | ||
| 163 | vk::Event wfi_event; | 163 | vk::Event wfi_event; |
| 164 | 164 | ||
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index a7261cf97..a331ff37e 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp | |||
| @@ -21,7 +21,7 @@ namespace Vulkan { | |||
| 21 | 21 | ||
| 22 | MICROPROFILE_DECLARE(Vulkan_WaitForWorker); | 22 | MICROPROFILE_DECLARE(Vulkan_WaitForWorker); |
| 23 | 23 | ||
| 24 | void VKScheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) { | 24 | void Scheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) { |
| 25 | auto command = first; | 25 | auto command = first; |
| 26 | while (command != nullptr) { | 26 | while (command != nullptr) { |
| 27 | auto next = command->GetNext(); | 27 | auto next = command->GetNext(); |
| @@ -35,7 +35,7 @@ void VKScheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) { | |||
| 35 | last = nullptr; | 35 | last = nullptr; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | VKScheduler::VKScheduler(const Device& device_, StateTracker& state_tracker_) | 38 | Scheduler::Scheduler(const Device& device_, StateTracker& state_tracker_) |
| 39 | : device{device_}, state_tracker{state_tracker_}, | 39 | : device{device_}, state_tracker{state_tracker_}, |
| 40 | master_semaphore{std::make_unique<MasterSemaphore>(device)}, | 40 | master_semaphore{std::make_unique<MasterSemaphore>(device)}, |
| 41 | command_pool{std::make_unique<CommandPool>(*master_semaphore, device)} { | 41 | command_pool{std::make_unique<CommandPool>(*master_semaphore, device)} { |
| @@ -44,14 +44,14 @@ VKScheduler::VKScheduler(const Device& device_, StateTracker& state_tracker_) | |||
| 44 | worker_thread = std::jthread([this](std::stop_token token) { WorkerThread(token); }); | 44 | worker_thread = std::jthread([this](std::stop_token token) { WorkerThread(token); }); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | VKScheduler::~VKScheduler() = default; | 47 | Scheduler::~Scheduler() = default; |
| 48 | 48 | ||
| 49 | void VKScheduler::Flush(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { | 49 | void Scheduler::Flush(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { |
| 50 | SubmitExecution(signal_semaphore, wait_semaphore); | 50 | SubmitExecution(signal_semaphore, wait_semaphore); |
| 51 | AllocateNewContext(); | 51 | AllocateNewContext(); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void VKScheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { | 54 | void Scheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { |
| 55 | const u64 presubmit_tick = CurrentTick(); | 55 | const u64 presubmit_tick = CurrentTick(); |
| 56 | SubmitExecution(signal_semaphore, wait_semaphore); | 56 | SubmitExecution(signal_semaphore, wait_semaphore); |
| 57 | WaitWorker(); | 57 | WaitWorker(); |
| @@ -59,7 +59,7 @@ void VKScheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphor | |||
| 59 | AllocateNewContext(); | 59 | AllocateNewContext(); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | void VKScheduler::WaitWorker() { | 62 | void Scheduler::WaitWorker() { |
| 63 | MICROPROFILE_SCOPE(Vulkan_WaitForWorker); | 63 | MICROPROFILE_SCOPE(Vulkan_WaitForWorker); |
| 64 | DispatchWork(); | 64 | DispatchWork(); |
| 65 | 65 | ||
| @@ -67,7 +67,7 @@ void VKScheduler::WaitWorker() { | |||
| 67 | wait_cv.wait(lock, [this] { return work_queue.empty(); }); | 67 | wait_cv.wait(lock, [this] { return work_queue.empty(); }); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | void VKScheduler::DispatchWork() { | 70 | void Scheduler::DispatchWork() { |
| 71 | if (chunk->Empty()) { | 71 | if (chunk->Empty()) { |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| @@ -79,7 +79,7 @@ void VKScheduler::DispatchWork() { | |||
| 79 | AcquireNewChunk(); | 79 | AcquireNewChunk(); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | void VKScheduler::RequestRenderpass(const Framebuffer* framebuffer) { | 82 | void Scheduler::RequestRenderpass(const Framebuffer* framebuffer) { |
| 83 | const VkRenderPass renderpass = framebuffer->RenderPass(); | 83 | const VkRenderPass renderpass = framebuffer->RenderPass(); |
| 84 | const VkFramebuffer framebuffer_handle = framebuffer->Handle(); | 84 | const VkFramebuffer framebuffer_handle = framebuffer->Handle(); |
| 85 | const VkExtent2D render_area = framebuffer->RenderArea(); | 85 | const VkExtent2D render_area = framebuffer->RenderArea(); |
| @@ -114,11 +114,11 @@ void VKScheduler::RequestRenderpass(const Framebuffer* framebuffer) { | |||
| 114 | renderpass_image_ranges = framebuffer->ImageRanges(); | 114 | renderpass_image_ranges = framebuffer->ImageRanges(); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | void VKScheduler::RequestOutsideRenderPassOperationContext() { | 117 | void Scheduler::RequestOutsideRenderPassOperationContext() { |
| 118 | EndRenderPass(); | 118 | EndRenderPass(); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | bool VKScheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) { | 121 | bool Scheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) { |
| 122 | if (state.graphics_pipeline == pipeline) { | 122 | if (state.graphics_pipeline == pipeline) { |
| 123 | return false; | 123 | return false; |
| 124 | } | 124 | } |
| @@ -126,7 +126,7 @@ bool VKScheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) { | |||
| 126 | return true; | 126 | return true; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | bool VKScheduler::UpdateRescaling(bool is_rescaling) { | 129 | bool Scheduler::UpdateRescaling(bool is_rescaling) { |
| 130 | if (state.rescaling_defined && is_rescaling == state.is_rescaling) { | 130 | if (state.rescaling_defined && is_rescaling == state.is_rescaling) { |
| 131 | return false; | 131 | return false; |
| 132 | } | 132 | } |
| @@ -135,7 +135,7 @@ bool VKScheduler::UpdateRescaling(bool is_rescaling) { | |||
| 135 | return true; | 135 | return true; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | void VKScheduler::WorkerThread(std::stop_token stop_token) { | 138 | void Scheduler::WorkerThread(std::stop_token stop_token) { |
| 139 | Common::SetCurrentThreadName("yuzu:VulkanWorker"); | 139 | Common::SetCurrentThreadName("yuzu:VulkanWorker"); |
| 140 | do { | 140 | do { |
| 141 | std::unique_ptr<CommandChunk> work; | 141 | std::unique_ptr<CommandChunk> work; |
| @@ -161,7 +161,7 @@ void VKScheduler::WorkerThread(std::stop_token stop_token) { | |||
| 161 | } while (!stop_token.stop_requested()); | 161 | } while (!stop_token.stop_requested()); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | void VKScheduler::AllocateWorkerCommandBuffer() { | 164 | void Scheduler::AllocateWorkerCommandBuffer() { |
| 165 | current_cmdbuf = vk::CommandBuffer(command_pool->Commit(), device.GetDispatchLoader()); | 165 | current_cmdbuf = vk::CommandBuffer(command_pool->Commit(), device.GetDispatchLoader()); |
| 166 | current_cmdbuf.Begin({ | 166 | current_cmdbuf.Begin({ |
| 167 | .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, | 167 | .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, |
| @@ -171,7 +171,7 @@ void VKScheduler::AllocateWorkerCommandBuffer() { | |||
| 171 | }); | 171 | }); |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | void VKScheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { | 174 | void Scheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { |
| 175 | EndPendingOperations(); | 175 | EndPendingOperations(); |
| 176 | InvalidateState(); | 176 | InvalidateState(); |
| 177 | 177 | ||
| @@ -225,25 +225,25 @@ void VKScheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait | |||
| 225 | DispatchWork(); | 225 | DispatchWork(); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | void VKScheduler::AllocateNewContext() { | 228 | void Scheduler::AllocateNewContext() { |
| 229 | // Enable counters once again. These are disabled when a command buffer is finished. | 229 | // Enable counters once again. These are disabled when a command buffer is finished. |
| 230 | if (query_cache) { | 230 | if (query_cache) { |
| 231 | query_cache->UpdateCounters(); | 231 | query_cache->UpdateCounters(); |
| 232 | } | 232 | } |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | void VKScheduler::InvalidateState() { | 235 | void Scheduler::InvalidateState() { |
| 236 | state.graphics_pipeline = nullptr; | 236 | state.graphics_pipeline = nullptr; |
| 237 | state.rescaling_defined = false; | 237 | state.rescaling_defined = false; |
| 238 | state_tracker.InvalidateCommandBufferState(); | 238 | state_tracker.InvalidateCommandBufferState(); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | void VKScheduler::EndPendingOperations() { | 241 | void Scheduler::EndPendingOperations() { |
| 242 | query_cache->DisableStreams(); | 242 | query_cache->DisableStreams(); |
| 243 | EndRenderPass(); | 243 | EndRenderPass(); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | void VKScheduler::EndRenderPass() { | 246 | void Scheduler::EndRenderPass() { |
| 247 | if (!state.renderpass) { | 247 | if (!state.renderpass) { |
| 248 | return; | 248 | return; |
| 249 | } | 249 | } |
| @@ -280,7 +280,7 @@ void VKScheduler::EndRenderPass() { | |||
| 280 | num_renderpass_images = 0; | 280 | num_renderpass_images = 0; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | void VKScheduler::AcquireNewChunk() { | 283 | void Scheduler::AcquireNewChunk() { |
| 284 | std::scoped_lock lock{reserve_mutex}; | 284 | std::scoped_lock lock{reserve_mutex}; |
| 285 | if (chunk_reserve.empty()) { | 285 | if (chunk_reserve.empty()) { |
| 286 | chunk = std::make_unique<CommandChunk>(); | 286 | chunk = std::make_unique<CommandChunk>(); |
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index 7a2200474..c04aad08f 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h | |||
| @@ -22,14 +22,14 @@ class Device; | |||
| 22 | class Framebuffer; | 22 | class Framebuffer; |
| 23 | class GraphicsPipeline; | 23 | class GraphicsPipeline; |
| 24 | class StateTracker; | 24 | class StateTracker; |
| 25 | class VKQueryCache; | 25 | class QueryCache; |
| 26 | 26 | ||
| 27 | /// The scheduler abstracts command buffer and fence management with an interface that's able to do | 27 | /// The scheduler abstracts command buffer and fence management with an interface that's able to do |
| 28 | /// OpenGL-like operations on Vulkan command buffers. | 28 | /// OpenGL-like operations on Vulkan command buffers. |
| 29 | class VKScheduler { | 29 | class Scheduler { |
| 30 | public: | 30 | public: |
| 31 | explicit VKScheduler(const Device& device, StateTracker& state_tracker); | 31 | explicit Scheduler(const Device& device, StateTracker& state_tracker); |
| 32 | ~VKScheduler(); | 32 | ~Scheduler(); |
| 33 | 33 | ||
| 34 | /// Sends the current execution context to the GPU. | 34 | /// Sends the current execution context to the GPU. |
| 35 | void Flush(VkSemaphore signal_semaphore = nullptr, VkSemaphore wait_semaphore = nullptr); | 35 | void Flush(VkSemaphore signal_semaphore = nullptr, VkSemaphore wait_semaphore = nullptr); |
| @@ -61,7 +61,7 @@ public: | |||
| 61 | void InvalidateState(); | 61 | void InvalidateState(); |
| 62 | 62 | ||
| 63 | /// Assigns the query cache. | 63 | /// Assigns the query cache. |
| 64 | void SetQueryCache(VKQueryCache& query_cache_) { | 64 | void SetQueryCache(QueryCache& query_cache_) { |
| 65 | query_cache = &query_cache_; | 65 | query_cache = &query_cache_; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| @@ -212,7 +212,7 @@ private: | |||
| 212 | std::unique_ptr<MasterSemaphore> master_semaphore; | 212 | std::unique_ptr<MasterSemaphore> master_semaphore; |
| 213 | std::unique_ptr<CommandPool> command_pool; | 213 | std::unique_ptr<CommandPool> command_pool; |
| 214 | 214 | ||
| 215 | VKQueryCache* query_cache = nullptr; | 215 | QueryCache* query_cache = nullptr; |
| 216 | 216 | ||
| 217 | vk::CommandBuffer current_cmdbuf; | 217 | vk::CommandBuffer current_cmdbuf; |
| 218 | 218 | ||
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp index 9a6afaca6..06f68d09a 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp | |||
| @@ -85,7 +85,7 @@ size_t Region(size_t iterator) noexcept { | |||
| 85 | } // Anonymous namespace | 85 | } // Anonymous namespace |
| 86 | 86 | ||
| 87 | StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& memory_allocator_, | 87 | StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& memory_allocator_, |
| 88 | VKScheduler& scheduler_) | 88 | Scheduler& scheduler_) |
| 89 | : device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_} { | 89 | : device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_} { |
| 90 | const vk::Device& dev = device.GetLogical(); | 90 | const vk::Device& dev = device.GetLogical(); |
| 91 | stream_buffer = dev.CreateBuffer(VkBufferCreateInfo{ | 91 | stream_buffer = dev.CreateBuffer(VkBufferCreateInfo{ |
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h index d4d7efa68..91dc84da8 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | namespace Vulkan { | 14 | namespace Vulkan { |
| 15 | 15 | ||
| 16 | class Device; | 16 | class Device; |
| 17 | class VKScheduler; | 17 | class Scheduler; |
| 18 | 18 | ||
| 19 | struct StagingBufferRef { | 19 | struct StagingBufferRef { |
| 20 | VkBuffer buffer; | 20 | VkBuffer buffer; |
| @@ -27,7 +27,7 @@ public: | |||
| 27 | static constexpr size_t NUM_SYNCS = 16; | 27 | static constexpr size_t NUM_SYNCS = 16; |
| 28 | 28 | ||
| 29 | explicit StagingBufferPool(const Device& device, MemoryAllocator& memory_allocator, | 29 | explicit StagingBufferPool(const Device& device, MemoryAllocator& memory_allocator, |
| 30 | VKScheduler& scheduler); | 30 | Scheduler& scheduler); |
| 31 | ~StagingBufferPool(); | 31 | ~StagingBufferPool(); |
| 32 | 32 | ||
| 33 | StagingBufferRef Request(size_t size, MemoryUsage usage); | 33 | StagingBufferRef Request(size_t size, MemoryUsage usage); |
| @@ -82,7 +82,7 @@ private: | |||
| 82 | 82 | ||
| 83 | const Device& device; | 83 | const Device& device; |
| 84 | MemoryAllocator& memory_allocator; | 84 | MemoryAllocator& memory_allocator; |
| 85 | VKScheduler& scheduler; | 85 | Scheduler& scheduler; |
| 86 | 86 | ||
| 87 | vk::Buffer stream_buffer; | 87 | vk::Buffer stream_buffer; |
| 88 | vk::DeviceMemory stream_memory; | 88 | vk::DeviceMemory stream_memory; |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 7da81551a..a0c26a72a 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -64,15 +64,15 @@ VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 wi | |||
| 64 | 64 | ||
| 65 | } // Anonymous namespace | 65 | } // Anonymous namespace |
| 66 | 66 | ||
| 67 | VKSwapchain::VKSwapchain(VkSurfaceKHR surface_, const Device& device_, VKScheduler& scheduler_, | 67 | Swapchain::Swapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_, u32 width, |
| 68 | u32 width, u32 height, bool srgb) | 68 | u32 height, bool srgb) |
| 69 | : surface{surface_}, device{device_}, scheduler{scheduler_} { | 69 | : surface{surface_}, device{device_}, scheduler{scheduler_} { |
| 70 | Create(width, height, srgb); | 70 | Create(width, height, srgb); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | VKSwapchain::~VKSwapchain() = default; | 73 | Swapchain::~Swapchain() = default; |
| 74 | 74 | ||
| 75 | void VKSwapchain::Create(u32 width, u32 height, bool srgb) { | 75 | void Swapchain::Create(u32 width, u32 height, bool srgb) { |
| 76 | is_outdated = false; | 76 | is_outdated = false; |
| 77 | is_suboptimal = false; | 77 | is_suboptimal = false; |
| 78 | 78 | ||
| @@ -93,7 +93,7 @@ void VKSwapchain::Create(u32 width, u32 height, bool srgb) { | |||
| 93 | resource_ticks.resize(image_count); | 93 | resource_ticks.resize(image_count); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | void VKSwapchain::AcquireNextImage() { | 96 | void Swapchain::AcquireNextImage() { |
| 97 | const VkResult result = device.GetLogical().AcquireNextImageKHR( | 97 | const VkResult result = device.GetLogical().AcquireNextImageKHR( |
| 98 | *swapchain, std::numeric_limits<u64>::max(), *present_semaphores[frame_index], | 98 | *swapchain, std::numeric_limits<u64>::max(), *present_semaphores[frame_index], |
| 99 | VK_NULL_HANDLE, &image_index); | 99 | VK_NULL_HANDLE, &image_index); |
| @@ -114,7 +114,7 @@ void VKSwapchain::AcquireNextImage() { | |||
| 114 | resource_ticks[image_index] = scheduler.CurrentTick(); | 114 | resource_ticks[image_index] = scheduler.CurrentTick(); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | void VKSwapchain::Present(VkSemaphore render_semaphore) { | 117 | void Swapchain::Present(VkSemaphore render_semaphore) { |
| 118 | const auto present_queue{device.GetPresentQueue()}; | 118 | const auto present_queue{device.GetPresentQueue()}; |
| 119 | const VkPresentInfoKHR present_info{ | 119 | const VkPresentInfoKHR present_info{ |
| 120 | .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, | 120 | .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, |
| @@ -145,8 +145,8 @@ void VKSwapchain::Present(VkSemaphore render_semaphore) { | |||
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, | 148 | void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height, |
| 149 | u32 height, bool srgb) { | 149 | bool srgb) { |
| 150 | const auto physical_device{device.GetPhysical()}; | 150 | const auto physical_device{device.GetPhysical()}; |
| 151 | const auto formats{physical_device.GetSurfaceFormatsKHR(surface)}; | 151 | const auto formats{physical_device.GetSurfaceFormatsKHR(surface)}; |
| 152 | const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; | 152 | const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; |
| @@ -212,13 +212,13 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, | |||
| 212 | image_view_format = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM; | 212 | image_view_format = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void VKSwapchain::CreateSemaphores() { | 215 | void Swapchain::CreateSemaphores() { |
| 216 | present_semaphores.resize(image_count); | 216 | present_semaphores.resize(image_count); |
| 217 | std::ranges::generate(present_semaphores, | 217 | std::ranges::generate(present_semaphores, |
| 218 | [this] { return device.GetLogical().CreateSemaphore(); }); | 218 | [this] { return device.GetLogical().CreateSemaphore(); }); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | void VKSwapchain::CreateImageViews() { | 221 | void Swapchain::CreateImageViews() { |
| 222 | VkImageViewCreateInfo ci{ | 222 | VkImageViewCreateInfo ci{ |
| 223 | .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, | 223 | .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, |
| 224 | .pNext = nullptr, | 224 | .pNext = nullptr, |
| @@ -250,7 +250,7 @@ void VKSwapchain::CreateImageViews() { | |||
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | void VKSwapchain::Destroy() { | 253 | void Swapchain::Destroy() { |
| 254 | frame_index = 0; | 254 | frame_index = 0; |
| 255 | present_semaphores.clear(); | 255 | present_semaphores.clear(); |
| 256 | framebuffers.clear(); | 256 | framebuffers.clear(); |
| @@ -258,11 +258,11 @@ void VKSwapchain::Destroy() { | |||
| 258 | swapchain.reset(); | 258 | swapchain.reset(); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | bool VKSwapchain::HasFpsUnlockChanged() const { | 261 | bool Swapchain::HasFpsUnlockChanged() const { |
| 262 | return current_fps_unlocked != Settings::values.disable_fps_limit.GetValue(); | 262 | return current_fps_unlocked != Settings::values.disable_fps_limit.GetValue(); |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | bool VKSwapchain::NeedsPresentModeUpdate() const { | 265 | bool Swapchain::NeedsPresentModeUpdate() const { |
| 266 | // Mailbox present mode is the ideal for all scenarios. If it is not available, | 266 | // Mailbox present mode is the ideal for all scenarios. If it is not available, |
| 267 | // A different present mode is needed to support unlocked FPS above the monitor's refresh rate. | 267 | // A different present mode is needed to support unlocked FPS above the monitor's refresh rate. |
| 268 | return present_mode != VK_PRESENT_MODE_MAILBOX_KHR && HasFpsUnlockChanged(); | 268 | return present_mode != VK_PRESENT_MODE_MAILBOX_KHR && HasFpsUnlockChanged(); |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.h b/src/video_core/renderer_vulkan/vk_swapchain.h index 6d9d8fec9..111b3902d 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.h +++ b/src/video_core/renderer_vulkan/vk_swapchain.h | |||
| @@ -15,13 +15,13 @@ struct FramebufferLayout; | |||
| 15 | namespace Vulkan { | 15 | namespace Vulkan { |
| 16 | 16 | ||
| 17 | class Device; | 17 | class Device; |
| 18 | class VKScheduler; | 18 | class Scheduler; |
| 19 | 19 | ||
| 20 | class VKSwapchain { | 20 | class Swapchain { |
| 21 | public: | 21 | public: |
| 22 | explicit VKSwapchain(VkSurfaceKHR surface, const Device& device, VKScheduler& scheduler, | 22 | explicit Swapchain(VkSurfaceKHR surface, const Device& device, Scheduler& scheduler, u32 width, |
| 23 | u32 width, u32 height, bool srgb); | 23 | u32 height, bool srgb); |
| 24 | ~VKSwapchain(); | 24 | ~Swapchain(); |
| 25 | 25 | ||
| 26 | /// Creates (or recreates) the swapchain with a given size. | 26 | /// Creates (or recreates) the swapchain with a given size. |
| 27 | void Create(u32 width, u32 height, bool srgb); | 27 | void Create(u32 width, u32 height, bool srgb); |
| @@ -94,7 +94,7 @@ private: | |||
| 94 | 94 | ||
| 95 | const VkSurfaceKHR surface; | 95 | const VkSurfaceKHR surface; |
| 96 | const Device& device; | 96 | const Device& device; |
| 97 | VKScheduler& scheduler; | 97 | Scheduler& scheduler; |
| 98 | 98 | ||
| 99 | vk::SwapchainKHR swapchain; | 99 | vk::SwapchainKHR swapchain; |
| 100 | 100 | ||
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 43ecb9647..ba6d81420 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -648,7 +648,7 @@ struct RangedBarrierRange { | |||
| 648 | return VK_FORMAT_R32_UINT; | 648 | return VK_FORMAT_R32_UINT; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info, | 651 | void BlitScale(Scheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info, |
| 652 | VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution, | 652 | VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution, |
| 653 | bool up_scaling = true) { | 653 | bool up_scaling = true) { |
| 654 | const bool is_2d = info.type == ImageType::e2D; | 654 | const bool is_2d = info.type == ImageType::e2D; |
| @@ -788,7 +788,7 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con | |||
| 788 | } | 788 | } |
| 789 | } // Anonymous namespace | 789 | } // Anonymous namespace |
| 790 | 790 | ||
| 791 | TextureCacheRuntime::TextureCacheRuntime(const Device& device_, VKScheduler& scheduler_, | 791 | TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& scheduler_, |
| 792 | MemoryAllocator& memory_allocator_, | 792 | MemoryAllocator& memory_allocator_, |
| 793 | StagingBufferPool& staging_buffer_pool_, | 793 | StagingBufferPool& staging_buffer_pool_, |
| 794 | BlitImageHelper& blit_image_helper_, | 794 | BlitImageHelper& blit_image_helper_, |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 356dcc703..69f06ee7b 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -33,11 +33,11 @@ class ImageView; | |||
| 33 | class Framebuffer; | 33 | class Framebuffer; |
| 34 | class RenderPassCache; | 34 | class RenderPassCache; |
| 35 | class StagingBufferPool; | 35 | class StagingBufferPool; |
| 36 | class VKScheduler; | 36 | class Scheduler; |
| 37 | 37 | ||
| 38 | class TextureCacheRuntime { | 38 | class TextureCacheRuntime { |
| 39 | public: | 39 | public: |
| 40 | explicit TextureCacheRuntime(const Device& device_, VKScheduler& scheduler_, | 40 | explicit TextureCacheRuntime(const Device& device_, Scheduler& scheduler_, |
| 41 | MemoryAllocator& memory_allocator_, | 41 | MemoryAllocator& memory_allocator_, |
| 42 | StagingBufferPool& staging_buffer_pool_, | 42 | StagingBufferPool& staging_buffer_pool_, |
| 43 | BlitImageHelper& blit_image_helper_, | 43 | BlitImageHelper& blit_image_helper_, |
| @@ -93,7 +93,7 @@ public: | |||
| 93 | [[nodiscard]] VkBuffer GetTemporaryBuffer(size_t needed_size); | 93 | [[nodiscard]] VkBuffer GetTemporaryBuffer(size_t needed_size); |
| 94 | 94 | ||
| 95 | const Device& device; | 95 | const Device& device; |
| 96 | VKScheduler& scheduler; | 96 | Scheduler& scheduler; |
| 97 | MemoryAllocator& memory_allocator; | 97 | MemoryAllocator& memory_allocator; |
| 98 | StagingBufferPool& staging_buffer_pool; | 98 | StagingBufferPool& staging_buffer_pool; |
| 99 | BlitImageHelper& blit_image_helper; | 99 | BlitImageHelper& blit_image_helper; |
| @@ -154,7 +154,7 @@ private: | |||
| 154 | 154 | ||
| 155 | bool NeedsScaleHelper() const; | 155 | bool NeedsScaleHelper() const; |
| 156 | 156 | ||
| 157 | VKScheduler* scheduler{}; | 157 | Scheduler* scheduler{}; |
| 158 | TextureCacheRuntime* runtime{}; | 158 | TextureCacheRuntime* runtime{}; |
| 159 | 159 | ||
| 160 | vk::Image original_image; | 160 | vk::Image original_image; |
diff --git a/src/video_core/renderer_vulkan/vk_update_descriptor.cpp b/src/video_core/renderer_vulkan/vk_update_descriptor.cpp index d29540fec..4d4a6753b 100644 --- a/src/video_core/renderer_vulkan/vk_update_descriptor.cpp +++ b/src/video_core/renderer_vulkan/vk_update_descriptor.cpp | |||
| @@ -12,18 +12,18 @@ | |||
| 12 | 12 | ||
| 13 | namespace Vulkan { | 13 | namespace Vulkan { |
| 14 | 14 | ||
| 15 | VKUpdateDescriptorQueue::VKUpdateDescriptorQueue(const Device& device_, VKScheduler& scheduler_) | 15 | UpdateDescriptorQueue::UpdateDescriptorQueue(const Device& device_, Scheduler& scheduler_) |
| 16 | : device{device_}, scheduler{scheduler_} { | 16 | : device{device_}, scheduler{scheduler_} { |
| 17 | payload_cursor = payload.data(); | 17 | payload_cursor = payload.data(); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | VKUpdateDescriptorQueue::~VKUpdateDescriptorQueue() = default; | 20 | UpdateDescriptorQueue::~UpdateDescriptorQueue() = default; |
| 21 | 21 | ||
| 22 | void VKUpdateDescriptorQueue::TickFrame() { | 22 | void UpdateDescriptorQueue::TickFrame() { |
| 23 | payload_cursor = payload.data(); | 23 | payload_cursor = payload.data(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | void VKUpdateDescriptorQueue::Acquire() { | 26 | void UpdateDescriptorQueue::Acquire() { |
| 27 | // Minimum number of entries required. | 27 | // Minimum number of entries required. |
| 28 | // This is the maximum number of entries a single draw call migth use. | 28 | // This is the maximum number of entries a single draw call migth use. |
| 29 | static constexpr size_t MIN_ENTRIES = 0x400; | 29 | static constexpr size_t MIN_ENTRIES = 0x400; |
diff --git a/src/video_core/renderer_vulkan/vk_update_descriptor.h b/src/video_core/renderer_vulkan/vk_update_descriptor.h index d8a56b153..625bcc809 100644 --- a/src/video_core/renderer_vulkan/vk_update_descriptor.h +++ b/src/video_core/renderer_vulkan/vk_update_descriptor.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | namespace Vulkan { | 10 | namespace Vulkan { |
| 11 | 11 | ||
| 12 | class Device; | 12 | class Device; |
| 13 | class VKScheduler; | 13 | class Scheduler; |
| 14 | 14 | ||
| 15 | struct DescriptorUpdateEntry { | 15 | struct DescriptorUpdateEntry { |
| 16 | struct Empty {}; | 16 | struct Empty {}; |
| @@ -28,10 +28,10 @@ struct DescriptorUpdateEntry { | |||
| 28 | }; | 28 | }; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | class VKUpdateDescriptorQueue final { | 31 | class UpdateDescriptorQueue final { |
| 32 | public: | 32 | public: |
| 33 | explicit VKUpdateDescriptorQueue(const Device& device_, VKScheduler& scheduler_); | 33 | explicit UpdateDescriptorQueue(const Device& device_, Scheduler& scheduler_); |
| 34 | ~VKUpdateDescriptorQueue(); | 34 | ~UpdateDescriptorQueue(); |
| 35 | 35 | ||
| 36 | void TickFrame(); | 36 | void TickFrame(); |
| 37 | 37 | ||
| @@ -71,7 +71,7 @@ public: | |||
| 71 | 71 | ||
| 72 | private: | 72 | private: |
| 73 | const Device& device; | 73 | const Device& device; |
| 74 | VKScheduler& scheduler; | 74 | Scheduler& scheduler; |
| 75 | 75 | ||
| 76 | DescriptorUpdateEntry* payload_cursor = nullptr; | 76 | DescriptorUpdateEntry* payload_cursor = nullptr; |
| 77 | const DescriptorUpdateEntry* upload_start = nullptr; | 77 | const DescriptorUpdateEntry* upload_start = nullptr; |