Skip to content

Commit

Permalink
#5948: Simplify the full bright renderer to process all sorted passes…
Browse files Browse the repository at this point in the history
… in the same manner.

The VBOs remain bound throughout the render pass, all single OpenGLRenderables (for selection overlays) should use the regular ObjectRenderer methods to submit their geometry in the assumption that the buffer is bound correctly.
This effectively disables the WindingRenderer::renderWinding() method, no brush selection overlays are rendered until it's been migrated.
  • Loading branch information
codereader committed Apr 24, 2022
1 parent 283ee69 commit a895c11
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
19 changes: 16 additions & 3 deletions radiantcore/rendersystem/backend/FullBrightRenderer.cpp
Expand Up @@ -55,20 +55,33 @@ IRenderResult::Ptr FullBrightRenderer::render(RenderStateFlags globalstate, cons
for (const auto& [_, pass] : _sortedStates)
{
// Render the OpenGLShaderPass
if (pass->empty() || pass->hasRenderables()) continue;
if (pass->empty()) continue;

if (pass->getShader().isVisible() && pass->isApplicableTo(_renderViewType))
{
// Apply our state to the current state object
pass->evaluateStagesAndApplyState(current, globalstate, time, nullptr);
pass->submitSurfaces(view);

if (!pass->hasRenderables())
{
// All regular geometry like patches, brushes, meshes, single vertices
pass->submitSurfaces(view);
}
else
{
// Selection overlays are processed by OpenGLRenderable
pass->submitRenderables(current);
}
}

pass->clearRenderables();
}

// Unbind the geometry buffer and draw the rest of the renderables
vertexBuffer->unbind();
indexBuffer->unbind();

#if 0
// Run all the passes with OpenGLRenderables
for (const auto& [_, pass] : _sortedStates)
{
Expand All @@ -84,7 +97,7 @@ IRenderResult::Ptr FullBrightRenderer::render(RenderStateFlags globalstate, cons

pass->clearRenderables();
}

#endif
cleanupState();

return std::make_shared<FullBrightRenderResult>(view.getCullStats());
Expand Down
5 changes: 4 additions & 1 deletion radiantcore/rendersystem/backend/GeometryRenderer.h
Expand Up @@ -139,17 +139,20 @@ class GeometryRenderer :
auto& slotInfo = _slots.at(slot);
auto& group = getGroupByIndex(slotInfo.groupIndex);

#if 0
auto renderParms = _store.getRenderParameters(slotInfo.storageHandle);

auto [vertexBuffer, indexBuffer] = _store.getBufferObjects();
vertexBuffer->bind();
indexBuffer->bind();

ObjectRenderer::InitAttributePointers(renderParms.bufferStart);
#endif
ObjectRenderer::SubmitGeometry(slotInfo.storageHandle, group.primitiveMode, _store);

#if 0
vertexBuffer->unbind();
indexBuffer->unbind();
#endif
}

IGeometryStore::Slot getGeometryStorageLocation(Slot slot) override
Expand Down
2 changes: 1 addition & 1 deletion radiantcore/rendersystem/backend/OpenGLShader.cpp
Expand Up @@ -221,7 +221,7 @@ bool OpenGLShader::hasWindings() const

void OpenGLShader::renderWinding(IWindingRenderer::RenderMode mode, IWindingRenderer::Slot slot)
{
_windingRenderer->renderWinding(mode, slot);
//_windingRenderer->renderWinding(mode, slot);
}

void OpenGLShader::setVisible(bool visible)
Expand Down
4 changes: 3 additions & 1 deletion radiantcore/rendersystem/backend/SurfaceRenderer.h
Expand Up @@ -98,7 +98,7 @@ class SurfaceRenderer :

void renderSurface(Slot slot) override
{
renderSlot(_surfaces.at(slot), true);
renderSlot(_surfaces.at(slot), false);
}

IGeometryStore::Slot getSurfaceStorageLocation(ISurfaceRenderer::Slot slot) override
Expand Down Expand Up @@ -157,6 +157,7 @@ class SurfaceRenderer :
throw std::logic_error("Cannot render unprepared slot, ensure calling SurfaceRenderer::prepareForRendering first");
}

#if 0
if (bindBuffer)
{
auto renderParams = _store.getRenderParameters(surface.getStorageLocation());
Expand All @@ -172,6 +173,7 @@ class SurfaceRenderer :
indexBuffer->unbind();
}
else
#endif
{
ObjectRenderer::SubmitObject(surface, _store);
}
Expand Down

0 comments on commit a895c11

Please sign in to comment.