Skip to content

Commit

Permalink
#5893: Cleanup round
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Feb 11, 2022
1 parent 0dceee3 commit 42abd0b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 45 deletions.
6 changes: 0 additions & 6 deletions libs/render/ContinuousBuffer.h
Expand Up @@ -29,7 +29,6 @@ class ContinuousBuffer
static constexpr std::size_t GrowthRate = 1; // 100% growth each time

std::vector<ElementType> _buffer;
std::vector<ElementType> _inactiveBuffer;

struct SlotInfo
{
Expand Down Expand Up @@ -239,11 +238,6 @@ class ContinuousBuffer
// Allocate more memory
auto additionalSize = std::max(_buffer.size() * GrowthRate, requiredSize);
auto newSize = _buffer.size() + additionalSize;
#if 0
// Park the old data in the inactive buffer, some GL thread might still access it
_inactiveBuffer = std::move(_buffer);
_buffer = _inactiveBuffer;
#endif
_buffer.resize(newSize);

// Use the right most slot for our requirement, then cut up the rest of the space
Expand Down
10 changes: 0 additions & 10 deletions radiantcore/rendersystem/OpenGLRenderSystem.cpp
Expand Up @@ -312,8 +312,6 @@ void OpenGLRenderSystem::endFrame()
IRenderResult::Ptr OpenGLRenderSystem::renderLitScene(RenderStateFlags globalFlagsMask,
const IRenderView& view)
{
//rMessage() << "Start rendering frame" << std::endl;

auto result = std::make_shared<LightingModeRenderResult>();

// Construct default OpenGL state
Expand Down Expand Up @@ -347,31 +345,23 @@ IRenderResult::Ptr OpenGLRenderSystem::renderLitScene(RenderStateFlags globalFla
interactionLists.emplace_back(std::move(interaction));
}

//rMessage() << " Start Depth Buffer Filling" << std::endl;

// Run the depth fill pass
for (auto& interactionList : interactionLists)
{
interactionList.fillDepthBuffer(current, globalFlagsMask, view, _time);
}

//rMessage() << " Finished Depth Buffer Filling" << std::endl;

// Draw the surfaces per light and material
for (auto& interactionList : interactionLists)
{
interactionList.render(current, globalFlagsMask, view, _time);
result->drawCalls += interactionList.getDrawCalls();
}

//rMessage() << " Finished Interaction Pass" << std::endl;

renderText();

finishRendering();

//rMessage() << "Rendering done" << std::endl;

return result;
}

Expand Down
7 changes: 2 additions & 5 deletions radiantcore/rendersystem/backend/GeometryStore.h
Expand Up @@ -16,7 +16,7 @@ class GeometryStore :
using Slot = std::uint64_t;

private:
static constexpr auto NumFrameBuffers = 3;
static constexpr auto NumFrameBuffers = 2;

// Represents the storage for a single frame
struct FrameBuffer
Expand Down Expand Up @@ -46,10 +46,8 @@ class GeometryStore :
void onFrameStart()
{
// Switch to the next frame
#if 1
auto& previous = getCurrentBuffer();
_currentBuffer = (_currentBuffer + 1) % NumFrameBuffers;
#endif
auto& current = getCurrentBuffer();

// Wait for this buffer to become available
Expand All @@ -70,11 +68,10 @@ class GeometryStore :
glDeleteSync(current.syncObject);
current.syncObject = nullptr;
}
#if 1

// Copy data to current
current.vertices = previous.vertices;
current.indices = previous.indices;
#endif
}

// Completes the currently writing frame, creates sync objects
Expand Down
24 changes: 0 additions & 24 deletions radiantcore/rendersystem/backend/LightInteractions.cpp
@@ -1,7 +1,6 @@
#include "LightInteractions.h"

#include "OpenGLShader.h"
#include "registry/CachedKey.h"

namespace render
{
Expand Down Expand Up @@ -101,8 +100,6 @@ void LightInteractions::fillDepthBuffer(OpenGLState& state, RenderStateFlags glo
{
auto entity = pair.first;

//rMessage() << "Depth Fill Pass: " << entity->getEntityName() << std::endl;

for (auto& pair : pair.second)
{
auto shader = pair.first;
Expand Down Expand Up @@ -148,23 +145,10 @@ void LightInteractions::render(OpenGLState& state, RenderStateFlags globalFlagsM
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

static auto MaxObjects = 10;
static registry::CachedKey<int> key("user/ui/maxRenderEntities");
auto objectCount = 0;
auto entityCount = 0;

for (auto& pair : _objectsByEntity)
{
if (entityCount++ == key.get())
{
rMessage() << "Skipped: " << pair.first->getEntityName() << std::endl;
break;
}

auto entity = pair.first;

rMessage() << "Interaction Pass: " << entity->getEntityName() << std::endl;

for (auto& pair : pair.second)
{
auto shader = pair.first;
Expand All @@ -190,16 +174,8 @@ void LightInteractions::render(OpenGLState& state, RenderStateFlags globalFlagsM

RenderInfo info(state.getRenderFlags(), view.getViewer(), state.cubeMapMode);

objectCount = 0;

for (auto object : objectList)
{
if (objectCount++ == MaxObjects)
{
glDisableClientState(GL_VERTEX_ARRAY);
return;
}

if (state.glProgram)
{
OpenGLShaderPass::setUpLightingCalculation(state, &_light, worldToLight,
Expand Down

0 comments on commit 42abd0b

Please sign in to comment.