Skip to content

Commit

Permalink
#5912: Submit untransformed geometry in batched glMultiDraw
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 6, 2022
1 parent e423e3c commit 19a5337
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions radiantcore/rendersystem/backend/LightInteractions.cpp
Expand Up @@ -72,24 +72,40 @@ void LightInteractions::fillDepthBuffer(OpenGLState& state, RenderStateFlags glo
for (auto& pair : pair.second)
{
auto shader = pair.first;
auto& objectList = pair.second;

if (!shader->getDepthFillPass()) continue;

// Skip translucent materials
if (shader->getMaterial() && shader->getMaterial()->getCoverage() == Material::MC_TRANSLUCENT)
{
continue;
}

auto& objectList = pair.second;

if (!shader->getDepthFillPass()) continue;
// We submit all objects with an identity matrix in a single multi draw call
std::set<IGeometryStore::Slot> untransformedObjects;

// Apply our state to the current state object
shader->getDepthFillPass()->applyState(state, globalFlagsMask, view.getViewer(), renderTime, entity);

for (auto object : objectList)
{
if (!object.get().isOriented())
{
untransformedObjects.insert(object.get().getStorageLocation());
continue;
}

ObjectRenderer::SubmitObject(object.get(), _store);
++_drawCalls;
}

if (!untransformedObjects.empty())
{
ObjectRenderer::SubmitGeometry(untransformedObjects, GL_TRIANGLES, _store);
++_drawCalls;
}
}
}

Expand Down

0 comments on commit 19a5337

Please sign in to comment.