From 43665aa7eb7cef67ecf4e9d80f632c3717314117 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 10 Dec 2025 13:00:59 +0100 Subject: [PATCH] Rename `GPUContext::ClearState` to `ResetState` for constentency --- Source/Engine/Graphics/GPUContext.cpp | 2 +- Source/Engine/Graphics/GPUContext.h | 11 ++++++++++- .../GraphicsDevice/DirectX/DX11/GPUContextDX11.cpp | 2 +- .../GraphicsDevice/DirectX/DX11/GPUContextDX11.h | 2 +- .../GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp | 2 +- .../GraphicsDevice/DirectX/DX12/GPUContextDX12.h | 2 +- Source/Engine/GraphicsDevice/Null/GPUContextNull.h | 2 +- .../Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp | 2 +- .../Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h | 2 +- Source/Engine/Renderer/ProbesRenderer.cpp | 4 ++-- Source/Engine/Renderer/Renderer.cpp | 2 +- Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp | 4 ++-- 12 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Source/Engine/Graphics/GPUContext.cpp b/Source/Engine/Graphics/GPUContext.cpp index 55f87ba3b..905919794 100644 --- a/Source/Engine/Graphics/GPUContext.cpp +++ b/Source/Engine/Graphics/GPUContext.cpp @@ -67,7 +67,7 @@ void GPUContext::FrameBegin() void GPUContext::FrameEnd() { - ClearState(); + ResetState(); FlushState(); } diff --git a/Source/Engine/Graphics/GPUContext.h b/Source/Engine/Graphics/GPUContext.h index 4f1306567..5f4bd8020 100644 --- a/Source/Engine/Graphics/GPUContext.h +++ b/Source/Engine/Graphics/GPUContext.h @@ -618,7 +618,16 @@ public: /// /// Clears the context state. /// - API_FUNCTION() virtual void ClearState() = 0; + DEPRECATED("Use ResetState instead") + API_FUNCTION() void ClearState() + { + ResetState(); + } + + /// + /// Resets the context state. + /// + API_FUNCTION() virtual void ResetState() = 0; /// /// Flushes the internal cached context state with a command buffer. diff --git a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.cpp b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.cpp index a0ec80bb1..f623f53b5 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.cpp @@ -724,7 +724,7 @@ void GPUContextDX11::SetState(GPUPipelineState* state) } } -void GPUContextDX11::ClearState() +void GPUContextDX11::ResetState() { if (!_context) return; diff --git a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.h b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.h index 7dc693019..eee2699df 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.h +++ b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUContextDX11.h @@ -158,7 +158,7 @@ public: void SetScissor(const Rectangle& scissorRect) override; GPUPipelineState* GetState() const override; void SetState(GPUPipelineState* state) override; - void ClearState() override; + void ResetState() override; void FlushState() override; void Flush() override; void UpdateBuffer(GPUBuffer* buffer, const void* data, uint32 size, uint32 offset) override; diff --git a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp index 6752a9b8d..98143c7c3 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp @@ -1304,7 +1304,7 @@ void GPUContextDX12::SetState(GPUPipelineState* state) } } -void GPUContextDX12::ClearState() +void GPUContextDX12::ResetState() { if (!_commandList) return; diff --git a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.h b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.h index 4bd1b54a1..51f24f4a6 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.h +++ b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.h @@ -201,7 +201,7 @@ public: void SetScissor(const Rectangle& scissorRect) override; GPUPipelineState* GetState() const override; void SetState(GPUPipelineState* state) override; - void ClearState() override; + void ResetState() override; void FlushState() override; void Flush() override; void UpdateBuffer(GPUBuffer* buffer, const void* data, uint32 size, uint32 offset) override; diff --git a/Source/Engine/GraphicsDevice/Null/GPUContextNull.h b/Source/Engine/GraphicsDevice/Null/GPUContextNull.h index 0ea111d24..22786c157 100644 --- a/Source/Engine/GraphicsDevice/Null/GPUContextNull.h +++ b/Source/Engine/GraphicsDevice/Null/GPUContextNull.h @@ -177,7 +177,7 @@ public: { } - void ClearState() override + void ResetState() override { } diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp index c374bbeed..979ccc0f8 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp @@ -1329,7 +1329,7 @@ void GPUContextVulkan::SetState(GPUPipelineState* state) } } -void GPUContextVulkan::ClearState() +void GPUContextVulkan::ResetState() { ResetRenderTarget(); ResetSR(); diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h index 8ed541089..fa94aa139 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h @@ -193,7 +193,7 @@ public: void SetScissor(const Rectangle& scissorRect) override; GPUPipelineState* GetState() const override; void SetState(GPUPipelineState* state) override; - void ClearState() override; + void ResetState() override; void FlushState() override; void Flush() override; void UpdateBuffer(GPUBuffer* buffer, const void* data, uint32 size, uint32 offset) override; diff --git a/Source/Engine/Renderer/ProbesRenderer.cpp b/Source/Engine/Renderer/ProbesRenderer.cpp index eaf7a53ca..4c0a43cb6 100644 --- a/Source/Engine/Renderer/ProbesRenderer.cpp +++ b/Source/Engine/Renderer/ProbesRenderer.cpp @@ -509,7 +509,7 @@ void ProbesRendererService::OnRender(RenderTask* task, GPUContext* context) // Render frame Renderer::Render(_task); - context->ClearState(); + context->ResetState(); // Copy frame to cube face { @@ -568,7 +568,7 @@ void ProbesRendererService::OnRender(RenderTask* task, GPUContext* context) } // Cleanup - context->ClearState(); + context->ResetState(); if (_workStep < 7) return; // Continue rendering next frame diff --git a/Source/Engine/Renderer/Renderer.cpp b/Source/Engine/Renderer/Renderer.cpp index 278c8237d..7a72cd923 100644 --- a/Source/Engine/Renderer/Renderer.cpp +++ b/Source/Engine/Renderer/Renderer.cpp @@ -200,7 +200,7 @@ void Renderer::Render(SceneRenderTask* task) // Prepare GPU context auto context = GPUDevice::Instance->GetMainContext(); - context->ClearState(); + context->ResetState(); context->FlushState(); const Viewport viewport = task->GetViewport(); context->SetViewportAndScissors(viewport); diff --git a/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp b/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp index a66a0e283..b77ee51b6 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp @@ -376,7 +376,7 @@ void ShadowsOfMordor::Builder::onJobRender(GPUContext* context) EnableLightmapsUsage = _giBounceRunningIndex != 0; // Renderer::Render(_task); - context->ClearState(); + context->ResetState(); // IsRunningRadiancePass = false; EnableLightmapsUsage = true; @@ -515,7 +515,7 @@ void ShadowsOfMordor::Builder::onJobRender(GPUContext* context) } // Cleanup after rendering - context->ClearState(); + context->ResetState(); // Mark job as done Platform::AtomicStore(&_wasJobDone, 1);