Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -82,17 +82,17 @@ showsky = true nos3tc = false + +; Linux only: Set the driconf force_s3tc_enable option at startup, +; for compressed texture support. Irrelevant is nos3tc is true +force_s3tc_enable = true + noautomipmap = true novbo = false -noframebufferobject = false ; Disable hardware cursors nohwcursor = false -; Linux only: Set the driconf force_s3tc_enable option at startup, -; for compressed texture support -force_s3tc_enable = true - ; Specify the render path. This can be one of: ; default Automatically select one of the below, depending on system capabilities ; fixed Only use OpenGL fixed function pipeline Index: binaries/data/mods/mod/hwdetect/hwdetect.js =================================================================== --- binaries/data/mods/mod/hwdetect/hwdetect.js +++ binaries/data/mods/mod/hwdetect/hwdetect.js @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -354,29 +354,40 @@ Engine.SetDisableAudio(output.disable_audio); if (output.disable_s3tc !== undefined) - Engine.SetDisableS3TC(output.disable_s3tc); + Engine.ConfigDB_CreateValue("system", "nos3tc", output.disable_s3tc); if (output.disable_shadows !== undefined) - Engine.SetDisableShadows(output.disable_shadows); + Engine.ConfigDB_CreateValue("system", "shadows", !output.disable_shadows); if (output.disable_shadowpcf !== undefined) - Engine.SetDisableShadowPCF(output.disable_shadowpcf); + Engine.ConfigDB_CreateValue("system", "shadowpcf", !output.disable_shadowpcf); if (output.disable_allwater !== undefined) - Engine.SetDisableAllWater(output.disable_allwater); + { + Engine.ConfigDB_CreateValue("system", "watereffects", !output.disable_allwater); + Engine.ConfigDB_CreateValue("system", "waterfancyeffects", !output.disable_allwater); + Engine.ConfigDB_CreateValue("system", "waterrealdepth", !output.disable_allwater); + Engine.ConfigDB_CreateValue("system", "watershadows", !output.disable_allwater); + Engine.ConfigDB_CreateValue("system", "waterrefraction", !output.disable_allwater); + Engine.ConfigDB_CreateValue("system", "waterreflection", !output.disable_allwater); + } if (output.disable_fancywater !== undefined) - Engine.SetDisableFancyWater(output.disable_fancywater); + { + Engine.ConfigDB_CreateValue("system", "waterfancyeffects", !output.disable_fancywater); + Engine.ConfigDB_CreateValue("system", "waterrealdepth", !output.disable_fancywater); + Engine.ConfigDB_CreateValue("system", "watershadows", !output.disable_fancywater); + } if (output.enable_glsl !== undefined) - Engine.SetEnableGLSL(output.enable_glsl); + Engine.ConfigDB_CreateValue("system", "preferglsl", output.enable_glsl); if (output.enable_postproc !== undefined) - Engine.SetEnablePostProc(output.enable_postproc); + Engine.ConfigDB_CreateValue("system", "postproc", output.enable_postproc); if (output.enable_smoothlos !== undefined) - Engine.SetEnableSmoothLOS(output.enable_smoothlos); + Engine.ConfigDB_CreateValue("system", "smoothlos", output.enable_smoothlos); if (output.override_renderpath !== undefined) - Engine.SetRenderPath(output.override_renderpath); + Engine.ConfigDB_CreateValue("system", "renderpath", output.override_renderpath); }; Index: source/ps/GameSetup/Config.h =================================================================== --- source/ps/GameSetup/Config.h +++ source/ps/GameSetup/Config.h @@ -20,63 +20,10 @@ #include "ps/CStr.h" - -//----------------------------------------------------------------------------- -// prevent various OpenGL features from being used. this allows working -// around issues like buggy drivers. - -// when loading S3TC-compressed texture files, do not pass them directly to -// OpenGL; instead, decompress them via software to regular textures. -// (necessary on JW's S3 laptop graphics card -- oh, the irony) -extern bool g_NoGLS3TC; - -// do not ask OpenGL to create mipmaps; instead, generate them in software -// and upload them all manually. (potentially helpful for PT's system, where -// Mesa falsely reports full S3TC support but isn't able to generate mipmaps -// for them) -extern bool g_NoGLAutoMipmap; - -// don't use VBOs. (RC: that was necessary on laptop Radeon cards) -extern bool g_NoGLVBO; - -//----------------------------------------------------------------------------- - // flag to pause the game on window focus loss extern bool g_PauseOnFocusLoss; -// If disabled, force the use of the fixed function for rendering water. -extern bool g_WaterEffects; -// Add foam and waves near the shores, trails following ships, and other HQ things. -extern bool g_WaterFancyEffects; -// Use real depth for water rendering. -extern bool g_WaterRealDepth; -// Use a real refraction map and not transparency. -extern bool g_WaterRefraction; -// Use a real reflection map and not a skybox texture. -extern bool g_WaterReflection; -// Enable on-water shadows. -extern bool g_WaterShadows; - -// flag to switch on particles rendering -extern bool g_Particles; -// flag to switch on fog -extern bool g_Fog; -// flag to switch on unit silhouettes -extern bool g_Silhouettes; -// flag to switch on sky rendering -extern bool g_ShowSky; - -// Prefer GLSL shaders over ARB shaders -extern bool g_PreferGLSL; -// Use screen-space postprocessing filters (HDR, bloom, DOF, etc) -extern bool g_PostProc; -// Use smooth LOS interpolation -extern bool g_SmoothLOS; - extern float g_Gamma; -// name of configured render path (depending on OpenGL extensions, this may not be -// the render path that is actually in use right now) -extern CStr g_RenderPath; extern int g_xres, g_yres; extern float g_GuiScale; Index: source/ps/GameSetup/Config.cpp =================================================================== --- source/ps/GameSetup/Config.cpp +++ source/ps/GameSetup/Config.cpp @@ -31,32 +31,10 @@ CStrW g_CursorName = g_DefaultCursor; -bool g_NoGLS3TC = false; -bool g_NoGLAutoMipmap = false; -bool g_NoGLVBO = false; - bool g_PauseOnFocusLoss = false; -bool g_WaterEffects = true; -bool g_WaterFancyEffects = false; -bool g_WaterRealDepth = false; -bool g_WaterRefraction = false; -bool g_WaterReflection = false; -bool g_WaterShadows = false; - -bool g_Particles = false; -bool g_Fog = true; -bool g_Silhouettes = false; -bool g_ShowSky = false; - -bool g_PreferGLSL = false; -bool g_PostProc = false; -bool g_SmoothLOS = false; - float g_Gamma = 1.0f; -CStr g_RenderPath = "default"; - int g_xres, g_yres; float g_GuiScale = 1.0f; bool g_VSync = false; @@ -84,26 +62,8 @@ { CFG_GET_VAL("vsync", g_VSync); - CFG_GET_VAL("nos3tc", g_NoGLS3TC); - CFG_GET_VAL("noautomipmap", g_NoGLAutoMipmap); - CFG_GET_VAL("novbo", g_NoGLVBO); CFG_GET_VAL("pauseonfocusloss", g_PauseOnFocusLoss); - CFG_GET_VAL("watereffects", g_WaterEffects); - CFG_GET_VAL("waterfancyeffects", g_WaterFancyEffects); - CFG_GET_VAL("waterrealdepth", g_WaterRealDepth); - CFG_GET_VAL("waterrefraction", g_WaterRefraction); - CFG_GET_VAL("waterreflection", g_WaterReflection); - CFG_GET_VAL("watershadows", g_WaterShadows); - - CFG_GET_VAL("renderpath", g_RenderPath); - CFG_GET_VAL("particles", g_Particles); - CFG_GET_VAL("fog", g_Fog); - CFG_GET_VAL("silhouettes", g_Silhouettes); - CFG_GET_VAL("showsky", g_ShowSky); - CFG_GET_VAL("preferglsl", g_PreferGLSL); - CFG_GET_VAL("postproc", g_PostProc); - CFG_GET_VAL("smoothlos", g_SmoothLOS); CFG_GET_VAL("gui.scale", g_GuiScale); } Index: source/ps/GameSetup/GameSetup.cpp =================================================================== --- source/ps/GameSetup/GameSetup.cpp +++ source/ps/GameSetup/GameSetup.cpp @@ -570,9 +570,17 @@ { TIMER(L"InitRenderer"); - if(g_NoGLS3TC) - ogl_tex_override(OGL_TEX_S3TC, OGL_TEX_DISABLE); - if(g_NoGLAutoMipmap) + bool nos3tc; + CFG_GET_VAL("nos3tc", nos3tc); + ogl_tex_override(OGL_TEX_S3TC, nos3tc ? OGL_TEX_DISABLE : OGL_TEX_ENABLE); + + bool noGLAutoMipmap; + CFG_GET_VAL("noautomipmap", noGLAutoMipmap); + if (noGLAutoMipmap) + // do not ask OpenGL to create mipmaps; instead, generate them in software + // and upload them all manually. (potentially helpful for PT's system, where + // Mesa falsely reports full S3TC support but isn't able to generate mipmaps + // for them) ogl_tex_override(OGL_TEX_AUTO_MIPMAP_GEN, OGL_TEX_DISABLE); // create renderer @@ -580,39 +588,6 @@ g_RenderingOptions.ReadConfig(); - // set renderer options from command line options - NOVBO must be set before opening the renderer - // and init them in the ConfigDB when needed - g_RenderingOptions.SetNoVBO(g_NoGLVBO); - - g_RenderingOptions.SetWaterEffects(g_WaterEffects); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "watereffects", g_WaterEffects); - g_RenderingOptions.SetWaterFancyEffects(g_WaterFancyEffects); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterfancyeffects", g_WaterFancyEffects); - g_RenderingOptions.SetWaterRealDepth(g_WaterRealDepth); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterrealdepth", g_WaterRealDepth); - g_RenderingOptions.SetWaterReflection(g_WaterReflection); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterreflection", g_WaterReflection); - g_RenderingOptions.SetWaterRefraction(g_WaterRefraction); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterrefraction", g_WaterRefraction); - g_RenderingOptions.SetWaterShadows(g_WaterShadows); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "watershadows", g_WaterShadows); - - g_RenderingOptions.SetRenderPath(RenderPathEnum::FromString(g_RenderPath)); - g_RenderingOptions.SetParticles(g_Particles); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "particles", g_Particles); - g_RenderingOptions.SetFog(g_Fog); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "fog", g_Fog); - g_RenderingOptions.SetSilhouettes(g_Silhouettes); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "silhouettes", g_Silhouettes); - g_RenderingOptions.SetShowSky(g_ShowSky); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "showsky", g_ShowSky); - g_RenderingOptions.SetPreferGLSL(g_PreferGLSL); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "preferglsl", g_PreferGLSL); - g_RenderingOptions.SetPostProc(g_PostProc); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "postproc", g_PostProc); - g_RenderingOptions.SetSmoothLOS(g_SmoothLOS); - g_ConfigDB.SetValueBool(CFG_SYSTEM, "smoothlos", g_SmoothLOS); - // create terrain related stuff new CTerrainTextureManager; Index: source/ps/GameSetup/HWDetect.cpp =================================================================== --- source/ps/GameSetup/HWDetect.cpp +++ source/ps/GameSetup/HWDetect.cpp @@ -130,71 +130,6 @@ g_DisableAudio = disabled; } -void SetDisableS3TC(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) -{ - if (!IsOverridden("nos3tc")) - ogl_tex_override(OGL_TEX_S3TC, disabled ? OGL_TEX_DISABLE : OGL_TEX_ENABLE); -} - -void SetDisableShadows(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) -{ - g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadows", !disabled); -} - -void SetDisableShadowPCF(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) -{ - g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadowpcf", !disabled); -} - -void SetDisableAllWater(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) -{ - if (!IsOverridden("watereffects")) - g_WaterEffects = !disabled; - if (!IsOverridden("waterfancyeffects")) - g_WaterFancyEffects = !disabled; - if (!IsOverridden("waterrealdepth")) - g_WaterRealDepth = !disabled; - if (!IsOverridden("waterrefraction")) - g_WaterRefraction = !disabled; - if (!IsOverridden("waterreflection")) - g_WaterReflection = !disabled; - if (!IsOverridden("watershadows")) - g_WaterShadows = !disabled; -} - -void SetDisableFancyWater(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) -{ - if (!IsOverridden("waterfancyeffects")) - g_WaterFancyEffects = !disabled; - if (!IsOverridden("waterrealdepth")) - g_WaterRealDepth = !disabled; - if (!IsOverridden("watershadows")) - g_WaterShadows = !disabled; -} - -void SetEnableGLSL(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled) -{ - if (!IsOverridden("preferglsl")) - g_PreferGLSL = enabled; -} - -void SetEnablePostProc(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled) -{ - if (!IsOverridden("postproc")) - g_PostProc = enabled; -} - -void SetEnableSmoothLOS(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled) -{ - if (!IsOverridden("smoothlos")) - g_SmoothLOS = enabled; -} - -void SetRenderPath(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& renderpath) -{ - g_RenderPath = renderpath; -} - void RunHardwareDetection() { TIMER(L"RunHardwareDetection"); @@ -204,15 +139,6 @@ JSAutoRequest rq(cx); scriptInterface.RegisterFunction("SetDisableAudio"); - scriptInterface.RegisterFunction("SetDisableS3TC"); - scriptInterface.RegisterFunction("SetDisableShadows"); - scriptInterface.RegisterFunction("SetDisableShadowPCF"); - scriptInterface.RegisterFunction("SetDisableAllWater"); - scriptInterface.RegisterFunction("SetDisableFancyWater"); - scriptInterface.RegisterFunction("SetEnableGLSL"); - scriptInterface.RegisterFunction("SetEnablePostProc"); - scriptInterface.RegisterFunction("SetEnableSmoothLOS"); - scriptInterface.RegisterFunction("SetRenderPath"); // Load the detection script: Index: source/ps/VideoMode.h =================================================================== --- source/ps/VideoMode.h +++ source/ps/VideoMode.h @@ -114,7 +114,6 @@ int m_ConfigBPP; int m_ConfigDisplay; bool m_ConfigFullscreen; - bool m_ConfigForceS3TCEnable; // If we're fullscreen, size/position of window when we were last windowed (or the default window // size/position if we started fullscreen), to support switching back to the old window size/position Index: source/ps/VideoMode.cpp =================================================================== --- source/ps/VideoMode.cpp +++ source/ps/VideoMode.cpp @@ -51,7 +51,7 @@ CVideoMode::CVideoMode() : m_IsFullscreen(false), m_IsInitialised(false), m_Window(NULL), m_PreferredW(0), m_PreferredH(0), m_PreferredBPP(0), m_PreferredFreq(0), - m_ConfigW(0), m_ConfigH(0), m_ConfigBPP(0), m_ConfigFullscreen(false), m_ConfigForceS3TCEnable(true), + m_ConfigW(0), m_ConfigH(0), m_ConfigBPP(0), m_ConfigFullscreen(false), m_WindowedW(DEFAULT_WINDOW_W), m_WindowedH(DEFAULT_WINDOW_H), m_WindowedX(0), m_WindowedY(0) { // (m_ConfigFullscreen defaults to false, so users don't get stuck if @@ -68,7 +68,6 @@ CFG_GET_VAL("yres", m_ConfigH); CFG_GET_VAL("bpp", m_ConfigBPP); CFG_GET_VAL("display", m_ConfigDisplay); - CFG_GET_VAL("force_s3tc_enable", m_ConfigForceS3TCEnable); } bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen) @@ -305,7 +304,10 @@ // so we just unconditionally set it (unless our config file explicitly disables it). #if !(OS_WIN || OS_MACOSX) // (assume Mesa is used for all non-Windows non-Mac platforms) - if (m_ConfigForceS3TCEnable) + bool nos3tc, force_s3tc_enable; + CFG_GET_VAL("nos3tc", nos3tc); + CFG_GET_VAL("force_s3tc_enable", force_s3tc_enable); + if (!nos3tc && force_s3tc_enable) setenv("force_s3tc_enable", "true", 0); #endif } Index: source/renderer/RenderingOptions.cpp =================================================================== --- source/renderer/RenderingOptions.cpp +++ source/renderer/RenderingOptions.cpp @@ -96,12 +96,30 @@ CFG_GET_VAL("shadows", m_Shadows); CFG_GET_VAL("shadowpcf", m_ShadowPCF); - // TODO: be more consistent in use of the config system CFG_GET_VAL("preferglsl", m_PreferGLSL); + CFG_GET_VAL("postproc", m_PostProc); + CFG_GET_VAL("smoothlos", m_SmoothLOS); + + CStr renderPath; + CFG_GET_VAL("renderpath", renderPath); + SetRenderPath(RenderPathEnum::FromString(renderPath)); + + CFG_GET_VAL("watereffects", m_WaterEffects); + CFG_GET_VAL("waterfancyeffects", m_WaterFancyEffects); + CFG_GET_VAL("waterrealdepth", m_WaterRealDepth); + CFG_GET_VAL("waterrefraction", m_WaterRefraction); + CFG_GET_VAL("waterreflection", m_WaterReflection); + CFG_GET_VAL("watershadows", m_WaterShadows); + + CFG_GET_VAL("particles", m_Particles); + CFG_GET_VAL("fog", m_Fog); + CFG_GET_VAL("silhouettes", m_Silhouettes); + CFG_GET_VAL("showsky", m_ShowSky); + + CFG_GET_VAL("novbo", m_NoVBO); + CFG_GET_VAL("forcealphatest", m_ForceAlphaTest); CFG_GET_VAL("gpuskinning", m_GPUSkinning); - CFG_GET_VAL("smoothlos", m_SmoothLOS); - CFG_GET_VAL("postproc", m_PostProc); CFG_GET_VAL("renderactors", m_RenderActors); CStr propRenderPrio;