From 2196b4fb04dedcec2ba28528397f706710412333 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Apr 2020 23:53:26 +0200 Subject: [PATCH] - moved the frame rate drawer out of DFrameBuffer. Too much of this is not shareable and all it consists of are drawing operations on the 2D drawer. --- src/am_map.cpp | 3 +- src/common/engine/i_interface.h | 1 + src/common/rendering/gl/gl_samplers.cpp | 3 +- .../rendering/hwrenderer/data/hw_vrmodes.cpp | 5 +- src/d_main.cpp | 120 +++++++++++++++++- src/d_main.h | 14 ++ src/p_setup.cpp | 1 + src/playsim/p_user.cpp | 3 +- src/rendering/2d/v_blend.cpp | 1 + src/rendering/hwrenderer/hw_entrypoint.cpp | 1 + src/rendering/hwrenderer/scene/hw_drawinfo.h | 2 + .../hwrenderer/textures/hw_precache.cpp | 1 + src/rendering/hwrenderer/utility/hw_clock.cpp | 3 +- src/rendering/swrenderer/r_swrenderer.cpp | 1 + src/rendering/swrenderer/r_swscene.cpp | 1 + .../swrenderer/textures/r_swtexture.h | 1 + src/rendering/v_framebuffer.cpp | 118 ----------------- src/rendering/v_video.h | 35 ----- src/rendering/vulkan/textures/vk_samplers.cpp | 3 +- 19 files changed, 155 insertions(+), 162 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index d86da9506..02edc6142 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -47,6 +47,7 @@ #include "p_blockmap.h" #include "g_game.h" #include "v_video.h" +#include "d_main.h" #include "m_cheat.h" #include "c_dispatch.h" @@ -2139,7 +2140,7 @@ void DAutomap::drawSubsectors() // is necessary in order to best reproduce Doom's original lighting. double fadelevel; - if (vid_rendermode != 4 || primaryLevel->lightMode == ELightMode::Doom || primaryLevel->lightMode == ELightMode::ZDoomSoftware || primaryLevel->lightMode == ELightMode::DoomSoftware) + if (!V_IsHardwareRenderer() || primaryLevel->lightMode == ELightMode::Doom || primaryLevel->lightMode == ELightMode::ZDoomSoftware || primaryLevel->lightMode == ELightMode::DoomSoftware) { double map = (NUMCOLORMAPS * 2.) - ((floorlight + 12) * (NUMCOLORMAPS / 128.)); fadelevel = clamp((map - 12) / NUMCOLORMAPS, 0.0, 1.0); diff --git a/src/common/engine/i_interface.h b/src/common/engine/i_interface.h index 564b7d91c..cd6a46e67 100644 --- a/src/common/engine/i_interface.h +++ b/src/common/engine/i_interface.h @@ -12,6 +12,7 @@ struct SystemCallbacks void (*CrashInfo)(char* buffer, size_t bufflen, const char* lfstr); void (*PlayStartupSound)(const char* name); bool (*IsSpecialUI)(); + bool (*DisableTextureFilter)(); }; extern SystemCallbacks *sysCallbacks; diff --git a/src/common/rendering/gl/gl_samplers.cpp b/src/common/rendering/gl/gl_samplers.cpp index 12be63e43..1371ec3d1 100644 --- a/src/common/rendering/gl/gl_samplers.cpp +++ b/src/common/rendering/gl/gl_samplers.cpp @@ -41,6 +41,7 @@ #include "gl/renderer/gl_renderer.h" #include "gl_samplers.h" #include "hw_material.h" +#include "i_interface.h" namespace OpenGLRenderer { @@ -98,7 +99,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval) void FSamplerManager::SetTextureFilterMode() { UnbindAll(); - int filter = V_IsHardwareRenderer() ? gl_texture_filter : 0; + int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter() ? 0 : gl_texture_filter; for (int i = 0; i < 4; i++) { diff --git a/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp b/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp index a105f48c2..17bfefaef 100644 --- a/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp +++ b/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp @@ -30,6 +30,7 @@ #include "hw_vrmodes.h" #include "v_video.h" #include "version.h" +#include "i_interface.h" // Set up 3D-specific console variables: CVAR(Int, vr_mode, 0, CVAR_GLOBALCONFIG) @@ -60,7 +61,9 @@ static VRMode vrmi_checker = { 2, isqrt2, isqrt2, 1.f,{ { -.5f, 1.f },{ .5f, 1.f const VRMode *VRMode::GetVRMode(bool toscreen) { #ifdef VR3D_ENABLED - switch (toscreen && vid_rendermode == 4 ? vr_mode : 0) + int mode = !toscreen || (sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()) ? 0 : vr_mode; + + switch (mode) { default: case VR_MONO: diff --git a/src/d_main.cpp b/src/d_main.cpp index b2179d9fd..0609b9d60 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -182,6 +182,7 @@ EXTERN_CVAR (Bool, sv_cheats) EXTERN_CVAR (Bool, sv_unlimited_pickup) EXTERN_CVAR (Bool, r_drawplayersprites) EXTERN_CVAR (Bool, show_messages) +EXTERN_CVAR(Bool, ticker) extern bool setmodeneeded; extern bool demorecording; @@ -260,6 +261,8 @@ CVAR (Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBAL CVAR (Bool, autoloadbrightmaps, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) CVAR (Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) CVAR (Bool, r_debug_disable_vis_filter, false, 0) +CVAR(Bool, vid_fps, false, 0) +CVAR(Int, vid_showpalette, 0, 0) bool hud_toggled = false; bool wantToRestart; @@ -832,6 +835,111 @@ static uint32_t GetCaps() return (uint32_t)FlagSet; } +//========================================================================== +// +// +// +//========================================================================== + +static void DrawPaletteTester(int paletteno) +{ + int blocksize = screen->GetHeight() / 50; + + int t = paletteno; + int k = 0; + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + PalEntry pe; + if (t > 1) + { + auto palette = GPalette.GetTranslation(TRANSLATION_Standard, t - 2)->Palette; + pe = palette[k]; + } + else GPalette.BaseColors[k]; + k++; + Dim(twod, pe, 1.f, j * blocksize, i * blocksize, blocksize, blocksize); + } + } +} + +//========================================================================== +// +// DFrameBuffer :: DrawRateStuff +// +// Draws the fps counter, dot ticker, and palette debug. +// +//========================================================================== +uint64_t LastCount; + +static void DrawRateStuff() +{ + static uint64_t LastMS = 0, LastSec = 0, FrameCount = 0, LastTic = 0; + + // Draws frame time and cumulative fps + if (vid_fps) + { + uint64_t ms = screen->FrameTime; + uint64_t howlong = ms - LastMS; + if ((signed)howlong >= 0) + { + char fpsbuff[40]; + int chars; + int rate_x; + + int textScale = active_con_scale(twod); + + chars = mysnprintf(fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)howlong, (unsigned long long)LastCount); + rate_x = screen->GetWidth() / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]); + ClearRect(twod, rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, GPalette.BlackIndex, 0); + DrawText(twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char*)&fpsbuff[0], + DTA_VirtualWidth, screen->GetWidth() / textScale, + DTA_VirtualHeight, screen->GetHeight() / textScale, + DTA_KeepRatio, true, TAG_DONE); + + uint32_t thisSec = (uint32_t)(ms / 1000); + if (LastSec < thisSec) + { + LastCount = FrameCount / (thisSec - LastSec); + LastSec = thisSec; + FrameCount = 0; + } + FrameCount++; + } + LastMS = ms; + } + + int Height = screen->GetHeight(); + + // draws little dots on the bottom of the screen + if (ticker) + { + int64_t t = I_GetTime(); + int64_t tics = t - LastTic; + + LastTic = t; + if (tics > 20) tics = 20; + + int i; + for (i = 0; i < tics * 2; i += 2) ClearRect(twod, i, Height - 1, i + 1, Height, 255, 0); + for (; i < 20 * 2; i += 2) ClearRect(twod, i, Height - 1, i + 1, Height, 0, 0); + } + + // draws the palette for debugging + if (vid_showpalette) + { + DrawPaletteTester(vid_showpalette); + } +} + +static void End2DAndUpdate() +{ + DrawRateStuff(); + twod->End(); + screen->Update(); +} + //========================================================================== // // D_Display @@ -1016,7 +1124,7 @@ void D_Display () screen->Begin2D(); C_DrawConsole (); M_Drawer (); - screen->End2DAndUpdate (); + End2DAndUpdate (); return; case GS_INTERMISSION: @@ -1089,7 +1197,7 @@ void D_Display () M_Drawer (); // menu is drawn even on top of everything if (!hud_toggled) FStat::PrintStat (twod); - screen->End2DAndUpdate (); + End2DAndUpdate (); } else { @@ -1120,7 +1228,7 @@ void D_Display () done = wiper->Run(1); C_DrawConsole (); // console and M_Drawer (); // menu are drawn even on top of wipes - screen->End2DAndUpdate (); + End2DAndUpdate (); NetUpdate (); // [RH] not sure this is needed anymore } while (!done); delete wiper; @@ -2685,6 +2793,11 @@ static bool System_IsSpecialUI() } +static bool System_DisableTextureFilter() +{ + return !V_IsHardwareRenderer(); +} + //========================================================================== // // DoomSpecificInfo @@ -2890,6 +3003,7 @@ static int D_DoomMain_Internal (void) System_CrashInfo, System_PlayStartupSound, System_IsSpecialUI, + System_DisableTextureFilter, }; sysCallbacks = &syscb; diff --git a/src/d_main.h b/src/d_main.h index ce8d9d778..ad6929422 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -31,6 +31,7 @@ #include "doomtype.h" #include "gametype.h" #include "startupinfo.h" +#include "c_cvars.h" struct event_t; @@ -136,6 +137,19 @@ public: else return 0; } + }; +EXTERN_CVAR(Int, vid_rendermode) + +inline bool V_IsHardwareRenderer() +{ + return vid_rendermode == 4; +} + +inline bool V_IsTrueColor() +{ + return vid_rendermode == 1 || vid_rendermode == 4; +} + #endif diff --git a/src/p_setup.cpp b/src/p_setup.cpp index d65d08ec1..03e2a7a5e 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -79,6 +79,7 @@ #include "animations.h" #include "texturemanager.h" #include "p_lnspec.h" +#include "d_main.h" extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position); diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index 47241679b..f4a4e344d 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -93,6 +93,7 @@ #include "v_video.h" #include "gstrings.h" #include "s_music.h" +#include "d_main.h" static FRandom pr_skullpop ("SkullPop"); @@ -632,7 +633,7 @@ void player_t::SendPitchLimits() const { int uppitch, downpitch; - if (V_IsSoftwareRenderer()) + if (!V_IsHardwareRenderer()) { uppitch = GetSoftPitch(false); downpitch = GetSoftPitch(true); diff --git a/src/rendering/2d/v_blend.cpp b/src/rendering/2d/v_blend.cpp index f654ee39b..9a0f7404c 100644 --- a/src/rendering/2d/v_blend.cpp +++ b/src/rendering/2d/v_blend.cpp @@ -47,6 +47,7 @@ #include "v_palette.h" #include "r_utility.h" #include "hw_cvars.h" +#include "d_main.h" CVAR(Float, underwater_fade_scalar, 1.0f, CVAR_ARCHIVE) // [Nash] user-settable underwater blend intensity CVAR( Float, blood_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Pulled from Skulltag - changed default from 0.5 to 1.0 diff --git a/src/rendering/hwrenderer/hw_entrypoint.cpp b/src/rendering/hwrenderer/hw_entrypoint.cpp index c6c0e15f8..61ebf3c61 100644 --- a/src/rendering/hwrenderer/hw_entrypoint.cpp +++ b/src/rendering/hwrenderer/hw_entrypoint.cpp @@ -40,6 +40,7 @@ #include "hwrenderer/utility/hw_clock.h" #include "flatvertices.h" #include "v_palette.h" +#include "d_main.h" #include "hw_lightbuffer.h" #include "hw_cvars.h" diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.h b/src/rendering/hwrenderer/scene/hw_drawinfo.h index 65d12c56c..e60371674 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.h +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.h @@ -333,3 +333,5 @@ void CleanSWDrawer(); sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen); void WriteSavePic(player_t* player, FileWriter* file, int width, int height); sector_t* RenderView(player_t* player); + + diff --git a/src/rendering/hwrenderer/textures/hw_precache.cpp b/src/rendering/hwrenderer/textures/hw_precache.cpp index 58839f49a..462b34084 100644 --- a/src/rendering/hwrenderer/textures/hw_precache.cpp +++ b/src/rendering/hwrenderer/textures/hw_precache.cpp @@ -38,6 +38,7 @@ #include "v_font.h" #include "texturemanager.h" #include "modelrenderer.h" +#include "d_main.h" EXTERN_CVAR(Bool, gl_precache) diff --git a/src/rendering/hwrenderer/utility/hw_clock.cpp b/src/rendering/hwrenderer/utility/hw_clock.cpp index dff667b1a..f337f6581 100644 --- a/src/rendering/hwrenderer/utility/hw_clock.cpp +++ b/src/rendering/hwrenderer/utility/hw_clock.cpp @@ -154,6 +154,7 @@ ADD_STAT(lightstats) static int printstats; static bool switchfps; static uint64_t waitstart; +extern uint64_t LastCount; EXTERN_CVAR(Bool, vid_fps) void CheckBench() @@ -175,7 +176,7 @@ void CheckBench() AppendRenderTimes(compose); AppendLightStats(compose); //AppendMissingTextureStats(compose); - compose.AppendFormat("%llu fps\n\n", (unsigned long long)screen->GetLastFPS()); + compose.AppendFormat("%llu fps\n\n", (unsigned long long)LastCount); FILE *f = fopen("benchmarks.txt", "at"); if (f != NULL) diff --git a/src/rendering/swrenderer/r_swrenderer.cpp b/src/rendering/swrenderer/r_swrenderer.cpp index e43e43169..5eece9b3f 100644 --- a/src/rendering/swrenderer/r_swrenderer.cpp +++ b/src/rendering/swrenderer/r_swrenderer.cpp @@ -53,6 +53,7 @@ #include "image.h" #include "imagehelpers.h" #include "texturemanager.h" +#include "d_main.h" // [BB] Use ZDoom's freelook limit for the sotfware renderer. // Note: ZDoom's limit is chosen such that the sky is rendered properly. diff --git a/src/rendering/swrenderer/r_swscene.cpp b/src/rendering/swrenderer/r_swscene.cpp index 1f4980368..7a2fc9cb9 100644 --- a/src/rendering/swrenderer/r_swscene.cpp +++ b/src/rendering/swrenderer/r_swscene.cpp @@ -36,6 +36,7 @@ #include "image.h" #include "engineerrors.h" #include "texturemanager.h" +#include "d_main.h" // [RH] Base blending values (for e.g. underwater) int BaseBlendR, BaseBlendG, BaseBlendB; diff --git a/src/rendering/swrenderer/textures/r_swtexture.h b/src/rendering/swrenderer/textures/r_swtexture.h index d44062ea4..83c8f6fc6 100644 --- a/src/rendering/swrenderer/textures/r_swtexture.h +++ b/src/rendering/swrenderer/textures/r_swtexture.h @@ -2,6 +2,7 @@ #include "textures.h" #include "v_video.h" #include "g_levellocals.h" +#include "d_main.h" struct FSoftwareTextureSpan diff --git a/src/rendering/v_framebuffer.cpp b/src/rendering/v_framebuffer.cpp index ede0c1736..c7f120a9c 100644 --- a/src/rendering/v_framebuffer.cpp +++ b/src/rendering/v_framebuffer.cpp @@ -58,36 +58,11 @@ CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); -CVAR(Bool, vid_fps, false, 0) -CVAR(Int, vid_showpalette, 0, 0) -EXTERN_CVAR(Bool, ticker) -EXTERN_CVAR(Float, vid_brightness) -EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Int, vid_maxfps) EXTERN_CVAR(Bool, cl_capfps) EXTERN_CVAR(Int, screenblocks) -//========================================================================== -// -// DCanvas :: CalcGamma -// -//========================================================================== - -void DFrameBuffer::CalcGamma (float gamma, uint8_t gammalookup[256]) -{ - // I found this formula on the web at - // , - // but that page no longer exits. - double invgamma = 1.f / gamma; - int i; - - for (i = 0; i < 256; i++) - { - gammalookup[i] = (uint8_t)(255.0 * pow (i / 255.0, invgamma) + 0.5); - } -} - //========================================================================== // // DFrameBuffer Constructor @@ -117,99 +92,6 @@ void DFrameBuffer::SetSize(int width, int height) m2DDrawer.SetSize(width, height); } -//========================================================================== -// -// -// -//========================================================================== - -void V_DrawPaletteTester(int paletteno) -{ - int blocksize = screen->GetHeight() / 50; - - int t = paletteno; - int k = 0; - for (int i = 0; i < 16; ++i) - { - for (int j = 0; j < 16; ++j) - { - PalEntry pe; - if (t > 1) - { - auto palette = GPalette.GetTranslation(TRANSLATION_Standard, t - 2)->Palette; - pe = palette[k]; - } - else GPalette.BaseColors[k]; - k++; - Dim(twod, pe, 1.f, j*blocksize, i*blocksize, blocksize, blocksize); - } - } -} - -//========================================================================== -// -// DFrameBuffer :: DrawRateStuff -// -// Draws the fps counter, dot ticker, and palette debug. -// -//========================================================================== - -void DFrameBuffer::DrawRateStuff () -{ - // Draws frame time and cumulative fps - if (vid_fps) - { - uint64_t ms = screen->FrameTime; - uint64_t howlong = ms - LastMS; - if ((signed)howlong >= 0) - { - char fpsbuff[40]; - int chars; - int rate_x; - - int textScale = active_con_scale(twod); - - chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)howlong, (unsigned long long)LastCount); - rate_x = Width / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]); - ClearRect (twod, rate_x * textScale, 0, Width, NewConsoleFont->GetHeight() * textScale, GPalette.BlackIndex, 0); - DrawText (twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], - DTA_VirtualWidth, screen->GetWidth() / textScale, - DTA_VirtualHeight, screen->GetHeight() / textScale, - DTA_KeepRatio, true, TAG_DONE); - - uint32_t thisSec = (uint32_t)(ms/1000); - if (LastSec < thisSec) - { - LastCount = FrameCount / (thisSec - LastSec); - LastSec = thisSec; - FrameCount = 0; - } - FrameCount++; - } - LastMS = ms; - } - - // draws little dots on the bottom of the screen - if (ticker) - { - int64_t t = I_GetTime(); - int64_t tics = t - LastTic; - - LastTic = t; - if (tics > 20) tics = 20; - - int i; - for (i = 0; i < tics*2; i += 2) ClearRect(twod, i, Height-1, i+1, Height, 255, 0); - for ( ; i < 20*2; i += 2) ClearRect(twod, i, Height-1, i+1, Height, 0, 0); - } - - // draws the palette for debugging - if (vid_showpalette) - { - V_DrawPaletteTester(vid_showpalette); - } -} - //========================================================================== // // Palette stuff. diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index dc51af906..fd10970e6 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -83,7 +83,6 @@ extern int DisplayWidth, DisplayHeight; void V_UpdateModeSize (int width, int height); void V_OutputResized (int width, int height); -EXTERN_CVAR(Int, vid_rendermode) EXTERN_CVAR(Bool, vid_fullscreen) EXTERN_CVAR(Int, win_x) EXTERN_CVAR(Int, win_y) @@ -91,23 +90,6 @@ EXTERN_CVAR(Int, win_w) EXTERN_CVAR(Int, win_h) EXTERN_CVAR(Bool, win_maximized) - -inline bool V_IsHardwareRenderer() -{ - return vid_rendermode == 4; -} - -inline bool V_IsSoftwareRenderer() -{ - return vid_rendermode < 2; -} - -inline bool V_IsTrueColor() -{ - return vid_rendermode == 1 || vid_rendermode == 4; -} - - struct FColormap; class FileWriter; enum FTextureFormat : uint32_t; @@ -250,13 +232,6 @@ public: } void End2D() { m2DDrawer.End(); } - void End2DAndUpdate() - { - DrawRateStuff(); - m2DDrawer.End(); - Update(); - } - // This is overridable in case Vulkan does it differently. virtual bool RenderTextureIsFlipped() const { @@ -289,14 +264,9 @@ public: void ScaleCoordsFromWindow(int16_t &x, int16_t &y); - uint64_t GetLastFPS() const { return LastCount; } - virtual void Draw2D() {} void Clear2D() { m2DDrawer.Clear(); } - // Calculate gamma table - void CalcGamma(float gamma, uint8_t gammalookup[256]); - virtual void SetViewportRects(IntRect *bounds); int ScreenToWindowX(int x); int ScreenToWindowY(int y); @@ -314,14 +284,9 @@ public: // The original size of the framebuffer as selected in the video menu. uint64_t FrameTime = 0; -protected: - void DrawRateStuff (); - private: uint64_t fpsLimitTime = 0; - uint64_t LastMS = 0, LastSec = 0, FrameCount = 0, LastCount = 0, LastTic = 0; - bool isIn2D = false; }; diff --git a/src/rendering/vulkan/textures/vk_samplers.cpp b/src/rendering/vulkan/textures/vk_samplers.cpp index 23afff2c6..a7b94326a 100644 --- a/src/rendering/vulkan/textures/vk_samplers.cpp +++ b/src/rendering/vulkan/textures/vk_samplers.cpp @@ -29,6 +29,7 @@ #include "vulkan/system/vk_builders.h" #include "vk_samplers.h" #include "hw_material.h" +#include "i_interface.h" struct VkTexFilter { @@ -83,7 +84,7 @@ void VkSamplerManager::SetTextureFilterMode() void VkSamplerManager::Create() { - int filter = V_IsHardwareRenderer() ? gl_texture_filter : 0; + int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()? 0 : gl_texture_filter; for(int i = 0; i < 7; i++) {