mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 21:42:13 +02:00
Adding nsight instrumenting to the QML render thread
This commit is contained in:
parent
265bd8ee67
commit
ae1345bb13
6 changed files with 67 additions and 36 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <QtCore/QMutex>
|
||||
#include <QtGui/QOpenGLContext>
|
||||
|
||||
#include <shared/NsightHelpers.h>
|
||||
#include <PerfStat.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include "GLEscrow.h"
|
||||
#include "OffscreenGLCanvas.h"
|
||||
|
||||
|
||||
// Time between receiving a request to render the offscreen UI actually triggering
|
||||
// the render. Could possibly be increased depending on the framerate we expect to
|
||||
// achieve.
|
||||
|
@ -220,9 +222,6 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
//Q_ASSERT(toGlm(_quickWindow->geometry().size()) == _size);
|
||||
//Q_ASSERT(toGlm(_quickWindow->geometry().size()) == _textures._size);
|
||||
|
||||
_renderControl->sync();
|
||||
_cond.wakeOne();
|
||||
lock->unlock();
|
||||
|
@ -231,22 +230,24 @@ private:
|
|||
|
||||
_quickWindow->setRenderTarget(GetName(*_fbo), QSize(_size.x, _size.y));
|
||||
|
||||
TexturePtr texture = _textures.getNextTexture();
|
||||
_fbo->Bind(Framebuffer::Target::Draw);
|
||||
_fbo->AttachTexture(Framebuffer::Target::Draw, FramebufferAttachment::Color, *texture, 0);
|
||||
_fbo->Complete(Framebuffer::Target::Draw);
|
||||
//Context::Clear().ColorBuffer();
|
||||
{
|
||||
_renderControl->render();
|
||||
// FIXME The web browsers seem to be leaving GL in an error state.
|
||||
// Need a debug context with sync logging to figure out why.
|
||||
// for now just clear the errors
|
||||
glGetError();
|
||||
PROFILE_RANGE("qml_render")
|
||||
TexturePtr texture = _textures.getNextTexture();
|
||||
_fbo->Bind(Framebuffer::Target::Draw);
|
||||
_fbo->AttachTexture(Framebuffer::Target::Draw, FramebufferAttachment::Color, *texture, 0);
|
||||
_fbo->Complete(Framebuffer::Target::Draw);
|
||||
{
|
||||
_renderControl->render();
|
||||
// FIXME The web browsers seem to be leaving GL in an error state.
|
||||
// Need a debug context with sync logging to figure out why.
|
||||
// for now just clear the errors
|
||||
glGetError();
|
||||
}
|
||||
// FIXME probably unecessary
|
||||
DefaultFramebuffer().Bind(Framebuffer::Target::Draw);
|
||||
_quickWindow->resetOpenGLState();
|
||||
_escrow.submit(GetName(*texture));
|
||||
}
|
||||
// FIXME probably unecessary
|
||||
DefaultFramebuffer().Bind(Framebuffer::Target::Draw);
|
||||
_quickWindow->resetOpenGLState();
|
||||
_escrow.submit(GetName(*texture));
|
||||
_lastRenderTime = usecTimestampNow();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,6 @@
|
|||
#if defined(NSIGHT_FOUND)
|
||||
#include "nvToolsExt.h"
|
||||
|
||||
ProfileRange::ProfileRange(const char *name) {
|
||||
nvtxRangePush(name);
|
||||
}
|
||||
ProfileRange::~ProfileRange() {
|
||||
nvtxRangePop();
|
||||
}
|
||||
|
||||
ProfileRangeBatch::ProfileRangeBatch(gpu::Batch& batch, const char *name) : _batch(batch) {
|
||||
_batch.pushProfileRange(name);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <mutex>
|
||||
#include <functional>
|
||||
|
||||
#include <shared/NsightHelpers.h>
|
||||
|
||||
#include "Framebuffer.h"
|
||||
#include "Pipeline.h"
|
||||
#include "Query.h"
|
||||
|
@ -22,18 +24,6 @@
|
|||
#include "Texture.h"
|
||||
#include "Transform.h"
|
||||
|
||||
|
||||
#if defined(NSIGHT_FOUND)
|
||||
class ProfileRange {
|
||||
public:
|
||||
ProfileRange(const char *name);
|
||||
~ProfileRange();
|
||||
};
|
||||
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||
#else
|
||||
#define PROFILE_RANGE(name)
|
||||
#endif
|
||||
|
||||
class QDebug;
|
||||
|
||||
namespace gpu {
|
||||
|
|
|
@ -4,3 +4,4 @@ set(TARGET_NAME shared)
|
|||
setup_hifi_library(Gui Network Script Widgets)
|
||||
|
||||
target_zlib()
|
||||
target_nsight()
|
||||
|
|
22
libraries/shared/src/shared/NsightHelpers.cpp
Normal file
22
libraries/shared/src/shared/NsightHelpers.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2015/12/10
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "NsightHelpers.h"
|
||||
|
||||
#if defined(NSIGHT_FOUND)
|
||||
#include "nvToolsExt.h"
|
||||
|
||||
ProfileRange::ProfileRange(const char *name) {
|
||||
nvtxRangePush(name);
|
||||
}
|
||||
|
||||
ProfileRange::~ProfileRange() {
|
||||
nvtxRangePop();
|
||||
}
|
||||
|
||||
#endif
|
24
libraries/shared/src/shared/NsightHelpers.h
Normal file
24
libraries/shared/src/shared/NsightHelpers.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2015/12/10
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#pragma once
|
||||
#ifndef hifi_gl_NsightHelpers_h
|
||||
#define hifi_gl_NsightHelpers_h
|
||||
|
||||
#if defined(NSIGHT_FOUND)
|
||||
class ProfileRange {
|
||||
public:
|
||||
ProfileRange(const char *name);
|
||||
~ProfileRange();
|
||||
};
|
||||
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||
#else
|
||||
#define PROFILE_RANGE(name)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue