mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-06 13:58:36 +01:00
Keep the walk's model block after the depth and shadow passes of the gpu-culled draws
This commit is contained in:
@@ -3746,7 +3746,10 @@ opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
auto lastdrawn { count };
|
// the walk goes on with its own model block: what a recorded draw leaves in it (the emission of a lit lamp) would light the
|
||||||
|
// tracks and the shapes the walk draws next
|
||||||
|
auto const walkubs { model_ubs };
|
||||||
|
auto drawn { false };
|
||||||
// the draws without the alpha test first, then the ones with it, one program each
|
// the draws without the alpha test first, then the ones with it, one program each
|
||||||
for( auto prepassclass = 1; prepassclass <= 2; ++prepassclass ) {
|
for( auto prepassclass = 1; prepassclass <= 2; ++prepassclass ) {
|
||||||
auto &program { prepassclass == 1 ? *m_prepass_shader : *m_prepass_alpha_shader };
|
auto &program { prepassclass == 1 ? *m_prepass_shader : *m_prepass_alpha_shader };
|
||||||
@@ -3787,7 +3790,7 @@ opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_
|
|||||||
m_geometry.draw_indirect_multi( draw.geometry, m_indirectcull->draw_command_offset( Set, index ), drawcount, sizeof( gl::instance_draw_command ) );
|
m_geometry.draw_indirect_multi( draw.geometry, m_indirectcull->draw_command_offset( Set, index ), drawcount, sizeof( gl::instance_draw_command ) );
|
||||||
counts.draws += drawcount;
|
counts.draws += drawcount;
|
||||||
++counts.calls;
|
++counts.calls;
|
||||||
lastdrawn = last - 1;
|
drawn = true;
|
||||||
index = last;
|
index = last;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3800,12 +3803,12 @@ opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_
|
|||||||
m_geometry.draw_indirect( draw.geometry, m_indirectcull->draw_command_offset( Set, index ) );
|
m_geometry.draw_indirect( draw.geometry, m_indirectcull->draw_command_offset( Set, index ) );
|
||||||
++counts.draws;
|
++counts.draws;
|
||||||
++counts.calls;
|
++counts.calls;
|
||||||
|
drawn = true;
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( lastdrawn < count ) {
|
model_ubs = walkubs;
|
||||||
// the model block the draws made one by one leave behind
|
if( drawn ) {
|
||||||
model_ubs = m_indirectdraws[ lastdrawn ].ubs;
|
|
||||||
model_ubo->update( model_ubs );
|
model_ubo->update( model_ubs );
|
||||||
}
|
}
|
||||||
return counts;
|
return counts;
|
||||||
@@ -3858,6 +3861,8 @@ opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_
|
|||||||
|
|
||||||
opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_Shadow( opengl46_instance_cull::command_set const Set )
|
opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_Shadow( opengl46_instance_cull::command_set const Set )
|
||||||
{
|
{
|
||||||
|
// the walk goes on with its own model block, as after Render_Instances_Indirect_Depth()
|
||||||
|
auto const walkubs { model_ubs };
|
||||||
indirect_counts counts;
|
indirect_counts counts;
|
||||||
auto const count { m_indirectdraws.size() };
|
auto const count { m_indirectdraws.size() };
|
||||||
for( std::size_t index = 0; index < count; ) {
|
for( std::size_t index = 0; index < count; ) {
|
||||||
@@ -3899,9 +3904,8 @@ opengl46_renderer::indirect_counts opengl46_renderer::Render_Instances_Indirect_
|
|||||||
}
|
}
|
||||||
++counts.calls;
|
++counts.calls;
|
||||||
}
|
}
|
||||||
if( m_indirectmultidraw && ( count > 0 ) ) {
|
model_ubs = walkubs;
|
||||||
// the model block the draws made one by one leave behind
|
if( count > 0 ) {
|
||||||
model_ubs = m_indirectdraws.back().ubs;
|
|
||||||
model_ubo->update( model_ubs );
|
model_ubo->update( model_ubs );
|
||||||
}
|
}
|
||||||
return counts;
|
return counts;
|
||||||
|
|||||||
@@ -329,8 +329,12 @@ bool vulkan14_renderer::draw_indirect(vk14::instance_cull &Cull, command_set con
|
|||||||
std::uint32_t block{~0u};
|
std::uint32_t block{~0u};
|
||||||
if (Count == 1)
|
if (Count == 1)
|
||||||
{
|
{
|
||||||
|
// the block of the recorded draw; the walk goes on with its own model block. what a recorded draw leaves in it (the
|
||||||
|
// emission of a lit lamp) would light the tracks and the shapes the walk draws next
|
||||||
|
auto const walkubs{model_ubs};
|
||||||
model_ubs = first.ubs;
|
model_ubs = first.ubs;
|
||||||
block = push_draw_block();
|
block = push_draw_block();
|
||||||
|
model_ubs = walkubs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -588,10 +592,6 @@ vulkan14_renderer::indirect_counts vulkan14_renderer::draw_indirect_shadow(vk14:
|
|||||||
++counts.calls;
|
++counts.calls;
|
||||||
index = last;
|
index = last;
|
||||||
}
|
}
|
||||||
if (count > 0)
|
|
||||||
{
|
|
||||||
model_ubs = m_indirectdraws.back().ubs;
|
|
||||||
}
|
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user