mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Use ranges instead of stacks for nSight
This commit is contained in:
parent
51a6f3552f
commit
42dcae72cb
2 changed files with 7 additions and 16 deletions
|
@ -8,25 +8,15 @@
|
||||||
|
|
||||||
#include "NsightHelpers.h"
|
#include "NsightHelpers.h"
|
||||||
|
|
||||||
#include "../gl/src/gl/GLHelpers.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#if defined(NSIGHT_FOUND)
|
#if defined(NSIGHT_FOUND)
|
||||||
#include "nvToolsExt.h"
|
#include "nvToolsExt.h"
|
||||||
|
|
||||||
ProfileRange::ProfileRange(const char *name) {
|
ProfileRange::ProfileRange(const char *name) {
|
||||||
if (!isRenderThread()) {
|
_rangeId = nvtxRangeStart(name);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nvtxRangePush(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileRange::ProfileRange(const char *name, uint32_t argbColor, uint64_t payload) {
|
ProfileRange::ProfileRange(const char *name, uint32_t argbColor, uint64_t payload) {
|
||||||
if (!isRenderThread()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nvtxEventAttributes_t eventAttrib = {0};
|
nvtxEventAttributes_t eventAttrib = {0};
|
||||||
eventAttrib.version = NVTX_VERSION;
|
eventAttrib.version = NVTX_VERSION;
|
||||||
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
|
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
|
||||||
|
@ -37,14 +27,11 @@ ProfileRange::ProfileRange(const char *name, uint32_t argbColor, uint64_t payloa
|
||||||
eventAttrib.payload.llValue = payload;
|
eventAttrib.payload.llValue = payload;
|
||||||
eventAttrib.payloadType = NVTX_PAYLOAD_TYPE_UNSIGNED_INT64;
|
eventAttrib.payloadType = NVTX_PAYLOAD_TYPE_UNSIGNED_INT64;
|
||||||
|
|
||||||
nvtxRangePushEx(&eventAttrib);
|
_rangeId = nvtxRangeStartEx(&eventAttrib);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileRange::~ProfileRange() {
|
ProfileRange::~ProfileRange() {
|
||||||
if (!isRenderThread()) {
|
nvtxRangeEnd(_rangeId);
|
||||||
return;
|
|
||||||
}
|
|
||||||
nvtxRangePop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -17,6 +17,10 @@ public:
|
||||||
ProfileRange(const char *name);
|
ProfileRange(const char *name);
|
||||||
ProfileRange(const char *name, uint32_t argbColor, uint64_t payload);
|
ProfileRange(const char *name, uint32_t argbColor, uint64_t payload);
|
||||||
~ProfileRange();
|
~ProfileRange();
|
||||||
|
private:
|
||||||
|
#if defined(NSIGHT_FOUND)
|
||||||
|
uint64_t _rangeId{ 0 };
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||||
|
|
Loading…
Reference in a new issue