From 68c33922a6b47b892831886ba24eb62ee5db5fbb Mon Sep 17 00:00:00 2001 From: maj00r Date: Sun, 15 Nov 2026 23:20:18 +0100 Subject: [PATCH] fix(app): a renderer this build doesn't have starts the full one, not the legacy one The starter writes "gfxrenderer vulkan" for the Vulkan renderer of the builds that have it. This exe doesn't know the word, and every word other than default/experimental fell to the legacy renderer: a player who picked Vulkan got the slowest renderer, the one whose ui crashes on NVIDIA (the arrays left by the scene). "experimental" in a build without the NVRHI renderer ended with "no renderer found!" and no game at all. After the settings are read, a gfxrenderer word this build has no renderer for becomes "default", with a line in the log saying so. The words it knows stay as they were: full/default, legacy, simple, null, the older starters' simpleshader and off (legacy as before), and experimental where it is built. --- application/application.cpp | 15 +++++++++++++++ rendering/renderer.cpp | 5 +++++ rendering/renderer.h | 1 + 3 files changed, 21 insertions(+) diff --git a/application/application.cpp b/application/application.cpp index 96f578514..c18042c26 100644 --- a/application/application.cpp +++ b/application/application.cpp @@ -1323,6 +1323,21 @@ int eu07_application::init_settings(int Argc, char *Argv[]) simulation::apply_test_mode_settings(); } + // a renderer this build doesn't have gets the full one: the starter writes the words of every build it knows + // ("vulkan" for the vulkan builds), and any word not known here used to start the legacy renderer. + // "simpleshader" and "off" of the older starters keep the legacy one they always had + auto const &renderer{Global.GfxRenderer}; + auto const known{renderer == "default" || renderer == "legacy" || renderer == "simple" || renderer == "null" || renderer == "simpleshader" || + renderer == "off" || (renderer == "experimental" && gfx_renderer_factory::get_instance()->has_backend(renderer))}; + if (false == known) + { + WriteLog("gfxrenderer \"" + renderer + "\" isn't in this build, the full renderer is used instead"); + Global.GfxRenderer = "default"; + Global.NvRenderer = false; + Global.LegacyRenderer = false; + Global.BasicRenderer = false; + } + return 0; } diff --git a/rendering/renderer.cpp b/rendering/renderer.cpp index d9d4b5df0..c120f4222 100644 --- a/rendering/renderer.cpp +++ b/rendering/renderer.cpp @@ -29,6 +29,11 @@ std::unique_ptr gfx_renderer_factory::create(const std::string &ba return nullptr; } +bool gfx_renderer_factory::has_backend(const std::string &name) const +{ + return backends.contains(name); +} + gfx_renderer_factory *gfx_renderer_factory::get_instance() { if (!instance) diff --git a/rendering/renderer.h b/rendering/renderer.h index 5ad805c4a..b45435256 100644 --- a/rendering/renderer.h +++ b/rendering/renderer.h @@ -151,6 +151,7 @@ public: bool register_backend(const std::string &backend, create_method func); std::unique_ptr create(const std::string &name); + bool has_backend(const std::string &name) const; static gfx_renderer_factory* get_instance();