From fa4934686abf097772a7f546da7c95c6b9466cbf Mon Sep 17 00:00:00 2001 From: Vladislav Mikhalin Date: Wed, 21 Aug 2024 21:08:47 +0300 Subject: [PATCH] Removed the skip for draw calls without RTs --- .../renderer_vulkan/vk_rasterizer.cpp | 23 ------------------- .../renderer_vulkan/vk_rasterizer.h | 1 - .../renderer_vulkan/vk_scheduler.cpp | 11 +++++++-- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 76cfe64a..6cd80393 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -32,10 +32,6 @@ Rasterizer::~Rasterizer() = default; void Rasterizer::Draw(bool is_indexed, u32 index_offset) { RENDERER_TRACE; - if (!HasRenderTargets()) { - return; - } - const auto cmdbuf = scheduler.CommandBuffer(); const auto& regs = liverpool->regs; const GraphicsPipeline* pipeline = pipeline_cache.GetGraphicsPipeline(); @@ -242,25 +238,6 @@ void Rasterizer::UpdateDepthStencilState() { cmdbuf.setDepthBoundsTestEnable(depth.depth_bounds_enable); } -bool Rasterizer::HasRenderTargets() { - const auto& regs = liverpool->regs; - using ZFormat = AmdGpu::Liverpool::DepthBuffer::ZFormat; - using StencilFormat = AmdGpu::Liverpool::DepthBuffer::StencilFormat; - for (auto col_buf_id = 0u; col_buf_id < Liverpool::NumColorBuffers; ++col_buf_id) { - const auto& col_buf = regs.color_buffers[col_buf_id]; - if (col_buf && regs.color_target_mask.GetMask(col_buf_id)) { - return true; - } - } - if (regs.depth_buffer.Address() != 0 && - ((regs.depth_control.depth_enable && regs.depth_buffer.z_info.format != ZFormat::Invalid) || - regs.depth_control.stencil_enable && - regs.depth_buffer.stencil_info.format != StencilFormat::Invalid)) { - return true; - } - return false; -} - void Rasterizer::ScopeMarkerBegin(const std::string_view& str) { if (!Config::isMarkersEnabled()) { return; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 0e2cf4c9..a151ebc2 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -52,7 +52,6 @@ private: void UpdateDynamicState(const GraphicsPipeline& pipeline); void UpdateViewportScissorState(); void UpdateDepthStencilState(); - bool HasRenderTargets(); private: const Instance& instance; diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index 2f205a5c..ef0307ef 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp @@ -29,15 +29,22 @@ void Scheduler::BeginRendering(const RenderState& new_state) { is_rendering = true; render_state = new_state; + const auto witdh = + render_state.width != std::numeric_limits::max() ? render_state.width : 1; + const auto height = + render_state.height != std::numeric_limits::max() ? render_state.height : 1; + const vk::RenderingInfo rendering_info = { .renderArea = { .offset = {0, 0}, - .extent = {render_state.width, render_state.height}, + .extent = {witdh, height}, }, .layerCount = 1, .colorAttachmentCount = render_state.num_color_attachments, - .pColorAttachments = render_state.color_attachments.data(), + .pColorAttachments = render_state.num_color_attachments > 0 + ? render_state.color_attachments.data() + : nullptr, .pDepthAttachment = render_state.has_depth ? &render_state.depth_attachment : nullptr, .pStencilAttachment = render_state.has_stencil ? &render_state.depth_attachment : nullptr, };