From 11dec8e8683ea79b5a95727c4648ce1d63dcf377 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 30 May 2025 15:51:35 +0200 Subject: [PATCH] Fix incorrectly rendered transparency in Physics Colliders view mode #3474 --- Source/Engine/Renderer/ForwardPass.cpp | 12 +++++++++++- Source/Engine/Renderer/ForwardPass.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Renderer/ForwardPass.cpp b/Source/Engine/Renderer/ForwardPass.cpp index 42796764f..caf624609 100644 --- a/Source/Engine/Renderer/ForwardPass.cpp +++ b/Source/Engine/Renderer/ForwardPass.cpp @@ -72,7 +72,7 @@ void ForwardPass::Dispose() _shader = nullptr; } -void ForwardPass::Render(RenderContext& renderContext, GPUTexture* input, GPUTexture* output) +void ForwardPass::Render(RenderContext& renderContext, GPUTexture*& input, GPUTexture*& output) { PROFILE_GPU_CPU("Forward"); auto context = GPUDevice::Instance->GetMainContext(); @@ -91,6 +91,16 @@ void ForwardPass::Render(RenderContext& renderContext, GPUTexture* input, GPUTex // Check if there is no objects to render or no resources ready auto& forwardList = mainCache->DrawCallsLists[(int32)DrawCallsListType::Forward]; auto& distortionList = mainCache->DrawCallsLists[(int32)DrawCallsListType::Distortion]; + if ((forwardList.IsEmpty() && distortionList.IsEmpty()) +#if USE_EDITOR + || renderContext.View.Mode == ViewMode::PhysicsColliders +#endif + ) + { + // Skip rendering + Swap(input, output); + return; + } if (distortionList.IsEmpty() || checkIfSkipPass()) { // Copy frame diff --git a/Source/Engine/Renderer/ForwardPass.h b/Source/Engine/Renderer/ForwardPass.h index 552052eb1..be3126e0e 100644 --- a/Source/Engine/Renderer/ForwardPass.h +++ b/Source/Engine/Renderer/ForwardPass.h @@ -31,7 +31,7 @@ public: /// The rendering context. /// Target with renderer frame ready for further processing. /// The output frame. - void Render(RenderContext& renderContext, GPUTexture* input, GPUTexture* output); + void Render(RenderContext& renderContext, GPUTexture*& input, GPUTexture*& output); private: