From 624df92616576c489017329fee1b6de0f47dd7e7 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Thu, 14 Apr 2022 14:08:41 +0530 Subject: [PATCH] Change `AddNonGraphicsPass` to `AddOutsideRpCommand` The terminology "Non-Graphics pass" was deemed to be fairly inaccurate since it simply covered all Vulkan commands (not "passes") outside the render-pass scope, these may be graphical operations such as blits and therefore it is more accurate to use the new terminology of "Outside-RenderPass command" due to the lack of such an implication while being consistent with the Vulkan specification. --- .../gpu/interconnect/command_executor.cpp | 8 +++--- .../gpu/interconnect/command_executor.h | 4 +-- .../gpu/interconnect/graphics_context.h | 28 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp index 33db9783..2b9c8fad 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -53,14 +53,14 @@ namespace skyline::gpu::interconnect { bool newRenderPass{CreateRenderPass(renderArea)}; renderPass->AddSubpass(inputAttachments, colorAttachments, depthStencilAttachment ? &*depthStencilAttachment : nullptr); if (newRenderPass) - nodes.emplace_back(std::in_place_type_t(), std::forward &, GPU &, vk::RenderPass, u32)>>(function)); + nodes.emplace_back(std::in_place_type_t(), std::forward(function)); else - nodes.emplace_back(std::in_place_type_t(), std::forward &, GPU &, vk::RenderPass, u32)>>(function)); + nodes.emplace_back(std::in_place_type_t(), std::forward(function)); } - void CommandExecutor::AddNonGraphicsPass(std::function &, GPU &)> &&function) { - // End render pass + void CommandExecutor::AddOutsideRpCommand(std::function &, GPU &)> &&function) { if (renderPass) { + // End render pass, if we're in one nodes.emplace_back(std::in_place_type_t()); renderPass = nullptr; subpassCount = 0; diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h index 5c624e75..b3890956 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h @@ -74,9 +74,9 @@ namespace skyline::gpu::interconnect { void AddClearDepthStencilSubpass(TextureView *attachment, const vk::ClearDepthStencilValue &value); /** - * @brief Adds a non graphics pass that can be used to execute arbitrary commands outside of a render pass + * @brief Adds a command that needs to be executed outside the scope of a render pass */ - void AddNonGraphicsPass(std::function &, GPU &)> &&function); + void AddOutsideRpCommand(std::function &, GPU &)> &&function); /** * @brief Execute all the nodes and submit the resulting command buffer to the GPU diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index e3043a12..dcf0f70b 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -78,19 +78,19 @@ namespace skyline::gpu::interconnect { constexpr vk::ImageTiling NullImageTiling{vk::ImageTiling::eOptimal}; auto vkImage{gpu.memory.AllocateImage({ - .imageType = vk::ImageType::e2D, - .format = NullImageFormat->vkFormat, - .extent = NullImageDimensions, - .mipLevels = 1, - .arrayLayers = 1, - .samples = vk::SampleCountFlagBits::e1, - .tiling = NullImageTiling, - .usage = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eSampled, - .sharingMode = vk::SharingMode::eExclusive, - .queueFamilyIndexCount = 1, - .pQueueFamilyIndices = &gpu.vkQueueFamilyIndex, - .initialLayout = NullImageInitialLayout - })}; + .imageType = vk::ImageType::e2D, + .format = NullImageFormat->vkFormat, + .extent = NullImageDimensions, + .mipLevels = 1, + .arrayLayers = 1, + .samples = vk::SampleCountFlagBits::e1, + .tiling = NullImageTiling, + .usage = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eSampled, + .sharingMode = vk::SharingMode::eExclusive, + .queueFamilyIndexCount = 1, + .pQueueFamilyIndices = &gpu.vkQueueFamilyIndex, + .initialLayout = NullImageInitialLayout + })}; auto nullTexture{std::make_shared(gpu, std::move(vkImage), NullImageDimensions, NullImageFormat, NullImageInitialLayout, NullImageTiling)}; nullTexture->TransitionLayout(vk::ImageLayout::eGeneral); @@ -714,7 +714,7 @@ namespace skyline::gpu::interconnect { auto constantBuffer{GetConstantBufferSelector().value()}; constantBuffer.Write(data, offset); - executor.AddNonGraphicsPass([view = constantBuffer.view, data, offset](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &cycle, GPU &) { + executor.AddOutsideRpCommand([view = constantBuffer.view, data, offset](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &cycle, GPU &) { std::scoped_lock lock{view}; commandBuffer.updateBuffer(view.bufferDelegate->buffer->GetBacking(), offset, vk::ArrayProxy(1, &data)); });