From 46af67b5bdedb360bb379fa742ce124cec4e90fd Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Tue, 7 Jul 2026 23:12:45 +0200 Subject: [PATCH] Removes RenderPath We can render the game only with shaders so we don't need to support fixed function pipeline as a separate render path. We only need to know when to warn a user. Fixes #6244 --- binaries/data/config/default.cfg | 5 +-- binaries/data/mods/mod/hwdetect/hwdetect.js | 17 ++++---- binaries/data/mods/mod/hwdetect/test.js | 2 +- source/graphics/ObjectEntry.cpp | 6 +-- source/ps/GameSetup/GameSetup.cpp | 13 ------- source/ps/GameSetup/HWDetect.cpp | 15 ++++++- source/renderer/ModelRenderer.h | 2 +- source/renderer/Renderer.cpp | 21 ---------- source/renderer/Renderer.h | 5 --- source/renderer/RenderingOptions.cpp | 39 ------------------- source/renderer/RenderingOptions.h | 21 ---------- source/renderer/SceneRenderer.cpp | 1 - .../scripting/JSInterface_Renderer.cpp | 6 --- 13 files changed, 27 insertions(+), 126 deletions(-) diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg index 21c30a0531..d774f86536 100644 --- a/binaries/data/config/default.cfg +++ b/binaries/data/config/default.cfg @@ -148,9 +148,6 @@ renderer.backend.vulkan.debugwaitidlebeforeacquire = false renderer.backend.vulkan.debugwaitidlebeforepresent = false renderer.backend.vulkan.debugwaitidleafterpresent = false -; Should not be edited. It's used only for preventing of running fixed pipeline. -renderpath = default - ; (0 - low, 1 - medium, 2 - high), higher quality means worse performance. textures.quality = 2 @@ -172,7 +169,7 @@ pbr.brightness = "0.5" ; Use smooth LOS interpolation smoothlos = true -; Use screen-space postprocessing filters (HDR, bloom, DOF, etc). Incompatible with fixed renderpath. +; Use screen-space postprocessing filters (HDR, bloom, DOF, etc). postproc = true ; Use anti-aliasing techniques. diff --git a/binaries/data/mods/mod/hwdetect/hwdetect.js b/binaries/data/mods/mod/hwdetect/hwdetect.js index 50e53e7f0a..a38a8a7708 100644 --- a/binaries/data/mods/mod/hwdetect/hwdetect.js +++ b/binaries/data/mods/mod/hwdetect/hwdetect.js @@ -166,6 +166,7 @@ function RunDetection(settings) // This function should have no side effects, it should just // set these output properties: + let hardwareSupported = true; // List of warning strings to display to the user // in an ugly GUI dialog box @@ -184,7 +185,6 @@ function RunDetection(settings) var disable_fancywater; var enable_postproc; var enable_smoothlos; - var override_renderpath; // TODO: add some mechanism for setting config values // (overriding default.cfg, but overridden by local.cfg) @@ -289,23 +289,21 @@ function RunDetection(settings) // r300 classic has problems with shader mode, so fall back to non-shader if (os_unix && GL_RENDERER.match(/^Mesa DRI R[123]00 /)) { - override_renderpath = "fixed"; - warnings.push("Some graphics features are disabled, due to bugs in old graphics drivers. Upgrading to a Gallium-based driver might help."); + hardwareSupported = false; } // https://www.wildfiregames.com/forum/index.php?showtopic=15058 // GF FX has poor shader performance, so fall back to non-shader if (GL_RENDERER.match(/^GeForce FX /)) { - override_renderpath = "fixed"; - disable_allwater = true; + hardwareSupported = false; } // https://gitea.wildfiregames.com/0ad/0ad/issues/964 // SiS Mirage 3 drivers apparently crash with shaders, so fall back to non-shader if (os_win && GL_RENDERER.match(/^Mirage Graphics3$/)) { - override_renderpath = "fixed"; + hardwareSupported = false; } return { @@ -319,7 +317,7 @@ function RunDetection(settings) "disable_fancywater": disable_fancywater, "enable_postproc": enable_postproc, "enable_smoothlos": enable_smoothlos, - "override_renderpath": override_renderpath, + "hardwareSupported": hardwareSupported, }; } @@ -327,7 +325,7 @@ global.RunHardwareDetection = function(settings) { // Currently we don't have limitations for other backends than GL. if (settings.renderer_backend.name != 'gl') - return; + return true; // print(JSON.stringify(settings, null, 1)+"\n"); @@ -376,6 +374,5 @@ global.RunHardwareDetection = function(settings) if (output.enable_smoothlos !== undefined) Engine.ConfigDB_CreateValue("hwdetect", "smoothlos", (output.enable_smoothlos).toString()); - if (output.override_renderpath !== undefined) - Engine.ConfigDB_CreateValue("hwdetect", "renderpath", (output.override_renderpath).toString()); + return output.hardwareSupported; }; diff --git a/binaries/data/mods/mod/hwdetect/test.js b/binaries/data/mods/mod/hwdetect/test.js index 54c2d9e3ca..0bb3cb6811 100644 --- a/binaries/data/mods/mod/hwdetect/test.js +++ b/binaries/data/mods/mod/hwdetect/test.js @@ -30,7 +30,7 @@ for (var settings of hwdetectTestData) var os = (settings.os_linux ? "linux" : settings.os_macosx ? "macosx" : settings.os_win ? "win" : "???"); var disabled = []; - for (var d of ["disable_audio", "disable_s3tc", "disable_shadows", "disable_shadowpcf", "disable_allwater", "disable_fancywater", "override_renderpath"]) + for (var d of ["disable_audio", "disable_s3tc", "disable_shadows", "disable_shadowpcf", "disable_allwater", "disable_fancywater", "hardwareSupported"]) if (output[d] !== undefined) disabled.push(d+"="+output[d]); diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index c875265824..5d8f095827 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -96,7 +96,7 @@ bool CObjectEntry::BuildVariation(const std::vector*>& comp ? Renderer::Backend::Sampler::AddressMode::CLAMP_TO_BORDER : Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE); CTexturePtr texture = g_Renderer.GetTextureManager().CreateTexture(textureProps); - // TODO: Should check which renderpath is selected and only preload the necessary textures. + // TODO: Should check which material is selected and only preload the necessary textures. texture->Prefetch(); material.AddSampler(CMaterial::TextureSampler(samp.m_SamplerName, texture)); } @@ -151,7 +151,7 @@ bool CObjectEntry::BuildVariation(const std::vector*>& comp CTexturePtr texture = g_Renderer.GetTextureManager().CreateTexture(textureProps); // if we've loaded this model we're probably going to render it soon, so prefetch its texture. // All textures are prefetched even in the fixed pipeline, including the normal maps etc. - // TODO: Should check which renderpath is selected and only preload the necessary textures. + // TODO: Should check which material is selected and only preload the necessary textures. texture->Prefetch(); material.AddSampler(CMaterial::TextureSampler(samp.m_SamplerName, texture)); } diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index b65b6fe7fc..58f74108fd 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -617,19 +617,6 @@ bool Init(const CmdLineArgs& args, int flags) g_GUI = new CGUIManager{scriptContext, scriptInterface}; - - if (RenderPathEnum::FromString(g_ConfigDB.Get("renderpath", "default"s)) == FIXED) - { - // It doesn't make sense to continue working here, because we're not - // able to display anything. - DEBUG_DISPLAY_FATAL_ERROR( - L"Your graphics card doesn't appear to be fully compatible with OpenGL shaders." - L" The game does not support pre-shader graphics cards." - L" You are advised to try installing newer drivers and/or upgrade your graphics card." - L" For more information, please see http://www.wildfiregames.com/forum/index.php?showtopic=16734" - ); - } - g_RenderingOptions.ReadConfigAndSetupHooks(); // create renderer diff --git a/source/ps/GameSetup/HWDetect.cpp b/source/ps/GameSetup/HWDetect.cpp index 8c6e9122d8..9920638a94 100644 --- a/source/ps/GameSetup/HWDetect.cpp +++ b/source/ps/GameSetup/HWDetect.cpp @@ -478,5 +478,18 @@ void RunHardwareDetection(bool writeSystemInfoBeforeDetection, Renderer::Backend // Run the detection script: JS::RootedValue global(rq.cx, rq.globalValue()); - Script::Function::CallVoid(rq, global, "RunHardwareDetection", settings); + bool hardwareSupported{true}; + Script::Function::Call(rq, global, "RunHardwareDetection", hardwareSupported, settings); + + if (!hardwareSupported) + { + // It doesn't make sense to continue working here, because we're not + // able to display anything. + DEBUG_DISPLAY_FATAL_ERROR( + L"Your graphics card doesn't appear to be fully compatible with OpenGL shaders." + L" The game does not support pre-shader graphics cards." + L" You are advised to try installing newer drivers and/or upgrade your graphics card." + L" For more information, please see http://www.wildfiregames.com/forum/index.php?showtopic=16734" + ); + } } diff --git a/source/renderer/ModelRenderer.h b/source/renderer/ModelRenderer.h index 019ceaffc9..7f14364bc2 100644 --- a/source/renderer/ModelRenderer.h +++ b/source/renderer/ModelRenderer.h @@ -59,7 +59,7 @@ typedef std::shared_ptr ModelRendererPtr; * The main purpose of this class over CRenderData is to track which * ModelRenderer the render data belongs to (via the key that is passed * to the constructor). When a model changes the renderer it uses - * (e.g. via run-time modification of the renderpath configuration), + * (e.g. via run-time modification of the gpu skinning configuration), * the old ModelRenderer's render data is supposed to be replaced by * the new data. */ diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index 24d3fc0297..09aadf8ea1 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -486,9 +486,6 @@ bool CRenderer::Open(int width, int height) m_Width = width; m_Height = height; - // Validate the currently selected render path - SetRenderPath(g_RenderingOptions.GetRenderPath()); - m->debugRenderer.Initialize(); if (m->postprocManager.IsEnabled()) @@ -509,24 +506,6 @@ void CRenderer::Resize(int width, int height) m->sceneRenderer.Resize(width, height); } -void CRenderer::SetRenderPath(RenderPath rp) -{ - if (!m->IsOpen) - { - // Delay until Open() is called. - return; - } - - // Renderer has been opened, so validate the selected renderpath - if (rp == RenderPath::DEFAULT) - rp = RenderPath::SHADER; - - // TODO: remove this once capabilities have been properly extracted and the above checks have been moved elsewhere. - g_RenderingOptions.m_RenderPath = rp; - - MakeShadersDirty(); -} - bool CRenderer::ShouldRender() const { return !g_app_minimized && (g_app_has_focus || !g_VideoMode.IsInFullscreen()); diff --git a/source/renderer/Renderer.h b/source/renderer/Renderer.h index 5d2079340e..23ada42703 100644 --- a/source/renderer/Renderer.h +++ b/source/renderer/Renderer.h @@ -169,11 +169,6 @@ protected: void RenderScreenShot(const bool needsPresent); void RenderBigScreenShot(const bool needsPresent); - // SetRenderPath: Select the preferred render path. - // This may only be called before Open(), because the layout of vertex arrays and other - // data may depend on the chosen render path. - void SetRenderPath(RenderPath rp); - void ReloadShaders(); // Private data that is not needed by inline functions. diff --git a/source/renderer/RenderingOptions.cpp b/source/renderer/RenderingOptions.cpp index a035c44ae7..56eaaa6b9e 100644 --- a/source/renderer/RenderingOptions.cpp +++ b/source/renderer/RenderingOptions.cpp @@ -60,33 +60,6 @@ private: std::vector hooks; }; -RenderPath RenderPathEnum::FromString(const CStr8& name) -{ - if (name == "default") - return DEFAULT; - if (name == "fixed") - return FIXED; - if (name == "shader") - return SHADER; - - LOGWARNING("Unknown render path %s", name.c_str()); - return DEFAULT; -} - -CStr8 RenderPathEnum::ToString(RenderPath path) -{ - switch (path) - { - case RenderPath::DEFAULT: - return "default"; - case RenderPath::FIXED: - return "fixed"; - case RenderPath::SHADER: - return "shader"; - } - return "default"; // Silence warning about reaching end of non-void function. -} - RenderDebugMode RenderDebugModeEnum::FromString(const CStr8& name) { if (name == str_RENDER_DEBUG_MODE_NONE.c_str()) @@ -120,7 +93,6 @@ CStrIntern RenderDebugModeEnum::ToString(RenderDebugMode mode) CRenderingOptions::CRenderingOptions() : m_ConfigHooks(new ConfigHooks()) { - m_RenderPath = RenderPath::DEFAULT; m_Shadows = false; m_WaterEffects = false; m_WaterFancyEffects = false; @@ -148,10 +120,6 @@ CRenderingOptions::~CRenderingOptions() void CRenderingOptions::ReadConfigAndSetupHooks() { - m_ConfigHooks->Setup("renderpath", [this]() { - SetRenderPath(RenderPathEnum::FromString(g_ConfigDB.Get("renderpath", std::string{}))); - }); - m_ConfigHooks->Setup("shadowquality", []() { if (CRenderer::IsInitialised()) g_Renderer.GetSceneRenderer().GetShadowMap().RecreateTexture(); @@ -301,13 +269,6 @@ void CRenderingOptions::SetFog(bool value) g_Renderer.MakeShadersDirty(); } -void CRenderingOptions::SetRenderPath(RenderPath value) -{ - m_RenderPath = value; - if (CRenderer::IsInitialised()) - g_Renderer.SetRenderPath(m_RenderPath); -} - void CRenderingOptions::SetRenderDebugMode(RenderDebugMode value) { m_RenderDebugMode = value; diff --git a/source/renderer/RenderingOptions.h b/source/renderer/RenderingOptions.h index 45760b738a..9f80a18d88 100644 --- a/source/renderer/RenderingOptions.h +++ b/source/renderer/RenderingOptions.h @@ -33,25 +33,6 @@ class CStrIntern; -enum RenderPath -{ - // If no rendering path is configured explicitly, the renderer - // will choose the path when Open() is called. - DEFAULT, - - // Classic fixed function. - FIXED, - - // Use new GLSL system - SHADER -}; - -struct RenderPathEnum -{ - static RenderPath FromString(const CStr8& name); - static CStr8 ToString(RenderPath); -}; - enum class RenderDebugMode { NONE, @@ -101,8 +82,6 @@ OPTION_CUSTOM_SETTER(NAME, TYPE); OPTION_GETTER(NAME, TYPE); OPTION_DEF(NAME, TY OPTION_WITH_SIDE_EFFECT(ShadowPCF, bool); OPTION_WITH_SIDE_EFFECT(Fog, bool); - OPTION_WITH_SIDE_EFFECT(RenderPath, RenderPath); - OPTION_WITH_SIDE_EFFECT(RenderDebugMode, RenderDebugMode); OPTION(WaterEffects, bool); diff --git a/source/renderer/SceneRenderer.cpp b/source/renderer/SceneRenderer.cpp index c34ad4ef47..024ed2f63d 100644 --- a/source/renderer/SceneRenderer.cpp +++ b/source/renderer/SceneRenderer.cpp @@ -241,7 +241,6 @@ void CSceneRenderer::ReloadShaders([[maybe_unused]] Renderer::Backend::IDevice* m->Model.ModShader = LitRenderModifierPtr(new ShaderRenderModifier()); - ENSURE(g_RenderingOptions.GetRenderPath() != RenderPath::FIXED); m->Model.VertexRendererShader = ModelVertexRendererPtr(new CPUSkinnedModelVertexRenderer()); m->Model.VertexInstancingShader = ModelVertexRendererPtr(new InstancingModelRenderer()); diff --git a/source/renderer/scripting/JSInterface_Renderer.cpp b/source/renderer/scripting/JSInterface_Renderer.cpp index 9ece8a2fcb..3515311038 100644 --- a/source/renderer/scripting/JSInterface_Renderer.cpp +++ b/source/renderer/scripting/JSInterface_Renderer.cpp @@ -47,11 +47,6 @@ IMPLEMENT_BOOLEAN_SCRIPT_SETTING(DisplayShadowsFrustum); #undef IMPLEMENT_BOOLEAN_SCRIPT_SETTING -std::string GetRenderPath() -{ - return RenderPathEnum::ToString(g_RenderingOptions.GetRenderPath()); -} - std::string GetRenderDebugMode() { return RenderDebugModeEnum::ToString(g_RenderingOptions.GetRenderDebugMode()).c_str(); @@ -83,7 +78,6 @@ Script::Function::Register<&Set##NAME##Enabled>(rq, "Renderer_Set" #NAME "Enable void RegisterScriptFunctions(const Script::Request& rq) { - Script::Function::Register<&GetRenderPath>(rq, "Renderer_GetRenderPath"); Script::Function::Register<&TextureExists>(rq, "TextureExists"); Script::Function::Register<&GetRenderDebugMode>(rq, "Renderer_GetRenderDebugMode"); Script::Function::Register<&SetRenderDebugMode>(rq, "Renderer_SetRenderDebugMode");