diff --git a/src/rendering/gl/system/gl_framebuffer.cpp b/src/rendering/gl/system/gl_framebuffer.cpp index 961f807fe..7d99c3751 100644 --- a/src/rendering/gl/system/gl_framebuffer.cpp +++ b/src/rendering/gl/system/gl_framebuffer.cpp @@ -514,6 +514,11 @@ void OpenGLFrameBuffer::UpdatePalette() GLRenderer->ClearTonemapPalette(); } +FRenderState* OpenGLFrameBuffer::RenderState() +{ + return &gl_RenderState; +} + //=========================================================================== // diff --git a/src/rendering/gl/system/gl_framebuffer.h b/src/rendering/gl/system/gl_framebuffer.h index ec780dd38..c8663a997 100644 --- a/src/rendering/gl/system/gl_framebuffer.h +++ b/src/rendering/gl/system/gl_framebuffer.h @@ -27,6 +27,7 @@ public: void InitializeState() override; void Update() override; + FRenderState* RenderState() override; void CleanForRestart() override; void UpdatePalette() override; uint32_t GetCaps() override; diff --git a/src/rendering/polyrenderer/backend/poly_framebuffer.cpp b/src/rendering/polyrenderer/backend/poly_framebuffer.cpp index e82a32cb1..b452e7924 100644 --- a/src/rendering/polyrenderer/backend/poly_framebuffer.cpp +++ b/src/rendering/polyrenderer/backend/poly_framebuffer.cpp @@ -530,6 +530,12 @@ void PolyFrameBuffer::CleanForRestart() swdrawer.reset(); } +FRenderState* PolyFrameBuffer::RenderState() +{ + return mRenderState.get(); +} + + void PolyFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation) { if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return; diff --git a/src/rendering/polyrenderer/backend/poly_framebuffer.h b/src/rendering/polyrenderer/backend/poly_framebuffer.h index 025f14a96..776d86412 100644 --- a/src/rendering/polyrenderer/backend/poly_framebuffer.h +++ b/src/rendering/polyrenderer/backend/poly_framebuffer.h @@ -35,6 +35,7 @@ public: void InitializeState() override; + FRenderState* RenderState() override; void CleanForRestart() override; void PrecacheMaterial(FMaterial *mat, int translation) override; void UpdatePalette() override; diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index cdfbb7594..d7d9d7e05 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -67,6 +67,7 @@ class FLightBuffer; struct HWDrawInfo; class FMaterial; class FGameTexture; +class FRenderState; enum EHWCaps { @@ -270,6 +271,7 @@ public: virtual void BeginFrame() {} virtual void SetWindowSize(int w, int h) {} virtual void StartPrecaching() {} + virtual FRenderState* RenderState() { return nullptr; } virtual int GetClientWidth() = 0; virtual int GetClientHeight() = 0; diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index fa3a1a127..0c7b9a0e7 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -584,7 +584,7 @@ void VulkanFrameBuffer::DrawScene(HWDrawInfo *di, int drawmode) } GetRenderState()->SetDepthMask(true); - if (!gl_no_skyclear) screen->mPortalState->RenderFirstSkyPortal(recursion, di, *GetRenderState()); + if (!gl_no_skyclear) mPortalState->RenderFirstSkyPortal(recursion, di, *GetRenderState()); di->RenderScene(*GetRenderState()); @@ -995,3 +995,8 @@ void VulkanFrameBuffer::UpdateShadowMap() { mPostprocess->UpdateShadowMap(); } + +FRenderState* VulkanFrameBuffer::RenderState() +{ + return mRenderState.get(); +} diff --git a/src/rendering/vulkan/system/vk_framebuffer.h b/src/rendering/vulkan/system/vk_framebuffer.h index 7ab7c6bc6..5535f1e8a 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.h +++ b/src/rendering/vulkan/system/vk_framebuffer.h @@ -35,6 +35,7 @@ public: VkRenderState *GetRenderState() { return mRenderState.get(); } VkPostprocess *GetPostprocess() { return mPostprocess.get(); } VkRenderBuffers *GetBuffers() { return mActiveRenderBuffers; } + FRenderState* RenderState() override; void FlushCommands(bool finish, bool lastsubmit = false);