mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 11:22:45 +01:00
Increase profiler coverage in GameRenderer/OpenGLRenderer
This commit is contained in:
parent
080a0fe050
commit
1efe3840b8
@ -309,7 +309,18 @@ void GameRenderer::renderObjects(const GameWorld *world) {
|
|||||||
RW_PROFILE_SCOPE(__func__);
|
RW_PROFILE_SCOPE(__func__);
|
||||||
|
|
||||||
renderer->useProgram(worldProg.get());
|
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
|
// This is sequential at the moment, it should be easy to make it
|
||||||
// run in parallel with a good threading system.
|
// run in parallel with a good threading system.
|
||||||
RenderList renderList;
|
RenderList renderList;
|
||||||
@ -363,10 +374,9 @@ void GameRenderer::renderObjects(const GameWorld *world) {
|
|||||||
model = scale(model, glm::vec3(1.5f, 1.5f, 1.5f));
|
model = scale(model, glm::vec3(1.5f, 1.5f, 1.5f));
|
||||||
objectRenderer.renderClump(arrowModel.get(), model, nullptr, renderList);
|
objectRenderer.renderClump(arrowModel.get(), model, nullptr, renderList);
|
||||||
}
|
}
|
||||||
|
|
||||||
culled += objectRenderer.culled;
|
culled += objectRenderer.culled;
|
||||||
renderer->pushDebugGroup("Objects");
|
|
||||||
renderer->pushDebugGroup("RenderList");
|
RW_PROFILE_SCOPE("sortRenderList");
|
||||||
// Also parallelizable
|
// Also parallelizable
|
||||||
// Earlier position in the array means earlier object's rendering
|
// Earlier position in the array means earlier object's rendering
|
||||||
// Transparent objects should be sorted and rendered after opaque
|
// Transparent objects should be sorted and rendered after opaque
|
||||||
@ -379,10 +389,8 @@ void GameRenderer::renderObjects(const GameWorld *world) {
|
|||||||
return false;
|
return false;
|
||||||
return (a.sortKey > b.sortKey);
|
return (a.sortKey > b.sortKey);
|
||||||
});
|
});
|
||||||
renderer->drawBatched(renderList);
|
|
||||||
|
|
||||||
renderer->popDebugGroup();
|
return renderList;
|
||||||
profObjects = renderer->popDebugGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRenderer::renderSplash(GameWorld* world, GLuint splashTexName, glm::u16vec3 fc) {
|
void GameRenderer::renderSplash(GameWorld* world, GLuint splashTexName, glm::u16vec3 fc) {
|
||||||
|
@ -174,6 +174,8 @@ private:
|
|||||||
void drawRect(const glm::vec4& colour, TextureData* texture, glm::vec4& extents);
|
void drawRect(const glm::vec4& colour, TextureData* texture, glm::vec4& extents);
|
||||||
|
|
||||||
void renderObjects(const GameWorld *world);
|
void renderObjects(const GameWorld *world);
|
||||||
|
|
||||||
|
RenderList createObjectRenderList(const GameWorld *world);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
|
#include <core/Profiler.hpp>
|
||||||
#include <gl/DrawBuffer.hpp>
|
#include <gl/DrawBuffer.hpp>
|
||||||
#include <rw/debug.hpp>
|
#include <rw/debug.hpp>
|
||||||
|
|
||||||
@ -315,6 +316,7 @@ void OpenGLRenderer::drawArrays(const glm::mat4& model, DrawBuffer* draw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLRenderer::drawBatched(const RenderList& list) {
|
void OpenGLRenderer::drawBatched(const RenderList& list) {
|
||||||
|
RW_PROFILE_SCOPE(__func__);
|
||||||
#if 0 // Needs shader changes
|
#if 0 // Needs shader changes
|
||||||
// Determine how many batches we need to process the entire list
|
// Determine how many batches we need to process the entire list
|
||||||
auto entries = list.size();
|
auto entries = list.size();
|
||||||
|
Loading…
Reference in New Issue
Block a user