mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 02:33:43 +01:00
OpenGL: Integrate GLProfiler into render pass execution
Integrates the GLProfiler into GLQueueRunner to provide GPU timestamp profiling for OpenGL render passes, similar to the Vulkan backend. Profiled operations: - RenderPass (with tag name for identification) - Copy operations - Blit operations - Readback operations - ReadbackImage operations The profiler is initialized in CreateDeviceObjects() and shutdown in DestroyDeviceObjects(). Timing results are logged each frame when the GPU profile debug overlay is enabled. Signed-off-by: Chris Healy <cphealy@gmail.com>
This commit is contained in:
1 parent
ba59170b0b
commit
49bfbd49cd
2 files changed
+22
No files matched your search
@@ -75,9 +75,12 @@ void GLQueueRunner::CreateDeviceObjects() {
|
||||
#if !PPSSPP_ARCH(X86) // Doesn't work on AMD for some reason. See issue #17787
|
||||
useDebugGroups_ = !gl_extensions.IsGLES && gl_extensions.VersionGEThan(4, 3);
|
||||
#endif
|
||||
|
||||
profiler_.Init();
|
||||
}
|
||||
|
||||
void GLQueueRunner::DestroyDeviceObjects() {
|
||||
profiler_.Shutdown();
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
if (gl_extensions.ARB_vertex_array_object) {
|
||||
glDeleteVertexArrays(1, &globalVAO_);
|
||||
@@ -667,6 +670,12 @@ void GLQueueRunner::RunSteps(const std::vector<GLRStep *> &steps, GLFrameData &f
|
||||
}
|
||||
}
|
||||
|
||||
// GPU timestamp profiling - read results from previous frame and prepare for new queries
|
||||
if (frameData.profile.enabled) {
|
||||
profiler_.SetEnabledPtr(&frameData.profile.enabled);
|
||||
}
|
||||
profiler_.BeginFrame();
|
||||
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
size_t renderCount = 0;
|
||||
for (size_t i = 0; i < steps.size(); i++) {
|
||||
@@ -680,24 +689,34 @@ void GLQueueRunner::RunSteps(const std::vector<GLRStep *> &steps, GLFrameData &f
|
||||
switch (step.stepType) {
|
||||
case GLRStepType::RENDER:
|
||||
renderCount++;
|
||||
profiler_.Begin("RenderPass %s", step.tag);
|
||||
if (IsVREnabled()) {
|
||||
PreprocessStepVR(&step);
|
||||
PerformRenderPass(step, renderCount == 1, renderCount == totalRenderCount, frameData.profile);
|
||||
} else {
|
||||
PerformRenderPass(step, renderCount == 1, renderCount == totalRenderCount, frameData.profile);
|
||||
}
|
||||
profiler_.End();
|
||||
break;
|
||||
case GLRStepType::COPY:
|
||||
profiler_.Begin("Copy");
|
||||
PerformCopy(step);
|
||||
profiler_.End();
|
||||
break;
|
||||
case GLRStepType::BLIT:
|
||||
profiler_.Begin("Blit");
|
||||
PerformBlit(step);
|
||||
profiler_.End();
|
||||
break;
|
||||
case GLRStepType::READBACK:
|
||||
profiler_.Begin("Readback");
|
||||
PerformReadback(step);
|
||||
profiler_.End();
|
||||
break;
|
||||
case GLRStepType::READBACK_IMAGE:
|
||||
profiler_.Begin("ReadbackImage");
|
||||
PerformReadbackImage(step);
|
||||
profiler_.End();
|
||||
break;
|
||||
case GLRStepType::RENDER_SKIP:
|
||||
break;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "Common/GPU/OpenGL/GLCommon.h"
|
||||
#include "Common/GPU/OpenGL/GLFrameData.h"
|
||||
#include "Common/GPU/OpenGL/GLProfiler.h"
|
||||
#include "Common/GPU/DataFormat.h"
|
||||
#include "Common/GPU/Shader.h"
|
||||
#include "Common/GPU/thin3d.h"
|
||||
@@ -417,6 +418,8 @@ private:
|
||||
bool sawOutOfMemory_ = false;
|
||||
bool useDebugGroups_ = false;
|
||||
|
||||
GLProfiler profiler_;
|
||||
|
||||
ErrorCallbackFn errorCallback_ = nullptr;
|
||||
void *errorCallbackUserData_ = nullptr;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user