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 "../gl/src/gl/GLHelpers.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(NSIGHT_FOUND)
|
||||
#include "nvToolsExt.h"
|
||||
|
||||
ProfileRange::ProfileRange(const char *name) {
|
||||
if (!isRenderThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nvtxRangePush(name);
|
||||
_rangeId = nvtxRangeStart(name);
|
||||
}
|
||||
|
||||
ProfileRange::ProfileRange(const char *name, uint32_t argbColor, uint64_t payload) {
|
||||
if (!isRenderThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nvtxEventAttributes_t eventAttrib = {0};
|
||||
eventAttrib.version = NVTX_VERSION;
|
||||
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.payloadType = NVTX_PAYLOAD_TYPE_UNSIGNED_INT64;
|
||||
|
||||
nvtxRangePushEx(&eventAttrib);
|
||||
_rangeId = nvtxRangeStartEx(&eventAttrib);
|
||||
}
|
||||
|
||||
ProfileRange::~ProfileRange() {
|
||||
if (!isRenderThread()) {
|
||||
return;
|
||||
}
|
||||
nvtxRangePop();
|
||||
nvtxRangeEnd(_rangeId);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -17,6 +17,10 @@ public:
|
|||
ProfileRange(const char *name);
|
||||
ProfileRange(const char *name, uint32_t argbColor, uint64_t payload);
|
||||
~ProfileRange();
|
||||
private:
|
||||
#if defined(NSIGHT_FOUND)
|
||||
uint64_t _rangeId{ 0 };
|
||||
#endif
|
||||
};
|
||||
|
||||
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||
|
|
Loading…
Reference in a new issue