mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 13:12:52 +02:00
Starting adding a timer for the frame
This commit is contained in:
parent
4f0f64e2b5
commit
7655f906f1
3 changed files with 18 additions and 0 deletions
|
@ -1238,7 +1238,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
|
||||
auto glInfo = getGLContextData();
|
||||
properties["gl_info"] = glInfo;
|
||||
properties["gpu_used_memory"] = (int)BYTES_TO_MB(gpu::Context::getUsedGPUMemory());
|
||||
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory());
|
||||
properties["gpu_frame_time"] = (int)(qApp->getRenderEngine()->);
|
||||
properties["ideal_thread_count"] = QThread::idealThreadCount();
|
||||
|
||||
auto hmdHeadPose = getHMDSensorPose();
|
||||
|
|
|
@ -34,6 +34,10 @@ void Context::beginFrame(const glm::mat4& renderPose) {
|
|||
_frameActive = true;
|
||||
_currentFrame = std::make_shared<Frame>();
|
||||
_currentFrame->pose = renderPose;
|
||||
|
||||
if (!_frameRangeTimer) {
|
||||
_frameRangeTimer = std::make_shared<RangeTimer>("gpu::Frame");
|
||||
}
|
||||
}
|
||||
|
||||
void Context::appendFrameBatch(Batch& batch) {
|
||||
|
@ -183,6 +187,10 @@ Size Context::getFreeGPUMemory() {
|
|||
return _freeGPUMemory.load();
|
||||
}
|
||||
|
||||
Size Context::getUsedGPUMemory() {
|
||||
return getTextureGPUMemoryUsage() + getBufferGPUMemoryUsage();
|
||||
};
|
||||
|
||||
void Context::incrementBufferGPUCount() {
|
||||
static std::atomic<uint32_t> max { 0 };
|
||||
auto total = ++_bufferGPUCount;
|
||||
|
|
|
@ -203,12 +203,16 @@ public:
|
|||
void getStats(ContextStats& stats) const;
|
||||
|
||||
|
||||
double getFrameTimerGPUAverage() const;
|
||||
double getFrameTimerBatchAverage() const;
|
||||
|
||||
static uint32_t getBufferGPUCount();
|
||||
static Size getBufferGPUMemoryUsage();
|
||||
|
||||
static uint32_t getTextureGPUCount();
|
||||
static uint32_t getTextureGPUSparseCount();
|
||||
static Size getFreeGPUMemory();
|
||||
static Size getUsedGPUMemory();
|
||||
static Size getTextureGPUMemoryUsage();
|
||||
static Size getTextureGPUVirtualMemoryUsage();
|
||||
static Size getTextureGPUFramebufferMemoryUsage();
|
||||
|
@ -221,8 +225,12 @@ protected:
|
|||
std::shared_ptr<Backend> _backend;
|
||||
bool _frameActive { false };
|
||||
FramePointer _currentFrame;
|
||||
RangeTimerPointer _frameRangeTimer;
|
||||
StereoState _stereo;
|
||||
|
||||
double getGPUAverage() const;
|
||||
double getBatchAverage() const;
|
||||
|
||||
// This function can only be called by "static Shader::makeProgram()"
|
||||
// makeProgramShader(...) make a program shader ready to be used in a Batch.
|
||||
// It compiles the sub shaders, link them and defines the Slots and their bindings.
|
||||
|
|
Loading…
Reference in a new issue