17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-24 22:37:36 +02:00

Draw the instances from the GPU with multi draws, the model block of each draw read by its number

This commit is contained in:
2026-10-18 00:47:05 +02:00
parent 7221c153dd
commit 494304903f
18 changed files with 609 additions and 64 deletions

View File

@@ -11,13 +11,13 @@
_global Global;
bool check_shader(std::string filename)
bool check_shader(std::string filename, std::string const &defines = {})
{
gl::shader shader_processor;
shader_processor.name = filename;
gl::glsl_common_setup();
std::pair<GLuint, std::string> source = shader_processor.process_source(filename, "../shaders/");
std::pair<GLuint, std::string> source = shader_processor.process_source(filename, "../shaders/", defines);
std::string stage;
if (source.first == GL_VERTEX_SHADER)
@@ -70,6 +70,21 @@ bool check_shader_allopts(std::string filename)
if (!check_shader(filename))
suc = false;
// the variant of the vertex and fragment stages the multi draws of the instances use (model blocks by gl_DrawID)
auto const ext{std::filesystem::path(filename).extension()};
if (ext == ".vert" || ext == ".frag")
{
std::cout << "done, model draws..." << std::flush;
Global.gfx_shadowmap_enabled = true;
Global.gfx_envmap_enabled = true;
Global.gfx_postfx_motionblur_enabled = true;
Global.gfx_skippipeline = false;
Global.gfx_extraeffects = true;
Global.gfx_shadergamma = true;
if (!check_shader(filename, "#define MODEL_DRAWS 1\n"))
suc = false;
}
std::cout << "done" << std::flush;
return suc;