mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 06:14:58 +01:00
Merge pull request #384 from MaSzyna-EU07/fix/unknown-renderer-falls-back-to-full
fix(app): a renderer this build doesn't have starts the full one, not the legacy one
This commit is contained in:
@@ -1323,6 +1323,21 @@ int eu07_application::init_settings(int Argc, char *Argv[])
|
|||||||
simulation::apply_test_mode_settings();
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ std::unique_ptr<gfx_renderer> gfx_renderer_factory::create(const std::string &ba
|
|||||||
return nullptr;
|
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()
|
gfx_renderer_factory *gfx_renderer_factory::get_instance()
|
||||||
{
|
{
|
||||||
if (!instance)
|
if (!instance)
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ public:
|
|||||||
|
|
||||||
bool register_backend(const std::string &backend, create_method func);
|
bool register_backend(const std::string &backend, create_method func);
|
||||||
std::unique_ptr<gfx_renderer> create(const std::string &name);
|
std::unique_ptr<gfx_renderer> create(const std::string &name);
|
||||||
|
bool has_backend(const std::string &name) const;
|
||||||
|
|
||||||
static gfx_renderer_factory* get_instance();
|
static gfx_renderer_factory* get_instance();
|
||||||
|
|
||||||
|
|||||||
@@ -321,6 +321,8 @@ bool global_settings::ConfigParseGraphics(cParser& Parser, const std::string& to
|
|||||||
if (token == "gfxrenderer")
|
if (token == "gfxrenderer")
|
||||||
{
|
{
|
||||||
ParseOne(Parser, GfxRenderer);
|
ParseOne(Parser, GfxRenderer);
|
||||||
|
// read in any case, as the starter does: "Legacy" written by hand is the legacy renderer
|
||||||
|
GfxRenderer = ToLower(GfxRenderer);
|
||||||
|
|
||||||
if (GfxRenderer == "full")
|
if (GfxRenderer == "full")
|
||||||
GfxRenderer = "default";
|
GfxRenderer = "default";
|
||||||
|
|||||||
Reference in New Issue
Block a user