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
This commit is contained in:
Vladislav Belov
2026-07-07 23:12:45 +02:00
parent fb38c8781b
commit 46af67b5bd
13 changed files with 27 additions and 126 deletions
+1 -4
View File
@@ -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.
+7 -10
View File
@@ -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;
};
+1 -1
View File
@@ -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]);
+3 -3
View File
@@ -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<const std::set<CStr>*>& 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<const std::set<CStr>*>& 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));
}
-13
View File
@@ -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
+14 -1
View File
@@ -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"
);
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ typedef std::shared_ptr<ModelRenderer> 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.
*/
-21
View File
@@ -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());
-5
View File
@@ -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.
-39
View File
@@ -60,33 +60,6 @@ private:
std::vector<CConfigDBHook> 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;
-21
View File
@@ -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);
-1
View File
@@ -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());
@@ -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");