From b106f72741faf1f8061386369991026e283742b4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 20 Jun 2018 22:18:31 +0200 Subject: [PATCH] - don't route calls to FMaterial::FlushAll through the framebuffer interface. --- src/gl/renderer/gl_renderer.cpp | 19 ++++--------------- src/gl/renderer/gl_renderer.h | 1 - src/gl/system/gl_framebuffer.cpp | 5 ----- src/gl/system/gl_framebuffer.h | 1 - src/hwrenderer/utility/hw_cvars.cpp | 5 +++-- src/posix/sdl/sdlglvideo.cpp | 1 - src/r_utility.cpp | 2 +- src/textures/hires/hqresize.cpp | 7 ++++--- src/v_video.h | 1 - src/win32/win32gliface.cpp | 1 - 10 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index f442c882c..6029c5139 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -236,17 +236,6 @@ void FGLRenderer::SetupLevel() // //=========================================================================== -void FGLRenderer::FlushTextures() -{ - FMaterial::FlushAll(); -} - -//=========================================================================== -// -// -// -//=========================================================================== - bool FGLRenderer::StartOffscreen() { bool firstBind = (mFBID == 0); @@ -372,7 +361,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i bounds.width = width; bounds.height = height; - // if GLRenderer->mVBO is persistently mapped we must be sure the GPU finished reading from it before we fill it with new data. + // if mVBO is persistently mapped we must be sure the GPU finished reading from it before we fill it with new data. glFinish(); // Switch to render buffers dimensioned for the savepic @@ -411,9 +400,9 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i void FGLRenderer::BeginFrame() { - buffersActive = GLRenderer->mScreenBuffers->Setup(screen->mScreenViewport.width, screen->mScreenViewport.height, screen->mSceneViewport.width, screen->mSceneViewport.height); + buffersActive = mScreenBuffers->Setup(screen->mScreenViewport.width, screen->mScreenViewport.height, screen->mSceneViewport.width, screen->mSceneViewport.height); if (buffersActive) - buffersActive = GLRenderer->mSaveBuffers->Setup(SAVEPICWIDTH, SAVEPICHEIGHT, SAVEPICWIDTH, SAVEPICHEIGHT); + buffersActive = mSaveBuffers->Setup(SAVEPICWIDTH, SAVEPICHEIGHT, SAVEPICWIDTH, SAVEPICHEIGHT); } //=========================================================================== @@ -606,7 +595,7 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer) } glDisable(GL_SCISSOR_TEST); - gl_RenderState.SetVertexBuffer(GLRenderer->mVBO); + gl_RenderState.SetVertexBuffer(mVBO); gl_RenderState.EnableTexture(true); gl_RenderState.EnableBrightmap(true); gl_RenderState.SetTextureMode(TM_MODULATE); diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index 2d3f1ae33..71368e644 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -123,7 +123,6 @@ public: void ClearBorders(); - void FlushTextures(); void SetupLevel(); void ResetSWScene(); diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 8b5f5acfc..da71df30c 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -361,11 +361,6 @@ void OpenGLFrameBuffer::UnbindTexUnit(int no) FHardwareTexture::Unbind(no); } -void OpenGLFrameBuffer::FlushTextures() -{ - if (GLRenderer) GLRenderer->FlushTextures(); -} - void OpenGLFrameBuffer::TextureFilterChanged() { if (GLRenderer != NULL && GLRenderer->mSamplerManager != NULL) GLRenderer->mSamplerManager->SetTextureFilterMode(); diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index d6f416d5e..dd002c929 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -37,7 +37,6 @@ public: IHardwareTexture *CreateHardwareTexture(FTexture *tex) override; FModelRenderer *CreateModelRenderer(int mli) override; void UnbindTexUnit(int no) override; - void FlushTextures() override; void TextureFilterChanged() override; void BeginFrame() override; void SetViewportRects(IntRect *bounds) override; diff --git a/src/hwrenderer/utility/hw_cvars.cpp b/src/hwrenderer/utility/hw_cvars.cpp index 26c061de7..c849e62d5 100644 --- a/src/hwrenderer/utility/hw_cvars.cpp +++ b/src/hwrenderer/utility/hw_cvars.cpp @@ -25,6 +25,7 @@ #include "c_dispatch.h" #include "v_video.h" #include "hw_cvars.h" +#include "hwrenderer/textures/hw_material.h" #include "menu/menu.h" @@ -91,7 +92,7 @@ CUSTOM_CVAR(Float,gl_texture_filter_anisotropic,8.0f,CVAR_ARCHIVE|CVAR_GLOBALCON CCMD(gl_flush) { - screen->FlushTextures(); + FMaterial::FlushAll(); } CUSTOM_CVAR(Int, gl_texture_filter, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) @@ -102,7 +103,7 @@ CUSTOM_CVAR(Int, gl_texture_filter, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINI CUSTOM_CVAR(Bool, gl_texture_usehires, true, CVAR_ARCHIVE|CVAR_NOINITCALL) { - screen->FlushTextures(); + FMaterial::FlushAll(); } CVAR(Bool, gl_precache, false, CVAR_ARCHIVE) diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 83f0b1bae..4e7e0fbec 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -111,7 +111,6 @@ SDLGLVideo::SDLGLVideo (int parm) SDLGLVideo::~SDLGLVideo () { - if (GLRenderer != NULL) GLRenderer->FlushTextures(); } DFrameBuffer *SDLGLVideo::CreateFrameBuffer () diff --git a/src/r_utility.cpp b/src/r_utility.cpp index fc1aff738..02188cad3 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -1030,7 +1030,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor double angx = cos(radPitch); double angy = sin(radPitch) * level.info->pixelstretch; double alen = sqrt(angx*angx + angy*angy); - viewpoint.HWAngles.Pitch = (float)RAD2DEG(asin(angy / alen)); + viewpoint.HWAngles.Pitch = RAD2DEG((float)asin(angy / alen)); viewpoint.HWAngles.Roll.Degrees = viewpoint.Angles.Roll.Degrees; // copied for convenience. diff --git a/src/textures/hires/hqresize.cpp b/src/textures/hires/hqresize.cpp index eb121ced8..ccd025856 100644 --- a/src/textures/hires/hqresize.cpp +++ b/src/textures/hires/hqresize.cpp @@ -43,6 +43,7 @@ #include "xbr/xbrz.h" #include "xbr/xbrz_old.h" #include "parallel_for.h" +#include "hwrenderer/textures/hw_material.h" CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { @@ -56,18 +57,18 @@ CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR if (self == 8) self = 10; if (self == 9) self = 6; #endif - screen->FlushTextures(); + FMaterial::FlushAll(); } CUSTOM_CVAR(Int, gl_texture_hqresize_maxinputsize, 512, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { if (self > 1024) self = 1024; - screen->FlushTextures(); + FMaterial::FlushAll(); } CUSTOM_CVAR(Int, gl_texture_hqresize_targets, 7, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { - screen->FlushTextures(); + FMaterial::FlushAll(); } CVAR (Flag, gl_texture_hqresize_textures, gl_texture_hqresize_targets, 1); diff --git a/src/v_video.h b/src/v_video.h index 72208ec42..de16b85eb 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -419,7 +419,6 @@ public: virtual IHardwareTexture *CreateHardwareTexture(FTexture *tex) { return nullptr; } virtual FModelRenderer *CreateModelRenderer(int mli) { return nullptr; } virtual void UnbindTexUnit(int no) {} - virtual void FlushTextures() {} virtual void TextureFilterChanged() {} virtual void BeginFrame() {} diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index dd9c360b5..c8fc87ffb 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -155,7 +155,6 @@ Win32GLVideo::Win32GLVideo(int parm) Win32GLVideo::~Win32GLVideo() { - if (GLRenderer != NULL) GLRenderer->FlushTextures(); } //==========================================================================