mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-10-30 03:37:52 +00:00
vk_render_manager: Minor cleanups and rename to RenderManager
* It is no longer just a renderpass cache * Revert variable name change from render_manager back to renderpass_cache
This commit is contained in:
parent
a06aa7981e
commit
5c91cc522f
14 changed files with 72 additions and 100 deletions
|
@ -54,19 +54,13 @@ RendererVulkan::RendererVulkan(Core::System& system, Pica::PicaCore& pica_,
|
|||
Frontend::EmuWindow& window, Frontend::EmuWindow* secondary_window)
|
||||
: RendererBase{system, window, secondary_window}, memory{system.Memory()}, pica{pica_},
|
||||
instance{window, Settings::values.physical_device.GetValue()}, scheduler{instance},
|
||||
render_manager{instance, scheduler}, main_window{window, instance, scheduler},
|
||||
renderpass_cache{instance, scheduler}, main_window{window, instance, scheduler},
|
||||
vertex_buffer{instance, scheduler, vk::BufferUsageFlagBits::eVertexBuffer,
|
||||
VERTEX_BUFFER_SIZE},
|
||||
update_queue{instance}, rasterizer{memory,
|
||||
pica,
|
||||
system.CustomTexManager(),
|
||||
*this,
|
||||
render_window,
|
||||
instance,
|
||||
scheduler,
|
||||
render_manager,
|
||||
update_queue,
|
||||
main_window.ImageCount()},
|
||||
update_queue{instance},
|
||||
rasterizer{
|
||||
memory, pica, system.CustomTexManager(), *this, render_window,
|
||||
instance, scheduler, renderpass_cache, update_queue, main_window.ImageCount()},
|
||||
present_heap{instance, scheduler.GetMasterSemaphore(), PRESENT_BINDINGS, 32} {
|
||||
CompileShaders();
|
||||
BuildLayouts();
|
||||
|
@ -132,7 +126,7 @@ void RendererVulkan::PrepareDraw(Frame* frame, const Layout::FramebufferLayout&
|
|||
sampler);
|
||||
}
|
||||
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
scheduler.Record([this, layout, frame, present_set, renderpass = main_window.Renderpass(),
|
||||
index = current_pipeline](vk::CommandBuffer cmdbuf) {
|
||||
const vk::Viewport viewport = {
|
||||
|
@ -467,7 +461,7 @@ void RendererVulkan::FillScreen(Common::Vec3<u8> color, const TextureInfo& textu
|
|||
},
|
||||
};
|
||||
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
scheduler.Record([image = texture.image, clear_color](vk::CommandBuffer cmdbuf) {
|
||||
const vk::ImageSubresourceRange range = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
|
@ -804,29 +798,7 @@ void RendererVulkan::DrawScreens(Frame* frame, const Layout::FramebufferLayout&
|
|||
}
|
||||
}
|
||||
|
||||
scheduler.Record([image = frame->image](vk::CommandBuffer cmdbuf) {
|
||||
const vk::ImageMemoryBarrier render_barrier = {
|
||||
.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite,
|
||||
.dstAccessMask = vk::AccessFlagBits::eTransferRead,
|
||||
.oldLayout = vk::ImageLayout::eTransferSrcOptimal,
|
||||
.newLayout = vk::ImageLayout::eTransferSrcOptimal,
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.image = image,
|
||||
.subresourceRange{
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = VK_REMAINING_ARRAY_LAYERS,
|
||||
},
|
||||
};
|
||||
|
||||
cmdbuf.endRenderPass();
|
||||
cmdbuf.pipelineBarrier(vk::PipelineStageFlagBits::eColorAttachmentOutput,
|
||||
vk::PipelineStageFlagBits::eTransfer,
|
||||
vk::DependencyFlagBits::eByRegion, {}, {}, render_barrier);
|
||||
});
|
||||
scheduler.Record([](vk::CommandBuffer cmdbuf) { cmdbuf.endRenderPass(); });
|
||||
}
|
||||
|
||||
void RendererVulkan::SwapBuffers() {
|
||||
|
|
|
@ -117,7 +117,7 @@ private:
|
|||
|
||||
Instance instance;
|
||||
Scheduler scheduler;
|
||||
RenderManager render_manager;
|
||||
RenderManager renderpass_cache;
|
||||
PresentWindow main_window;
|
||||
StreamBuffer vertex_buffer;
|
||||
DescriptorUpdateQueue update_queue;
|
||||
|
|
|
@ -179,8 +179,8 @@ constexpr vk::PipelineShaderStageCreateInfo MakeStages(vk::ShaderModule compute_
|
|||
} // Anonymous namespace
|
||||
|
||||
BlitHelper::BlitHelper(const Instance& instance_, Scheduler& scheduler_,
|
||||
RenderManager& render_manager_, DescriptorUpdateQueue& update_queue_)
|
||||
: instance{instance_}, scheduler{scheduler_}, render_manager{render_manager_},
|
||||
RenderManager& renderpass_cache_, DescriptorUpdateQueue& update_queue_)
|
||||
: instance{instance_}, scheduler{scheduler_}, renderpass_cache{renderpass_cache_},
|
||||
update_queue{update_queue_}, device{instance.GetDevice()},
|
||||
compute_provider{instance, scheduler.GetMasterSemaphore(), COMPUTE_BINDINGS},
|
||||
compute_buffer_provider{instance, scheduler.GetMasterSemaphore(), COMPUTE_BUFFER_BINDINGS},
|
||||
|
@ -294,10 +294,11 @@ bool BlitHelper::BlitDepthStencil(Surface& source, Surface& dest,
|
|||
|
||||
const RenderPass depth_pass = {
|
||||
.framebuffer = dest.Framebuffer(),
|
||||
.render_pass = render_manager.GetRenderpass(PixelFormat::Invalid, dest.pixel_format, false),
|
||||
.render_pass =
|
||||
renderpass_cache.GetRenderpass(PixelFormat::Invalid, dest.pixel_format, false),
|
||||
.render_area = dst_render_area,
|
||||
};
|
||||
render_manager.BeginRendering(depth_pass);
|
||||
renderpass_cache.BeginRendering(depth_pass);
|
||||
|
||||
scheduler.Record([blit, descriptor_set, this](vk::CommandBuffer cmdbuf) {
|
||||
const vk::PipelineLayout layout = two_textures_pipeline_layout;
|
||||
|
@ -320,7 +321,7 @@ bool BlitHelper::ConvertDS24S8ToRGBA8(Surface& source, Surface& dest,
|
|||
vk::ImageLayout::eDepthStencilReadOnlyOptimal);
|
||||
update_queue.AddStorageImage(descriptor_set, 2, dest.ImageView());
|
||||
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
scheduler.Record([this, descriptor_set, copy, src_image = source.Image(),
|
||||
dst_image = dest.Image()](vk::CommandBuffer cmdbuf) {
|
||||
const std::array pre_barriers = {
|
||||
|
@ -432,7 +433,7 @@ bool BlitHelper::DepthToBuffer(Surface& source, vk::Buffer buffer,
|
|||
update_queue.AddBuffer(descriptor_set, 2, buffer, copy.buffer_offset, copy.buffer_size,
|
||||
vk::DescriptorType::eStorageBuffer);
|
||||
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
scheduler.Record([this, descriptor_set, copy, src_image = source.Image(),
|
||||
extent = source.RealExtent(false)](vk::CommandBuffer cmdbuf) {
|
||||
const vk::ImageMemoryBarrier pre_barrier = {
|
||||
|
@ -518,8 +519,8 @@ vk::Pipeline BlitHelper::MakeDepthStencilBlitPipeline() {
|
|||
}
|
||||
|
||||
const std::array stages = MakeStages(full_screen_vert, blit_depth_stencil_frag);
|
||||
const auto renderpass = render_manager.GetRenderpass(VideoCore::PixelFormat::Invalid,
|
||||
VideoCore::PixelFormat::D24S8, false);
|
||||
const auto renderpass = renderpass_cache.GetRenderpass(VideoCore::PixelFormat::Invalid,
|
||||
VideoCore::PixelFormat::D24S8, false);
|
||||
vk::GraphicsPipelineCreateInfo depth_stencil_info = {
|
||||
.stageCount = static_cast<u32>(stages.size()),
|
||||
.pStages = stages.data(),
|
||||
|
|
|
@ -25,7 +25,7 @@ class BlitHelper {
|
|||
|
||||
public:
|
||||
explicit BlitHelper(const Instance& instance, Scheduler& scheduler,
|
||||
RenderManager& render_manager, DescriptorUpdateQueue& update_queue);
|
||||
RenderManager& renderpass_cache, DescriptorUpdateQueue& update_queue);
|
||||
~BlitHelper();
|
||||
|
||||
bool BlitDepthStencil(Surface& source, Surface& dest, const VideoCore::TextureBlit& blit);
|
||||
|
@ -42,7 +42,7 @@ private:
|
|||
private:
|
||||
const Instance& instance;
|
||||
Scheduler& scheduler;
|
||||
RenderManager& render_manager;
|
||||
RenderManager& renderpass_cache;
|
||||
DescriptorUpdateQueue& update_queue;
|
||||
|
||||
vk::Device device;
|
||||
|
|
|
@ -64,11 +64,11 @@ Shader::~Shader() {
|
|||
}
|
||||
}
|
||||
|
||||
GraphicsPipeline::GraphicsPipeline(const Instance& instance_, RenderManager& render_manager_,
|
||||
GraphicsPipeline::GraphicsPipeline(const Instance& instance_, RenderManager& renderpass_cache_,
|
||||
const PipelineInfo& info_, vk::PipelineCache pipeline_cache_,
|
||||
vk::PipelineLayout layout_, std::array<Shader*, 3> stages_,
|
||||
Common::ThreadWorker* worker_)
|
||||
: instance{instance_}, render_manager{render_manager_}, worker{worker_},
|
||||
: instance{instance_}, renderpass_cache{renderpass_cache_}, worker{worker_},
|
||||
pipeline_layout{layout_}, pipeline_cache{pipeline_cache_}, info{info_}, stages{stages_} {}
|
||||
|
||||
GraphicsPipeline::~GraphicsPipeline() = default;
|
||||
|
@ -265,7 +265,7 @@ bool GraphicsPipeline::Build(bool fail_on_compile_required) {
|
|||
.pDynamicState = &dynamic_info,
|
||||
.layout = pipeline_layout,
|
||||
.renderPass =
|
||||
render_manager.GetRenderpass(info.attachments.color, info.attachments.depth, false),
|
||||
renderpass_cache.GetRenderpass(info.attachments.color, info.attachments.depth, false),
|
||||
};
|
||||
|
||||
if (fail_on_compile_required) {
|
||||
|
|
|
@ -165,7 +165,7 @@ struct Shader : public Common::AsyncHandle {
|
|||
|
||||
class GraphicsPipeline : public Common::AsyncHandle {
|
||||
public:
|
||||
explicit GraphicsPipeline(const Instance& instance, RenderManager& render_manager,
|
||||
explicit GraphicsPipeline(const Instance& instance, RenderManager& renderpass_cache,
|
||||
const PipelineInfo& info, vk::PipelineCache pipeline_cache,
|
||||
vk::PipelineLayout layout, std::array<Shader*, 3> stages,
|
||||
Common::ThreadWorker* worker);
|
||||
|
@ -181,7 +181,7 @@ public:
|
|||
|
||||
private:
|
||||
const Instance& instance;
|
||||
RenderManager& render_manager;
|
||||
RenderManager& renderpass_cache;
|
||||
Common::ThreadWorker* worker;
|
||||
|
||||
vk::UniquePipeline pipeline;
|
||||
|
|
|
@ -78,8 +78,8 @@ constexpr std::array<vk::DescriptorSetLayoutBinding, 2> UTILITY_BINDINGS = {{
|
|||
}};
|
||||
|
||||
PipelineCache::PipelineCache(const Instance& instance_, Scheduler& scheduler_,
|
||||
RenderManager& render_manager_, DescriptorUpdateQueue& update_queue_)
|
||||
: instance{instance_}, scheduler{scheduler_}, render_manager{render_manager_},
|
||||
RenderManager& renderpass_cache_, DescriptorUpdateQueue& update_queue_)
|
||||
: instance{instance_}, scheduler{scheduler_}, renderpass_cache{renderpass_cache_},
|
||||
update_queue{update_queue_},
|
||||
num_worker_threads{std::max(std::thread::hardware_concurrency(), 2U) >> 1},
|
||||
workers{num_worker_threads, "Pipeline workers"},
|
||||
|
@ -206,7 +206,7 @@ bool PipelineCache::BindPipeline(const PipelineInfo& info, bool wait_built) {
|
|||
auto [it, new_pipeline] = graphics_pipelines.try_emplace(pipeline_hash);
|
||||
if (new_pipeline) {
|
||||
it.value() =
|
||||
std::make_unique<GraphicsPipeline>(instance, render_manager, info, *pipeline_cache,
|
||||
std::make_unique<GraphicsPipeline>(instance, renderpass_cache, info, *pipeline_cache,
|
||||
*pipeline_layout, current_shaders, &workers);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class PipelineCache {
|
|||
|
||||
public:
|
||||
explicit PipelineCache(const Instance& instance, Scheduler& scheduler,
|
||||
RenderManager& render_manager, DescriptorUpdateQueue& update_queue);
|
||||
RenderManager& renderpass_cache, DescriptorUpdateQueue& update_queue);
|
||||
~PipelineCache();
|
||||
|
||||
/// Acquires and binds a free descriptor set from the appropriate heap.
|
||||
|
@ -98,7 +98,7 @@ private:
|
|||
private:
|
||||
const Instance& instance;
|
||||
Scheduler& scheduler;
|
||||
RenderManager& render_manager;
|
||||
RenderManager& renderpass_cache;
|
||||
DescriptorUpdateQueue& update_queue;
|
||||
|
||||
Pica::Shader::Profile profile{};
|
||||
|
|
|
@ -58,15 +58,15 @@ RasterizerVulkan::RasterizerVulkan(Memory::MemorySystem& memory, Pica::PicaCore&
|
|||
VideoCore::CustomTexManager& custom_tex_manager,
|
||||
VideoCore::RendererBase& renderer,
|
||||
Frontend::EmuWindow& emu_window, const Instance& instance,
|
||||
Scheduler& scheduler, RenderManager& render_manager,
|
||||
Scheduler& scheduler, RenderManager& renderpass_cache,
|
||||
DescriptorUpdateQueue& update_queue_, u32 image_count)
|
||||
: RasterizerAccelerated{memory, pica}, instance{instance}, scheduler{scheduler},
|
||||
render_manager{render_manager}, update_queue{update_queue_},
|
||||
pipeline_cache{instance, scheduler, render_manager, update_queue}, runtime{instance,
|
||||
scheduler,
|
||||
render_manager,
|
||||
update_queue,
|
||||
image_count},
|
||||
renderpass_cache{renderpass_cache}, update_queue{update_queue_},
|
||||
pipeline_cache{instance, scheduler, renderpass_cache, update_queue}, runtime{instance,
|
||||
scheduler,
|
||||
renderpass_cache,
|
||||
update_queue,
|
||||
image_count},
|
||||
res_cache{memory, custom_tex_manager, runtime, regs, renderer},
|
||||
stream_buffer{instance, scheduler, BUFFER_USAGE, STREAM_BUFFER_SIZE},
|
||||
uniform_buffer{instance, scheduler, vk::BufferUsageFlagBits::eUniformBuffer,
|
||||
|
@ -110,7 +110,7 @@ RasterizerVulkan::RasterizerVulkan(Memory::MemorySystem& memory, Pica::PicaCore&
|
|||
.range = VK_WHOLE_SIZE,
|
||||
});
|
||||
|
||||
scheduler.RegisterOnSubmit([&render_manager] { render_manager.EndRendering(); });
|
||||
scheduler.RegisterOnSubmit([&renderpass_cache] { renderpass_cache.EndRendering(); });
|
||||
|
||||
// Prepare the static buffer descriptor set.
|
||||
const auto buffer_set = pipeline_cache.Acquire(DescriptorHeapType::Buffer);
|
||||
|
@ -519,7 +519,7 @@ bool RasterizerVulkan::Draw(bool accelerate, bool is_indexed) {
|
|||
|
||||
// Begin rendering
|
||||
const auto draw_rect = fb_helper.DrawRect();
|
||||
render_manager.BeginRendering(framebuffer, draw_rect);
|
||||
renderpass_cache.BeginRendering(framebuffer, draw_rect);
|
||||
|
||||
// Configure viewport and scissor
|
||||
const auto viewport = fb_helper.Viewport();
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
VideoCore::CustomTexManager& custom_tex_manager,
|
||||
VideoCore::RendererBase& renderer, Frontend::EmuWindow& emu_window,
|
||||
const Instance& instance, Scheduler& scheduler,
|
||||
RenderManager& render_manager, DescriptorUpdateQueue& update_queue,
|
||||
RenderManager& renderpass_cache, DescriptorUpdateQueue& update_queue,
|
||||
u32 image_count);
|
||||
~RasterizerVulkan() override;
|
||||
|
||||
|
@ -144,7 +144,7 @@ private:
|
|||
private:
|
||||
const Instance& instance;
|
||||
Scheduler& scheduler;
|
||||
RenderManager& render_manager;
|
||||
RenderManager& renderpass_cache;
|
||||
DescriptorUpdateQueue& update_queue;
|
||||
PipelineCache pipeline_cache;
|
||||
TextureRuntime runtime;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Vulkan {
|
||||
|
||||
constexpr u32 MIN_DRAWS_TO_FLUSH = 20;
|
||||
constexpr u32 MinDrawsToFlush = 20;
|
||||
|
||||
using VideoCore::PixelFormat;
|
||||
using VideoCore::SurfaceType;
|
||||
|
@ -118,13 +118,13 @@ void RenderManager::EndRendering() {
|
|||
});
|
||||
|
||||
// Reset state.
|
||||
pass.render_pass = vk::RenderPass{};
|
||||
pass.render_pass = VK_NULL_HANDLE;
|
||||
images = {};
|
||||
aspects = {};
|
||||
|
||||
// The Mali guide recommends flushing at the end of each major renderpass
|
||||
// Testing has shown this has a significant effect on rendering performance
|
||||
if (num_draws > MIN_DRAWS_TO_FLUSH && instance.ShouldFlush()) {
|
||||
if (num_draws > MinDrawsToFlush && instance.ShouldFlush()) {
|
||||
scheduler.Flush();
|
||||
num_draws = 0;
|
||||
}
|
||||
|
@ -135,12 +135,11 @@ vk::RenderPass RenderManager::GetRenderpass(VideoCore::PixelFormat color,
|
|||
std::scoped_lock lock{cache_mutex};
|
||||
|
||||
const u32 color_index =
|
||||
color == VideoCore::PixelFormat::Invalid ? MAX_COLOR_FORMATS : static_cast<u32>(color);
|
||||
const u32 depth_index = depth == VideoCore::PixelFormat::Invalid
|
||||
? MAX_DEPTH_FORMATS
|
||||
: (static_cast<u32>(depth) - 14);
|
||||
color == VideoCore::PixelFormat::Invalid ? NumColorFormats : static_cast<u32>(color);
|
||||
const u32 depth_index =
|
||||
depth == VideoCore::PixelFormat::Invalid ? NumDepthFormats : (static_cast<u32>(depth) - 14);
|
||||
|
||||
ASSERT_MSG(color_index <= MAX_COLOR_FORMATS && depth_index <= MAX_DEPTH_FORMATS,
|
||||
ASSERT_MSG(color_index <= NumColorFormats && depth_index <= NumDepthFormats,
|
||||
"Invalid color index {} and/or depth_index {}", color_index, depth_index);
|
||||
|
||||
vk::UniqueRenderPass& renderpass = cached_renderpasses[color_index][depth_index][is_clear];
|
||||
|
|
|
@ -35,8 +35,8 @@ struct RenderPass {
|
|||
};
|
||||
|
||||
class RenderManager {
|
||||
static constexpr std::size_t MAX_COLOR_FORMATS = 13;
|
||||
static constexpr std::size_t MAX_DEPTH_FORMATS = 4;
|
||||
static constexpr u32 NumColorFormats = 13;
|
||||
static constexpr u32 NumDepthFormats = 4;
|
||||
|
||||
public:
|
||||
explicit RenderManager(const Instance& instance, Scheduler& scheduler);
|
||||
|
@ -63,7 +63,7 @@ private:
|
|||
private:
|
||||
const Instance& instance;
|
||||
Scheduler& scheduler;
|
||||
vk::UniqueRenderPass cached_renderpasses[MAX_COLOR_FORMATS + 1][MAX_DEPTH_FORMATS + 1][2];
|
||||
vk::UniqueRenderPass cached_renderpasses[NumColorFormats + 1][NumDepthFormats + 1][2];
|
||||
std::mutex cache_mutex;
|
||||
std::array<vk::Image, 2> images;
|
||||
std::array<vk::ImageAspectFlags, 2> aspects;
|
||||
|
|
|
@ -248,10 +248,10 @@ constexpr u64 DOWNLOAD_BUFFER_SIZE = 16_MiB;
|
|||
} // Anonymous namespace
|
||||
|
||||
TextureRuntime::TextureRuntime(const Instance& instance, Scheduler& scheduler,
|
||||
RenderManager& render_manager, DescriptorUpdateQueue& update_queue,
|
||||
RenderManager& renderpass_cache, DescriptorUpdateQueue& update_queue,
|
||||
u32 num_swapchain_images_)
|
||||
: instance{instance}, scheduler{scheduler}, render_manager{render_manager},
|
||||
blit_helper{instance, scheduler, render_manager, update_queue},
|
||||
: instance{instance}, scheduler{scheduler}, renderpass_cache{renderpass_cache},
|
||||
blit_helper{instance, scheduler, renderpass_cache, update_queue},
|
||||
upload_buffer{instance, scheduler, vk::BufferUsageFlagBits::eTransferSrc, UPLOAD_BUFFER_SIZE,
|
||||
BufferType::Upload},
|
||||
download_buffer{instance, scheduler,
|
||||
|
@ -304,7 +304,7 @@ bool TextureRuntime::Reinterpret(Surface& source, Surface& dest,
|
|||
}
|
||||
|
||||
bool TextureRuntime::ClearTexture(Surface& surface, const VideoCore::TextureClear& clear) {
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
|
||||
const RecordParams params = {
|
||||
.aspect = surface.Aspect(),
|
||||
|
@ -376,7 +376,7 @@ void TextureRuntime::ClearTextureWithRenderpass(Surface& surface,
|
|||
|
||||
const auto color_format = is_color ? surface.pixel_format : PixelFormat::Invalid;
|
||||
const auto depth_format = is_color ? PixelFormat::Invalid : surface.pixel_format;
|
||||
const auto render_pass = render_manager.GetRenderpass(color_format, depth_format, true);
|
||||
const auto render_pass = renderpass_cache.GetRenderpass(color_format, depth_format, true);
|
||||
|
||||
const RecordParams params = {
|
||||
.aspect = surface.Aspect(),
|
||||
|
@ -453,7 +453,7 @@ void TextureRuntime::ClearTextureWithRenderpass(Surface& surface,
|
|||
|
||||
bool TextureRuntime::CopyTextures(Surface& source, Surface& dest,
|
||||
std::span<const VideoCore::TextureCopy> copies) {
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
|
||||
const RecordParams params = {
|
||||
.aspect = source.Aspect(),
|
||||
|
@ -561,7 +561,7 @@ bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
|||
return blit_helper.BlitDepthStencil(source, dest, blit);
|
||||
}
|
||||
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
|
||||
const RecordParams params = {
|
||||
.aspect = source.Aspect(),
|
||||
|
@ -669,7 +669,7 @@ void TextureRuntime::GenerateMipmaps(Surface& surface) {
|
|||
return;
|
||||
}
|
||||
|
||||
render_manager.EndRendering();
|
||||
renderpass_cache.EndRendering();
|
||||
|
||||
auto [width, height] = surface.RealExtent();
|
||||
const u32 levels = surface.levels;
|
||||
|
@ -732,7 +732,7 @@ Surface::Surface(TextureRuntime& runtime_, const VideoCore::SurfaceParams& param
|
|||
raw_images.emplace_back(handles[1].image);
|
||||
}
|
||||
|
||||
runtime->render_manager.EndRendering();
|
||||
runtime->renderpass_cache.EndRendering();
|
||||
scheduler->Record([raw_images, aspect = traits.aspect](vk::CommandBuffer cmdbuf) {
|
||||
const auto barriers = MakeInitBarriers(aspect, raw_images);
|
||||
cmdbuf.pipelineBarrier(vk::PipelineStageFlagBits::eTopOfPipe,
|
||||
|
@ -776,7 +776,7 @@ Surface::Surface(TextureRuntime& runtime_, const VideoCore::SurfaceBase& surface
|
|||
raw_images.emplace_back(handles[2].image);
|
||||
}
|
||||
|
||||
runtime->render_manager.EndRendering();
|
||||
runtime->renderpass_cache.EndRendering();
|
||||
scheduler->Record([raw_images, aspect = traits.aspect](vk::CommandBuffer cmdbuf) {
|
||||
const auto barriers = MakeInitBarriers(aspect, raw_images);
|
||||
cmdbuf.pipelineBarrier(vk::PipelineStageFlagBits::eTopOfPipe,
|
||||
|
@ -804,7 +804,7 @@ Surface::~Surface() {
|
|||
|
||||
void Surface::Upload(const VideoCore::BufferTextureCopy& upload,
|
||||
const VideoCore::StagingData& staging) {
|
||||
runtime->render_manager.EndRendering();
|
||||
runtime->renderpass_cache.EndRendering();
|
||||
|
||||
const RecordParams params = {
|
||||
.aspect = Aspect(),
|
||||
|
@ -972,7 +972,7 @@ void Surface::Download(const VideoCore::BufferTextureCopy& download,
|
|||
runtime->download_buffer.Commit(staging.size);
|
||||
});
|
||||
|
||||
runtime->render_manager.EndRendering();
|
||||
runtime->renderpass_cache.EndRendering();
|
||||
|
||||
if (pixel_format == PixelFormat::D24S8) {
|
||||
runtime->blit_helper.DepthToBuffer(*this, runtime->download_buffer.Handle(), download);
|
||||
|
@ -1072,7 +1072,7 @@ void Surface::ScaleUp(u32 new_scale) {
|
|||
MakeHandle(instance, GetScaledWidth(), GetScaledHeight(), levels, texture_type,
|
||||
traits.native, traits.usage, flags, traits.aspect, false, DebugName(true));
|
||||
|
||||
runtime->render_manager.EndRendering();
|
||||
runtime->renderpass_cache.EndRendering();
|
||||
scheduler->Record(
|
||||
[raw_images = std::array{Image()}, aspect = traits.aspect](vk::CommandBuffer cmdbuf) {
|
||||
const auto barriers = MakeInitBarriers(aspect, raw_images);
|
||||
|
@ -1150,7 +1150,7 @@ vk::ImageView Surface::CopyImageView() noexcept {
|
|||
copy_layout = vk::ImageLayout::eUndefined;
|
||||
}
|
||||
|
||||
runtime->render_manager.EndRendering();
|
||||
runtime->renderpass_cache.EndRendering();
|
||||
|
||||
const RecordParams params = {
|
||||
.aspect = Aspect(),
|
||||
|
@ -1338,7 +1338,7 @@ vk::Framebuffer Surface::Framebuffer() noexcept {
|
|||
const auto color_format = is_depth ? PixelFormat::Invalid : pixel_format;
|
||||
const auto depth_format = is_depth ? pixel_format : PixelFormat::Invalid;
|
||||
const auto render_pass =
|
||||
runtime->render_manager.GetRenderpass(color_format, depth_format, false);
|
||||
runtime->renderpass_cache.GetRenderpass(color_format, depth_format, false);
|
||||
const auto attachments = std::array{ImageView()};
|
||||
framebuffers[index] = MakeFramebuffer(instance->GetDevice(), render_pass, GetScaledWidth(),
|
||||
GetScaledHeight(), attachments);
|
||||
|
@ -1452,7 +1452,7 @@ Framebuffer::Framebuffer(TextureRuntime& runtime, const VideoCore::FramebufferPa
|
|||
Surface* color, Surface* depth)
|
||||
: VideoCore::FramebufferParams{params}, res_scale{color ? color->res_scale
|
||||
: (depth ? depth->res_scale : 1u)} {
|
||||
auto& render_manager = runtime.GetRenderpassCache();
|
||||
auto& renderpass_cache = runtime.GetRenderpassCache();
|
||||
if (shadow_rendering && !color) {
|
||||
return;
|
||||
}
|
||||
|
@ -1486,11 +1486,11 @@ Framebuffer::Framebuffer(TextureRuntime& runtime, const VideoCore::FramebufferPa
|
|||
const vk::Device device = runtime.GetInstance().GetDevice();
|
||||
if (shadow_rendering) {
|
||||
render_pass =
|
||||
render_manager.GetRenderpass(PixelFormat::Invalid, PixelFormat::Invalid, false);
|
||||
renderpass_cache.GetRenderpass(PixelFormat::Invalid, PixelFormat::Invalid, false);
|
||||
framebuffer = MakeFramebuffer(device, render_pass, color->GetScaledWidth(),
|
||||
color->GetScaledHeight(), {});
|
||||
} else {
|
||||
render_pass = render_manager.GetRenderpass(formats[0], formats[1], false);
|
||||
render_pass = renderpass_cache.GetRenderpass(formats[0], formats[1], false);
|
||||
framebuffer = MakeFramebuffer(device, render_pass, width, height, attachments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class TextureRuntime {
|
|||
|
||||
public:
|
||||
explicit TextureRuntime(const Instance& instance, Scheduler& scheduler,
|
||||
RenderManager& render_manager, DescriptorUpdateQueue& update_queue,
|
||||
RenderManager& renderpass_cache, DescriptorUpdateQueue& update_queue,
|
||||
u32 num_swapchain_images);
|
||||
~TextureRuntime();
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
}
|
||||
|
||||
RenderManager& GetRenderpassCache() {
|
||||
return render_manager;
|
||||
return renderpass_cache;
|
||||
}
|
||||
|
||||
/// Returns the removal threshold ticks for the garbage collector
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
private:
|
||||
const Instance& instance;
|
||||
Scheduler& scheduler;
|
||||
RenderManager& render_manager;
|
||||
RenderManager& renderpass_cache;
|
||||
BlitHelper blit_helper;
|
||||
StreamBuffer upload_buffer;
|
||||
StreamBuffer download_buffer;
|
||||
|
|
Loading…
Reference in a new issue