17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 03:59:19 +02:00

feat(loading): optional background loading: sound files decoded by worker threads (sound.asyncload), data of dds textures read by worker threads (gfx.textures.streaming), gl textures of vehicles farther than a multiple of the draw range released (gfx.textures.releasedistance); all off by default

This commit is contained in:
2026-10-08 16:17:46 +02:00
parent 516aa19cb5
commit 28b4e57133
12 changed files with 683 additions and 23 deletions

View File

@@ -187,6 +187,12 @@ bool global_settings::ConfigParseAudio(cParser& Parser, const std::string& token
return true;
}
if (token == "sound.asyncload")
{
ParseOne(Parser, AudioAsyncLoad);
return true;
}
if (token == "sound.volume.vehicle")
{
ParseOneClamped(Parser, VehicleVolume, 0.f, 1.f);
@@ -1347,6 +1353,18 @@ global_settings::ConfigParse_gfx( cParser &Parser, std::string_view const Token
Parser.getTokens();
Parser >> ResourceMove;
}
else if (Token == "gfx.textures.streaming")
{
Parser.getTokens();
Parser >> gfx_texture_streaming;
}
else if (Token == "gfx.textures.releasedistance")
{
// multiplier of the draw range, 0 turns the release off. textures within the draw range are never released
Parser.getTokens();
Parser >> gfx_texture_releasedistance;
gfx_texture_releasedistance = (gfx_texture_releasedistance > 0.f ? std::max(gfx_texture_releasedistance, 1.f) : 0.f);
}
else if (Token == "gfx.reflections.framerate")
{
auto const updatespersecond{std::abs(Parser.getToken<double>())};
@@ -1530,6 +1548,7 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "sound.volume.vehicle", VehicleVolume );
export_as_text( Output, "sound.volume.positional", EnvironmentPositionalVolume );
export_as_text( Output, "sound.volume.ambient", EnvironmentAmbientVolume );
export_as_text( Output, "sound.asyncload", AudioAsyncLoad );
export_as_text( Output, "physicslog", WriteLogFlag );
export_as_text( Output, "fullphysics", FullPhysics );
export_as_text( Output, "debuglog", iWriteLogEnabled );
@@ -1584,6 +1603,8 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "createswitchtrackbeds", CreateSwitchTrackbeds );
export_as_text( Output, "gfx.resource.sweep", ResourceSweep );
export_as_text( Output, "gfx.resource.move", ResourceMove );
export_as_text( Output, "gfx.textures.streaming", gfx_texture_streaming );
export_as_text( Output, "gfx.textures.releasedistance", gfx_texture_releasedistance );
export_as_text( Output, "gfx.reflections.framerate", 1.0 / reflectiontune.update_interval );
export_as_text( Output, "gfx.reflections.fidelity", reflectiontune.fidelity );
export_as_text( Output, "timespeed", fTimeSpeed );

View File

@@ -182,6 +182,8 @@ struct global_settings {
float SmokeFidelity{ 1.f }; // determines amount of generated smoke particles
bool ResourceSweep{ true }; // gfx resource garbage collection
bool ResourceMove{ false }; // gfx resources are moved between cpu and gpu side instead of sending a copy
bool gfx_texture_streaming{ false }; // data of dds textures is read by worker threads, the rest of the loading doesn't wait for it
float gfx_texture_releasedistance{ 0.f }; // gl textures of vehicles farther than this many draw ranges are released. 0 = off
bool compress_tex{ true }; // all textures are compressed on gpu side
std::string asSky{ "1" };
float fFpsAverage{ 0.f }; // oczekiwana wartosć FPS
@@ -197,6 +199,7 @@ struct global_settings {
float EnvironmentAmbientVolume{ 1.0f };
int audio_max_sources = 30;
std::string AudioRenderer;
bool AudioAsyncLoad{ false }; // sound files are decoded by worker threads
// input
float fMouseXScale{ 1.5f };
float fMouseYScale{ 0.2f };