//#define USE_NSIGHT_CUSTOM_EVENTS
#ifdef USE_NSIGHT_CUSTOM_EVENTS
#include "nvToolsExt.h"

const uint32_t VRUT_Nsightcolors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff };
const int VRUT_Nsightnum_colors = sizeof(VRUT_Nsightcolors) / sizeof(uint32_t);

#define PUSH_RANGE(name, color_id) { \
	nvtxRangePushA(name); \
}
#define POP_RANGE nvtxRangePop();

class VRUT_NsightTracer {
public:
	VRUT_NsightTracer(const char* name, int color_id) {
		//PUSH_RANGE(name, color_id);
		color_id = color_id%VRUT_Nsightnum_colors;
		nvtxEventAttributes_t eventAttrib = { 0 };
		eventAttrib.version = NVTX_VERSION;
		eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
		eventAttrib.colorType = NVTX_COLOR_ARGB;
		eventAttrib.color = VRUT_Nsightcolors[color_id];
		eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
		eventAttrib.message.ascii = name;
		nvtxRangePushEx(&eventAttrib);
		//nvtxRangePushA(name);
	}
	~VRUT_NsightTracer() {
		nvtxRangePop();
	}
};
#else //USE_NSIGHT_CUSTOM_EVENTS
#define PUSH_RANGE(name, color_id)
#define POP_RANGE
#endif //USE_NSIGHT_CUSTOM_EVENTS