mirror of
https://github.com/rwengine/openrw.git
synced 2024-10-06 09:07:19 +02:00
rwengine: enable profiler if RW_PROFILER is defined + RENDER_PROFILER unused
This commit is contained in:
parent
7d894b2da5
commit
014a9b1bda
@ -44,8 +44,7 @@ target_compile_definitions(rw_interface
|
||||
"GLM_FORCE_RADIANS"
|
||||
"GLM_ENABLE_EXPERIMENTAL"
|
||||
"RW_VERBOSE_DEBUG_MESSAGES=$<BOOL:${RW_VERBOSE_DEBUG_MESSAGES}>"
|
||||
"RENDER_PROFILER=0"
|
||||
"RW_PROFILER=$<BOOL:${ENABLE_PROFILING}>"
|
||||
"$<$<BOOL:${ENABLE_PROFILING}>:RW_PROFILER>"
|
||||
)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef _RWENGINE_PROFILER_HPP_
|
||||
#define _RWENGINE_PROFILER_HPP_
|
||||
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <stack>
|
||||
|
@ -128,7 +128,7 @@ void OpenGLRenderer::useDrawBuffer(DrawBuffer* dbuff) {
|
||||
glBindVertexArray(dbuff->getVAOName());
|
||||
currentDbuff = dbuff;
|
||||
bufferCounter++;
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
if (currentDebugDepth > 0) {
|
||||
profileInfo[currentDebugDepth - 1].buffers++;
|
||||
}
|
||||
@ -145,7 +145,7 @@ void OpenGLRenderer::useTexture(GLuint unit, GLuint tex) {
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
currentTextures[unit] = tex;
|
||||
textureCounter++;
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
if (currentDebugDepth > 0) {
|
||||
profileInfo[currentDebugDepth - 1].textures++;
|
||||
}
|
||||
@ -291,7 +291,7 @@ void OpenGLRenderer::setDrawState(const glm::mat4& model, DrawBuffer* draw,
|
||||
uploadUBO(UBOObject, objectData);
|
||||
|
||||
drawCounter++;
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
if (currentDebugDepth > 0) {
|
||||
profileInfo[currentDebugDepth - 1].draws++;
|
||||
profileInfo[currentDebugDepth - 1].primitives += p.count;
|
||||
@ -421,7 +421,7 @@ void OpenGLRenderer::uploadUBOEntry(Buffer &buffer, const void *data, size_t siz
|
||||
}
|
||||
|
||||
void OpenGLRenderer::pushDebugGroup(const std::string& title) {
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
if (ogl_ext_KHR_debug) {
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title.c_str());
|
||||
ProfileInfo& prof = profileInfo[currentDebugDepth];
|
||||
@ -440,7 +440,7 @@ void OpenGLRenderer::pushDebugGroup(const std::string& title) {
|
||||
}
|
||||
|
||||
const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup() {
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
if (ogl_ext_KHR_debug) {
|
||||
glPopDebugGroup();
|
||||
currentDebugDepth--;
|
||||
|
@ -403,7 +403,7 @@ private:
|
||||
template <class T>
|
||||
void uploadUBO(Buffer& buffer, const T& data) {
|
||||
uploadUBOEntry(buffer, &data, sizeof(T));
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
if (currentDebugDepth > 0) {
|
||||
profileInfo[currentDebugDepth - 1].uploads++;
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ void RWGame::renderDebugObjects(float time, ViewCamera& camera) {
|
||||
}
|
||||
|
||||
void RWGame::renderProfile() {
|
||||
#if RW_PROFILER
|
||||
#ifdef RW_PROFILER
|
||||
auto& frame = perf::Profiler::get().getFrame();
|
||||
constexpr float upperlimit = 30000.f;
|
||||
constexpr float lineHeight = 15.f;
|
||||
|
Loading…
Reference in New Issue
Block a user