mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:47:41 +02:00
Merge pull request #5278 from samcake/yellow
Adding more NSight instrumentation
This commit is contained in:
commit
b173ac397c
10 changed files with 55 additions and 18 deletions
|
@ -1183,7 +1183,6 @@ bool Application::event(QEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::eventFilter(QObject* object, QEvent* event) {
|
bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
|
||||||
if (event->type() == QEvent::ShortcutOverride) {
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
if (DependencyManager::get<OffscreenUi>()->shouldSwallowShortcut(event)) {
|
if (DependencyManager::get<OffscreenUi>()->shouldSwallowShortcut(event)) {
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -1788,6 +1787,7 @@ void Application::checkFPS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::idle() {
|
void Application::idle() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
static SimpleAverage<float> interIdleDurations;
|
static SimpleAverage<float> interIdleDurations;
|
||||||
static uint64_t lastIdleEnd{ 0 };
|
static uint64_t lastIdleEnd{ 0 };
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ void GLCanvas::initializeGL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas::paintGL() {
|
void GLCanvas::paintGL() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
if (!_throttleRendering && !Application::getInstance()->getWindow()->isMinimized()) {
|
if (!_throttleRendering && !Application::getInstance()->getWindow()->isMinimized()) {
|
||||||
Application::getInstance()->paintGL();
|
Application::getInstance()->paintGL();
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ namespace render {
|
||||||
template <> void payloadRender(const RenderableModelEntityItemMeta::Pointer& payload, RenderArgs* args) {
|
template <> void payloadRender(const RenderableModelEntityItemMeta::Pointer& payload, RenderArgs* args) {
|
||||||
if (args) {
|
if (args) {
|
||||||
if (payload && payload->entity) {
|
if (payload && payload->entity) {
|
||||||
|
PROFILE_RANGE("MetaModelRender");
|
||||||
payload->entity->render(args);
|
payload->entity->render(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,17 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#if defined(NSIGHT_FOUND)
|
||||||
|
#include "nvToolsExt.h"
|
||||||
|
|
||||||
|
ProfileRange::ProfileRange(const char *name) {
|
||||||
|
nvtxRangePush(name);
|
||||||
|
}
|
||||||
|
ProfileRange::~ProfileRange() {
|
||||||
|
nvtxRangePop();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ADD_COMMAND(call) _commands.push_back(COMMAND_##call); _commandOffsets.push_back(_params.size());
|
#define ADD_COMMAND(call) _commands.push_back(COMMAND_##call); _commandOffsets.push_back(_params.size());
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
|
|
@ -26,17 +26,11 @@
|
||||||
#include "Framebuffer.h"
|
#include "Framebuffer.h"
|
||||||
|
|
||||||
#if defined(NSIGHT_FOUND)
|
#if defined(NSIGHT_FOUND)
|
||||||
#include "nvToolsExt.h"
|
|
||||||
class ProfileRange {
|
class ProfileRange {
|
||||||
public:
|
public:
|
||||||
ProfileRange(const char *name) {
|
ProfileRange(const char *name);
|
||||||
nvtxRangePush(name);
|
~ProfileRange();
|
||||||
}
|
|
||||||
~ProfileRange() {
|
|
||||||
nvtxRangePop();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||||
#else
|
#else
|
||||||
#define PROFILE_RANGE(name)
|
#define PROFILE_RANGE(name)
|
||||||
|
|
|
@ -33,9 +33,11 @@ bool Context::makeProgram(Shader& shader, const Shader::BindingSet& bindings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::render(Batch& batch) {
|
void Context::render(Batch& batch) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
_backend->render(batch);
|
_backend->render(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::syncCache() {
|
void Context::syncCache() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
_backend->syncCache();
|
_backend->syncCache();
|
||||||
}
|
}
|
|
@ -417,6 +417,7 @@ void Model::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::updateGeometry() {
|
bool Model::updateGeometry() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
bool needFullUpdate = false;
|
bool needFullUpdate = false;
|
||||||
|
|
||||||
bool needToRebuild = false;
|
bool needToRebuild = false;
|
||||||
|
@ -690,6 +691,7 @@ void Model::recalculateMeshPartOffsets() {
|
||||||
// entity-scripts to call. I think it would be best to do the picking once-per-frame (in cpu, or gpu if possible)
|
// entity-scripts to call. I think it would be best to do the picking once-per-frame (in cpu, or gpu if possible)
|
||||||
// and then the calls use the most recent such result.
|
// and then the calls use the most recent such result.
|
||||||
void Model::recalculateMeshBoxes(bool pickAgainstTriangles) {
|
void Model::recalculateMeshBoxes(bool pickAgainstTriangles) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
bool calculatedMeshTrianglesNeeded = pickAgainstTriangles && !_calculatedMeshTrianglesValid;
|
bool calculatedMeshTrianglesNeeded = pickAgainstTriangles && !_calculatedMeshTrianglesValid;
|
||||||
|
|
||||||
if (!_calculatedMeshBoxesValid || calculatedMeshTrianglesNeeded || (!_calculatedMeshPartBoxesValid && pickAgainstTriangles) ) {
|
if (!_calculatedMeshBoxesValid || calculatedMeshTrianglesNeeded || (!_calculatedMeshPartBoxesValid && pickAgainstTriangles) ) {
|
||||||
|
@ -1281,6 +1283,7 @@ Blender::Blender(Model* model, int blendNumber, const QWeakPointer<NetworkGeomet
|
||||||
}
|
}
|
||||||
|
|
||||||
void Blender::run() {
|
void Blender::run() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
QVector<glm::vec3> vertices, normals;
|
QVector<glm::vec3> vertices, normals;
|
||||||
if (!_model.isNull()) {
|
if (!_model.isNull()) {
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
@ -1392,6 +1395,7 @@ void Model::snapToRegistrationPoint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::simulate(float deltaTime, bool fullUpdate) {
|
void Model::simulate(float deltaTime, bool fullUpdate) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit)
|
fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit)
|
||||||
|| (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint);
|
|| (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint);
|
||||||
|
|
||||||
|
@ -1829,6 +1833,7 @@ void Model::setupBatchTransform(gpu::Batch& batch, RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AABox Model::getPartBounds(int meshIndex, int partIndex) {
|
AABox Model::getPartBounds(int meshIndex, int partIndex) {
|
||||||
|
|
||||||
if (meshIndex < _meshStates.size()) {
|
if (meshIndex < _meshStates.size()) {
|
||||||
const MeshState& state = _meshStates.at(meshIndex);
|
const MeshState& state = _meshStates.at(meshIndex);
|
||||||
bool isSkinned = state.clusterMatrices.size() > 1;
|
bool isSkinned = state.clusterMatrices.size() > 1;
|
||||||
|
@ -1859,6 +1864,7 @@ AABox Model::getPartBounds(int meshIndex, int partIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool translucent) {
|
void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool translucent) {
|
||||||
|
// PROFILE_RANGE(__FUNCTION__);
|
||||||
PerformanceTimer perfTimer("Model::renderPart");
|
PerformanceTimer perfTimer("Model::renderPart");
|
||||||
if (!_readyWhenAdded) {
|
if (!_readyWhenAdded) {
|
||||||
return; // bail asap
|
return; // bail asap
|
||||||
|
@ -1933,7 +1939,9 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran
|
||||||
pickPrograms(batch, mode, translucentMesh, alphaThreshold, hasLightmap, hasTangents, hasSpecular, isSkinned, wireframe,
|
pickPrograms(batch, mode, translucentMesh, alphaThreshold, hasLightmap, hasTangents, hasSpecular, isSkinned, wireframe,
|
||||||
args, locations);
|
args, locations);
|
||||||
|
|
||||||
updateVisibleJointStates();
|
{
|
||||||
|
updateVisibleJointStates();
|
||||||
|
}
|
||||||
|
|
||||||
// if our index is ever out of range for either meshes or networkMeshes, then skip it, and set our _meshGroupsKnown
|
// if our index is ever out of range for either meshes or networkMeshes, then skip it, and set our _meshGroupsKnown
|
||||||
// to false to rebuild out mesh groups.
|
// to false to rebuild out mesh groups.
|
||||||
|
@ -2076,9 +2084,13 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_mutex.lock();
|
qint64 offset;
|
||||||
qint64 offset = _calculatedMeshPartOffset[QPair<int,int>(meshIndex, partIndex)];
|
{
|
||||||
_mutex.unlock();
|
// FIXME_STUTTER: We should n't have any lock here
|
||||||
|
_mutex.lock();
|
||||||
|
offset = _calculatedMeshPartOffset[QPair<int,int>(meshIndex, partIndex)];
|
||||||
|
_mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
if (part.quadIndices.size() > 0) {
|
if (part.quadIndices.size() > 0) {
|
||||||
batch.drawIndexed(gpu::QUADS, part.quadIndices.size(), offset);
|
batch.drawIndexed(gpu::QUADS, part.quadIndices.size(), offset);
|
||||||
|
|
|
@ -9,4 +9,16 @@ add_dependency_external_projects(glm)
|
||||||
find_package(GLM REQUIRED)
|
find_package(GLM REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
||||||
|
|
||||||
link_hifi_libraries(shared gpu model)
|
link_hifi_libraries(shared gpu model)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
if (USE_NSIGHT)
|
||||||
|
# try to find the Nsight package and add it to the build if we find it
|
||||||
|
find_package(NSIGHT)
|
||||||
|
if (NSIGHT_FOUND)
|
||||||
|
include_directories(${NSIGHT_INCLUDE_DIRS})
|
||||||
|
add_definitions(-DNSIGHT_FOUND)
|
||||||
|
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
endif (WIN32)
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Scene.h"
|
#include "Scene.h"
|
||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include "gpu/Batch.h"
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
|
@ -167,6 +168,7 @@ void consolidateChangeQueue(PendingChangesQueue& queue, PendingChanges& singleBa
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::processPendingChangesQueue() {
|
void Scene::processPendingChangesQueue() {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
_changeQueueMutex.lock();
|
_changeQueueMutex.lock();
|
||||||
PendingChanges consolidatedPendingChanges;
|
PendingChanges consolidatedPendingChanges;
|
||||||
consolidateChangeQueue(_changeQueue, consolidatedPendingChanges);
|
consolidateChangeQueue(_changeQueue, consolidatedPendingChanges);
|
||||||
|
|
|
@ -22,10 +22,10 @@ uniform vec3 inBoundPos;
|
||||||
uniform vec3 inBoundDim;
|
uniform vec3 inBoundDim;
|
||||||
uniform ivec4 inStatus;
|
uniform ivec4 inStatus;
|
||||||
|
|
||||||
vec3 paintRainbow(float nv) {
|
vec3 paintRainbow(float normalizedHue) {
|
||||||
float v = nv * 5.f;
|
float v = normalizedHue * 6.f;
|
||||||
if (v < 0.f) {
|
if (v < 0.f) {
|
||||||
return vec3(0.f, 0.f, 0.f);
|
return vec3(1.f, 0.f, 0.f);
|
||||||
} else if (v < 1.f) {
|
} else if (v < 1.f) {
|
||||||
return vec3(1.f, v, 0.f);
|
return vec3(1.f, v, 0.f);
|
||||||
} else if (v < 2.f) {
|
} else if (v < 2.f) {
|
||||||
|
@ -36,8 +36,10 @@ vec3 paintRainbow(float nv) {
|
||||||
return vec3(0.f, 1.f - (v-3.f), 1.f );
|
return vec3(0.f, 1.f - (v-3.f), 1.f );
|
||||||
} else if (v < 5.f) {
|
} else if (v < 5.f) {
|
||||||
return vec3((v-4.f), 0.f, 1.f );
|
return vec3((v-4.f), 0.f, 1.f );
|
||||||
|
} else if (v < 6.f) {
|
||||||
|
return vec3(1.f, 0.f, 1.f - (v-5.f));
|
||||||
} else {
|
} else {
|
||||||
return vec3(1.f, 1.f, 1.f);
|
return vec3(1.f, 0.f, 0.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue