1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

Increase profiler coverage in GameRenderer/OpenGLRenderer

This commit is contained in:
Daniel Evans 2018-08-31 16:29:31 +01:00
parent 080a0fe050
commit 1efe3840b8
3 changed files with 18 additions and 6 deletions

View File

@ -309,7 +309,18 @@ void GameRenderer::renderObjects(const GameWorld *world) {
RW_PROFILE_SCOPE(__func__);
renderer->useProgram(worldProg.get());
RenderList renderList = createObjectRenderList(world);
renderer->pushDebugGroup("Objects");
renderer->pushDebugGroup("RenderList");
renderer->drawBatched(renderList);
renderer->popDebugGroup();
profObjects = renderer->popDebugGroup();
}
RenderList GameRenderer::createObjectRenderList(const GameWorld *world) {
RW_PROFILE_SCOPE(__func__);
// This is sequential at the moment, it should be easy to make it
// run in parallel with a good threading system.
RenderList renderList;
@ -363,10 +374,9 @@ void GameRenderer::renderObjects(const GameWorld *world) {
model = scale(model, glm::vec3(1.5f, 1.5f, 1.5f));
objectRenderer.renderClump(arrowModel.get(), model, nullptr, renderList);
}
culled += objectRenderer.culled;
renderer->pushDebugGroup("Objects");
renderer->pushDebugGroup("RenderList");
RW_PROFILE_SCOPE("sortRenderList");
// Also parallelizable
// Earlier position in the array means earlier object's rendering
// Transparent objects should be sorted and rendered after opaque
@ -379,10 +389,8 @@ void GameRenderer::renderObjects(const GameWorld *world) {
return false;
return (a.sortKey > b.sortKey);
});
renderer->drawBatched(renderList);
renderer->popDebugGroup();
profObjects = renderer->popDebugGroup();
return renderList;
}
void GameRenderer::renderSplash(GameWorld* world, GLuint splashTexName, glm::u16vec3 fc) {

View File

@ -174,6 +174,8 @@ private:
void drawRect(const glm::vec4& colour, TextureData* texture, glm::vec4& extents);
void renderObjects(const GameWorld *world);
RenderList createObjectRenderList(const GameWorld *world);
};
#endif

View File

@ -6,6 +6,7 @@
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <core/Profiler.hpp>
#include <gl/DrawBuffer.hpp>
#include <rw/debug.hpp>
@ -315,6 +316,7 @@ void OpenGLRenderer::drawArrays(const glm::mat4& model, DrawBuffer* draw,
}
void OpenGLRenderer::drawBatched(const RenderList& list) {
RW_PROFILE_SCOPE(__func__);
#if 0 // Needs shader changes
// Determine how many batches we need to process the entire list
auto entries = list.size();