mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:01:18 +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 <QtCore/QMutex>
|
||||||
#include <QtGui/QOpenGLContext>
|
#include <QtGui/QOpenGLContext>
|
||||||
|
|
||||||
|
#include <shared/NsightHelpers.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
#include "GLEscrow.h"
|
#include "GLEscrow.h"
|
||||||
#include "OffscreenGLCanvas.h"
|
#include "OffscreenGLCanvas.h"
|
||||||
|
|
||||||
|
|
||||||
// Time between receiving a request to render the offscreen UI actually triggering
|
// 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
|
// the render. Could possibly be increased depending on the framerate we expect to
|
||||||
// achieve.
|
// achieve.
|
||||||
|
@ -220,9 +222,6 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Q_ASSERT(toGlm(_quickWindow->geometry().size()) == _size);
|
|
||||||
//Q_ASSERT(toGlm(_quickWindow->geometry().size()) == _textures._size);
|
|
||||||
|
|
||||||
_renderControl->sync();
|
_renderControl->sync();
|
||||||
_cond.wakeOne();
|
_cond.wakeOne();
|
||||||
lock->unlock();
|
lock->unlock();
|
||||||
|
@ -231,22 +230,24 @@ private:
|
||||||
|
|
||||||
_quickWindow->setRenderTarget(GetName(*_fbo), QSize(_size.x, _size.y));
|
_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();
|
PROFILE_RANGE("qml_render")
|
||||||
// FIXME The web browsers seem to be leaving GL in an error state.
|
TexturePtr texture = _textures.getNextTexture();
|
||||||
// Need a debug context with sync logging to figure out why.
|
_fbo->Bind(Framebuffer::Target::Draw);
|
||||||
// for now just clear the errors
|
_fbo->AttachTexture(Framebuffer::Target::Draw, FramebufferAttachment::Color, *texture, 0);
|
||||||
glGetError();
|
_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();
|
_lastRenderTime = usecTimestampNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,6 @@
|
||||||
#if defined(NSIGHT_FOUND)
|
#if defined(NSIGHT_FOUND)
|
||||||
#include "nvToolsExt.h"
|
#include "nvToolsExt.h"
|
||||||
|
|
||||||
ProfileRange::ProfileRange(const char *name) {
|
|
||||||
nvtxRangePush(name);
|
|
||||||
}
|
|
||||||
ProfileRange::~ProfileRange() {
|
|
||||||
nvtxRangePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfileRangeBatch::ProfileRangeBatch(gpu::Batch& batch, const char *name) : _batch(batch) {
|
ProfileRangeBatch::ProfileRangeBatch(gpu::Batch& batch, const char *name) : _batch(batch) {
|
||||||
_batch.pushProfileRange(name);
|
_batch.pushProfileRange(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#include <shared/NsightHelpers.h>
|
||||||
|
|
||||||
#include "Framebuffer.h"
|
#include "Framebuffer.h"
|
||||||
#include "Pipeline.h"
|
#include "Pipeline.h"
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
|
@ -22,18 +24,6 @@
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "Transform.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;
|
class QDebug;
|
||||||
|
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
|
|
|
@ -4,3 +4,4 @@ set(TARGET_NAME shared)
|
||||||
setup_hifi_library(Gui Network Script Widgets)
|
setup_hifi_library(Gui Network Script Widgets)
|
||||||
|
|
||||||
target_zlib()
|
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