17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 15:30:28 +01:00

Draw instances from the GPU culling with indirect draws, occlusion culling and a depth prepass

This commit is contained in:
2026-10-16 12:54:52 +02:00
parent 2f0a06b98e
commit 466cb5339e
23 changed files with 1002 additions and 32 deletions

View File

@@ -1428,8 +1428,21 @@ global_settings::ConfigParse_gfx( cParser &Parser, std::string_view const Token
}
else if (Token == "gfx.gpucull")
{
// yes: culled and drawn from the gpu, compare: culled on both, drawn by the cpu, anything else: cpu
Parser.getTokens(1);
Parser >> gfx_gpucull;
std::string mode;
Parser >> mode;
gfx_gpucull = (mode == "yes" || mode == "true" || mode == "1") ? 1 : (mode == "compare" || mode == "2") ? 2 : 0;
}
else if (Token == "gfx.gpucull.occlusion")
{
Parser.getTokens(1);
Parser >> gfx_gpucull_occlusion;
}
else if (Token == "gfx.depthprepass")
{
Parser.getTokens(1);
Parser >> gfx_depthprepass;
}
else if (Token == "gfx.lights.clusterheatmap")
{
@@ -1855,7 +1868,9 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "gfx.envmap.enabled", gfx_envmap_enabled );
export_as_text( Output, "gfx.lights.clustered", gfx_lights_clustered );
export_as_text( Output, "gfx.lights.clusterheatmap", gfx_lights_clusterheatmap );
export_as_text( Output, "gfx.gpucull", gfx_gpucull );
export_as_text( Output, "gfx.gpucull", std::string{ gfx_gpucull == 1 ? "yes" : gfx_gpucull == 2 ? "compare" : "no" } );
export_as_text( Output, "gfx.gpucull.occlusion", gfx_gpucull_occlusion );
export_as_text( Output, "gfx.depthprepass", gfx_depthprepass );
export_as_text( Output, "gfx.postfx.motionblur.enabled", gfx_postfx_motionblur_enabled );
export_as_text( Output, "gfx.postfx.motionblur.shutter", gfx_postfx_motionblur_shutter );
// TODO: export gfx_postfx_motionblur_format

View File

@@ -285,7 +285,11 @@ struct global_settings {
bool gfx_envmap_enabled = true;
bool gfx_lights_clustered = true; // headlights from the light lists of the clusters (no limit of lit headlights) or the first dynamiclights of them
bool gfx_lights_clusterheatmap = false; // debug view of the light clusters
bool gfx_gpucull = false; // culls model instances of the main view in a compute pass too, and compares the result with the cpu (opengl 4.6)
// culling of the model instances of the main view (opengl 4.6): 0 on the cpu, 1 in a compute pass, which the instances are
// drawn from with indirect draws, 2 on the cpu, which draws, and in a compute pass too, for the results to be compared
int gfx_gpucull = 0;
bool gfx_gpucull_occlusion = true; // with gfx_gpucull 1: instances hidden behind the depth drawn before them are left out
bool gfx_depthprepass = true; // with gfx_gpucull 1: the depth of the instances is drawn before their colour
bool gfx_postfx_motionblur_enabled = true;
float gfx_postfx_motionblur_shutter = 0.01f;
GLenum gfx_postfx_motionblur_format = GL_RG16F;