Add configurable Renderer backend

There are still some initialization errors to work through, such as
config not being initialized properly by the time GPU tries to utilize
it too. Also some life-time issues. But manually forcing it to use the
Null backnd successfully works and allows games to be "played"
headlessly.
This commit is contained in:
Wunkolo 2023-07-17 10:12:38 -07:00
parent 1becbef811
commit ceff20f57f
7 changed files with 48 additions and 24 deletions

View file

@ -31,6 +31,7 @@ void EmulatorConfig::load(const std::filesystem::path& path) {
if (gpuResult.is_ok()) {
auto gpu = gpuResult.unwrap();
rendererType = RendererType(toml::find_or<toml::integer>(gpu, "Renderer", int64_t(rendererType)));
shaderJitEnabled = toml::find_or<toml::boolean>(gpu, "EnableShaderJIT", false);
}
}
@ -54,6 +55,7 @@ void EmulatorConfig::save(const std::filesystem::path& path) {
printf("Saving new configuration file %s\n", path.string().c_str());
}
data["GPU"]["Renderer"] = static_cast<s8>(rendererType);
data["GPU"]["EnableShaderJIT"] = shaderJitEnabled;
std::ofstream file(path, std::ios::out);