From 211f8a6b11789e2157a0925396cb2093f5452ae1 Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Thu, 14 Sep 2017 02:58:13 +0200 Subject: [PATCH] only allow changing to use single/multiple texture units at restart --- src/engine/client/backend_sdl.cpp | 11 ++++++----- src/engine/client/backend_sdl.h | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 5abe7e6bb..a87766187 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -513,7 +513,7 @@ void CCommandProcessorFragment_OpenGL3_3::SetState(const CCommandBuffer::SState { int Slot = State.m_Texture % m_MaxTextureUnits; - if(g_Config.m_GfxEnableTextureUnitOptimization) + if(m_UseMultipleTextureUnits) { if(!IsAndUpdateTextureSlotBound(Slot, State.m_Texture)) { @@ -581,7 +581,8 @@ void CCommandProcessorFragment_OpenGL3_3::SetState(const CCommandBuffer::SState void CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand) { - if(!g_Config.m_GfxEnableTextureUnitOptimization) + m_UseMultipleTextureUnits = g_Config.m_GfxEnableTextureUnitOptimization; + if(!m_UseMultipleTextureUnits) { glActiveTexture(GL_TEXTURE0); } @@ -842,7 +843,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Shutdown(const SCommand_Shutdown * void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand) { - if(g_Config.m_GfxEnableTextureUnitOptimization) + if(m_UseMultipleTextureUnits) { int Slot = pCommand->m_Slot % m_MaxTextureUnits; //just tell, that we using this texture now @@ -858,7 +859,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Update(const CCommandBuffe void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand) { int Slot = 0; - if(g_Config.m_GfxEnableTextureUnitOptimization) + if(m_UseMultipleTextureUnits) { Slot = pCommand->m_Slot % m_MaxTextureUnits; IsAndUpdateTextureSlotBound(Slot, pCommand->m_Slot); @@ -925,7 +926,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Create(const CCommandBuffe } #endif int Slot = 0; - if(g_Config.m_GfxEnableTextureUnitOptimization) + if(m_UseMultipleTextureUnits) { Slot = pCommand->m_Slot % m_MaxTextureUnits; //just tell, that we using this texture now diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h index a2f77e980..fb5a76e0a 100644 --- a/src/engine/client/backend_sdl.h +++ b/src/engine/client/backend_sdl.h @@ -128,6 +128,8 @@ class CGLSLBorderTileLineProgram; // takes care of opengl 3.2 related rendering class CCommandProcessorFragment_OpenGL3_3 { + bool m_UseMultipleTextureUnits; + struct CTexture { GLuint m_Tex;