From 5f3e4a5d0e7214f9124d51fb8a31a03d0002c687 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Apr 2020 22:24:41 +0200 Subject: [PATCH] - did a bit of cleanup on DFrameBuffer, most notably taking GetCaps out of it. With the old softpoly renderer and OpenGL 2.x being gone there is no more need for such complex handling, it is now a single function in d_main.cpp. --- src/d_main.cpp | 32 +++++++++++++++- src/gameconfigfile.h | 2 +- src/rendering/gl/system/gl_framebuffer.cpp | 17 --------- src/rendering/gl/system/gl_framebuffer.h | 1 - .../polyrenderer/backend/poly_framebuffer.cpp | 16 -------- .../polyrenderer/backend/poly_framebuffer.h | 1 - src/rendering/swrenderer/drawers/r_draw.cpp | 4 +- src/rendering/v_framebuffer.cpp | 38 ------------------- src/rendering/v_video.h | 8 +--- .../vulkan/system/vk_framebuffer.cpp | 17 --------- src/rendering/vulkan/system/vk_framebuffer.h | 1 - src/scripting/vmthunks.cpp | 10 +++++ 12 files changed, 45 insertions(+), 102 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 5d7f8f19e..b2179d9fd 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -802,6 +802,36 @@ CVAR (Flag, compat_railing, compatflags2, COMPATF2_RAILING); CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +EXTERN_CVAR(Bool, r_drawvoxels) +EXTERN_CVAR(Int, gl_tonemap) +static uint32_t GetCaps() +{ + ActorRenderFeatureFlags FlagSet; + if (!V_IsHardwareRenderer()) + { + FlagSet = RFF_UNCLIPPEDTEX; + + if (V_IsTrueColor()) + FlagSet |= RFF_TRUECOLOR; + else + FlagSet |= RFF_COLORMAP; + + } + else + { + // describe our basic feature set + FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS | + RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP; + + if (gl_tonemap != 5) // not running palette tonemap shader + FlagSet |= RFF_TRUECOLOR; + } + + if (r_drawvoxels) + FlagSet |= RFF_VOXELS; + return (uint32_t)FlagSet; +} + //========================================================================== // // D_Display @@ -830,7 +860,7 @@ void D_Display () cycles.Clock(); r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call - r_renderercaps = screen->GetCaps(); // [SP] Get the current capabilities of the renderer + r_renderercaps = GetCaps(); // [SP] Get the current capabilities of the renderer if (players[consoleplayer].camera == NULL) { diff --git a/src/gameconfigfile.h b/src/gameconfigfile.h index 9ef468489..88f5fe30e 100644 --- a/src/gameconfigfile.h +++ b/src/gameconfigfile.h @@ -63,7 +63,7 @@ protected: private: void SetRavenDefaults (bool isHexen); - void ReadCVars (uint32_t flags); + void ReadCVars (unsigned flags); bool bModSetup; diff --git a/src/rendering/gl/system/gl_framebuffer.cpp b/src/rendering/gl/system/gl_framebuffer.cpp index 9f3210f68..f435058b1 100644 --- a/src/rendering/gl/system/gl_framebuffer.cpp +++ b/src/rendering/gl/system/gl_framebuffer.cpp @@ -241,23 +241,6 @@ void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function 0) ret[0].SetInt(viewwindowx); - if (numret > 1) ret[1].SetInt(viewwindowy); - if (numret > 2) ret[2].SetInt(viewwidth); - if (numret > 3) ret[3].SetInt(viewheight); - return MIN(numret, 4); -} //========================================================================== // diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index e40d919f1..dc51af906 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -102,14 +102,9 @@ inline bool V_IsSoftwareRenderer() return vid_rendermode < 2; } -inline bool V_IsPolyRenderer() -{ - return vid_rendermode == 2 || vid_rendermode == 3; -} - inline bool V_IsTrueColor() { - return vid_rendermode == 1 || vid_rendermode == 3 || vid_rendermode == 4; + return vid_rendermode == 1 || vid_rendermode == 4; } @@ -270,7 +265,6 @@ public: // Report a game restart void SetClearColor(int color); - virtual uint32_t GetCaps(); virtual int Backend() { return 0; } virtual const char* DeviceName() const { return "Unknown"; } virtual void AmbientOccludeScene(float m5) {} diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index cabc62b3c..edd5b6b95 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -356,23 +356,6 @@ void VulkanFrameBuffer::PostProcessScene(bool swscene, int fixedcm, const std::f mPostprocess->PostProcessScene(fixedcm, afterBloomDrawEndScene2D); } -uint32_t VulkanFrameBuffer::GetCaps() -{ - if (!V_IsHardwareRenderer()) - return Super::GetCaps(); - - // describe our basic feature set - ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS | - RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP; - if (r_drawvoxels) - FlagSet |= RFF_VOXELS; - - if (gl_tonemap != 5) // not running palette tonemap shader - FlagSet |= RFF_TRUECOLOR; - - return (uint32_t)FlagSet; -} - const char* VulkanFrameBuffer::DeviceName() const { const auto &props = device->PhysicalDevice.Properties; diff --git a/src/rendering/vulkan/system/vk_framebuffer.h b/src/rendering/vulkan/system/vk_framebuffer.h index 9acc4c70f..707880599 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.h +++ b/src/rendering/vulkan/system/vk_framebuffer.h @@ -74,7 +74,6 @@ public: void PrecacheMaterial(FMaterial *mat, int translation) override; void UpdatePalette() override; - uint32_t GetCaps() override; const char* DeviceName() const override; int Backend() override { return 1; } void SetTextureFilterMode() override; diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 497feba3e..d95a0c157 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -3300,6 +3300,16 @@ DEFINE_ACTION_FUNCTION(DObject, S_ChangeMusic) } +DEFINE_ACTION_FUNCTION(_Screen, GetViewWindow) +{ + PARAM_PROLOGUE; + if (numret > 0) ret[0].SetInt(viewwindowx); + if (numret > 1) ret[1].SetInt(viewwindowy); + if (numret > 2) ret[2].SetInt(viewwidth); + if (numret > 3) ret[3].SetInt(viewheight); + return MIN(numret, 4); +} + //========================================================================== // //