Skip to content

Commit

Permalink
#5909: Separate state application and renderable submission
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 13, 2022
1 parent c5680da commit 05bcddd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
8 changes: 6 additions & 2 deletions radiantcore/rendersystem/backend/FullBrightRenderer.cpp
Expand Up @@ -65,7 +65,9 @@ IRenderResult::Ptr FullBrightRenderer::render(RenderStateFlags globalstate, cons

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

Expand All @@ -81,7 +83,9 @@ IRenderResult::Ptr FullBrightRenderer::render(RenderStateFlags globalstate, cons

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

pass->clearRenderables();
Expand Down
14 changes: 2 additions & 12 deletions radiantcore/rendersystem/backend/OpenGLShaderPass.cpp
Expand Up @@ -80,23 +80,13 @@ void OpenGLShaderPass::addRenderable(const OpenGLRenderable& renderable,
_transformedRenderables.emplace_back(renderable, modelview);
}

// Render the bucket contents
void OpenGLShaderPass::submitSurfaces(OpenGLState& current,
unsigned int flagsMask,
const VolumeTest& view,
std::size_t time)
void OpenGLShaderPass::submitSurfaces(const VolumeTest& view)
{
// Apply our state to the current state object
evaluateStagesAndApplyState(current, flagsMask, time, nullptr);

_owner.drawSurfaces(view);
}

void OpenGLShaderPass::submitRenderables(OpenGLState& current, unsigned int flagsMask, std::size_t time)
void OpenGLShaderPass::submitRenderables(OpenGLState& current)
{
// Apply our state to the current state object
evaluateStagesAndApplyState(current, flagsMask, time, nullptr);

drawRenderables(current);
}

Expand Down
14 changes: 4 additions & 10 deletions radiantcore/rendersystem/backend/OpenGLShaderPass.h
Expand Up @@ -101,23 +101,17 @@ class OpenGLShaderPass
* \brief
* Render the renderables attached to this shader pass.
*
* \param current
* The current OpenGL state variables.
*
* \param flagsMask
* Mask of allowed render flags.
* \param view
* The render view used to cull surfaces
*/
void submitSurfaces(OpenGLState& current,
unsigned int flagsMask,
const VolumeTest& view,
std::size_t time);
void submitSurfaces(const VolumeTest& view);

/**
* \brief
* Render the renderables attached to this shader pass.
* Their geometry might not be stored in the central buffer objects.
*/
void submitRenderables(OpenGLState& current, unsigned int flagsMask, std::size_t time);
void submitRenderables(OpenGLState& current);

/**
* Returns true if this shaderpass doesn't have anything to render.
Expand Down

0 comments on commit 05bcddd

Please sign in to comment.