Cogs.Core
Source
Platform
Instrumentation.h
1
#pragma once
2
3
#include "Base.h"
4
5
#ifdef COGS_USE_SUPERLUMINAL
6
#include <Superluminal/PerformanceAPI.h>
7
#endif
8
9
#ifdef COGS_USE_MICROPROFILE
10
#include <microprofile.h>
11
#endif
12
13
namespace
Cogs
14
{
15
struct
IContext;
16
17
namespace
Core
18
{
19
class
Context;
20
21
namespace
Instrumentation
22
{
23
void
initialize(Context * context);
24
void
initializeGpu(Context * context);
25
26
void
beginGpuThread(IContext * context);
27
28
COGSCORE_DLL_API
void
initializeThread(
const
char
* name);
29
COGSCORE_DLL_API
void
destroyThread();
30
31
COGSCORE_DLL_API
void
beginGpuScope(IContext* iContext,
const
char
* name);
32
COGSCORE_DLL_API
void
endGpuScope(IContext* iContext);
33
34
struct
RenderScope
35
{
36
RenderScope
(
IContext
* iContext,
const
char
* name) : iContext(iContext) { beginGpuScope(iContext, name); }
37
~RenderScope
() { endGpuScope(iContext); }
38
39
IContext
* iContext =
nullptr
;
40
};
41
}
42
}
43
}
44
59
#define SCOPE_APPLICATION SCOPE_APPLICATION
60
#define SCOPE_ENGINE SCOPE_ENGINE
61
#define SCOPE_RENDERING SCOPE_RENDERING
62
#define SCOPE_GEOMETRY SCOPE_GEOMETRY
63
#define SCOPE_BOUNDS SCOPE_BOUNDS
64
#define SCOPE_RAYPICK SCOPE_RAYPICK
65
#define SCOPE_SYSTEMS SCOPE_SYSTEMS
66
#define SCOPE_PARALLEL SCOPE_PARALLEL
67
#define SCOPE_TASKMANAGER SCOPE_TASKMANAGER
68
#define SCOPE_ASSETSYSTEM SCOPE_ASSETSYSTEM
69
#define SCOPE_RESOURCES SCOPE_RESOURCES
70
#define SCOPE_EDITOR_COMMAND SCOPE_EDITOR_COMMAND
71
#define SCOPE_ECHOSOUNDER SCOPE_ECHOSOUNDER
72
#define SCOPE_ISOSURFACES SCOPE_ISOSURFACES
73
#define SCOPE_NVENC SCOPE_NVENC
74
#define SCOPE_PHYSICS SCOPE_PHYSICS
75
#define SCOPE_POTREE SCOPE_POTREE
76
#define SCOPE_RATIONALREDUCER SCOPE_RATIONALREDUCER
77
#define SCOPE_VOLUMETRIC SCOPE_VOLUMETRIC
78
#define SCOPE_OGC3DTILES SCOPE_OGC3DTILES
79
80
#define SCOPE_APPLICATION_NAME "Application"
81
#define SCOPE_ENGINE_NAME "Engine"
82
#define SCOPE_RENDERING_NAME "Rendering"
83
#define SCOPE_GEOMETRY_NAME "Geometry"
84
#define SCOPE_BOUNDS_NAME "Bounds"
85
#define SCOPE_RAYPICK_NAME "Raypick"
86
#define SCOPE_SYSTEMS_NAME "Systems"
87
#define SCOPE_PARALLEL_NAME "Parallel"
88
#define SCOPE_TASKMANAGER_NAME "TaskManager"
89
#define SCOPE_ASSETSYSTEM_NAME "AssetSystem"
90
#define SCOPE_RESOURCES_NAME "Resources"
91
#define SCOPE_EDITOR_COMMAND_NAME "EditorCommand"
92
#define SCOPE_ECHOSOUNDER_NAME "EchoSounder"
93
#define SCOPE_ISOSURFACES_NAME "IsoSurfaces"
94
#define SCOPE_NVENC_NAME "NVEnc"
95
#define SCOPE_PHYSICS_NAME "Physics"
96
#define SCOPE_POTREE_NAME "Potree"
97
#define SCOPE_RATIONALREDUCER_NAME "RationalReducer"
98
#define SCOPE_VOLUMETRIC_NAME "Volumetric"
99
#define SCOPE_OGC3DTILES_NAME "OGC3DTiles"
100
101
#define SCOPE_APPLICATION_COLOR 0x804000u
102
#define SCOPE_ENGINE_COLOR 0xFFCC00u
103
#define SCOPE_RENDERING_COLOR 0x7A5299u
104
#define SCOPE_GEOMETRY_COLOR 0x9400D3u
105
#define SCOPE_BOUNDS_COLOR 0xEE82EEu
106
#define SCOPE_RAYPICK_COLOR 0x00CED1u
107
#define SCOPE_SYSTEMS_COLOR 0x8B0000u
108
#define SCOPE_PARALLEL_COLOR 0xE75480u
109
#define SCOPE_TASKMANAGER_COLOR 0xD9A465u
110
#define SCOPE_ASSETSYSTEM_COLOR 0xFF8C00u
111
#define SCOPE_RESOURCES_COLOR 0x7C7C40u
112
#define SCOPE_EDITOR_COMMAND_COLOR 0x90EE90u
113
#define SCOPE_ECHOSOUNDER_COLOR 0x006400u
114
#define SCOPE_ISOSURFACES_COLOR 0x008000u
115
#define SCOPE_NVENC_COLOR 0x30D5C8u
116
#define SCOPE_PHYSICS_COLOR 0xEEDD62u
117
#define SCOPE_POTREE_COLOR 0x976638u
118
#define SCOPE_RATIONALREDUCER_COLOR 0xFFD700u
119
#define SCOPE_VOLUMETRIC_COLOR 0xF0DC82u
120
#define SCOPE_OGC3DTILES_COLOR 0xFFD700u
121
122
#define SCOPE_NAME_HELPER_(X,Y) X##Y
123
#define SCOPE_NAME_HELPER(X,Y) SCOPE_NAME_HELPER_(X, Y)
124
125
#if defined(COGS_USE_SUPERLUMINAL)
126
127
#define SCOPE_GENNAME(group, name) (group##_NAME##"_"
##name)
128
#define CpuInstrumentationScope(group, name) PERFORMANCEAPI_INSTRUMENT_COLOR(SCOPE_GENNAME(group, name), group##_COLOR)
129
#define CpuInstrumentationScope_(group, name) PERFORMANCEAPI_INSTRUMENT_COLOR(name, group##_COLOR)
130
#define DynamicCpuInstrumentationScope(group, name, dynamicName) PERFORMANCEAPI_INSTRUMENT_DATA_COLOR(SCOPE_GENNAME(group, name), dynamicName, group##_COLOR)
131
#define DynamicCpuInstrumentationScopeParam(group, name, dynamicName, dynamicParam) PERFORMANCEAPI_INSTRUMENT_DATA_COLOR(SCOPE_GENNAME(group, name), dynamicName, group##_COLOR)
132
#define RenderInstrumentationScope(context, group, name) PERFORMANCEAPI_INSTRUMENT_COLOR(SCOPE_GENNAME(group, name), group##_COLOR); \
133
Cogs::Core::Instrumentation::RenderScope SCOPE_NAME_HELPER(scope,__LINE__)(context, SCOPE_GENNAME(group, name))
134
#define DynamicRenderInstrumentationScope(context, group, name, dynamicName) PERFORMANCEAPI_INSTRUMENT_DATA_COLOR(SCOPE_GENNAME(group, name), dynamicName, group##_COLOR); \
135
Cogs::Core::Instrumentation::RenderScope SCOPE_NAME_HELPER(scope,__LINE__)(context, SCOPE_GENNAME(group, name))
136
137
#elif defined(COGS_USE_MICROPROFILE)
138
139
#define SCOPE_GENNAME(group, name) (name)
140
#define CpuInstrumentationScope(group, name) MICROPROFILE_SCOPEI(group##_NAME, name, group##_COLOR)
141
#define CpuInstrumentationScope_(group, name) MICROPROFILE_SCOPEI(group##_NAME, name, group##_COLOR)
142
#define DynamicCpuInstrumentationScope(group, name, dynamicName) MICROPROFILE_SCOPEI(group##_NAME, name, group##_COLOR)
143
#define DynamicCpuInstrumentationScopeParam(group, name, dynamicName, dynamicParam) MICROPROFILE_SCOPEI(group##_NAME, name, group##_COLOR)
144
#define RenderInstrumentationScope(context, group, name) MICROPROFILE_SCOPEI(group##_NAME, name, group##_COLOR); \
145
MICROPROFILE_SCOPEGPUI(name, group##_COLOR); \
146
Cogs::Core::Instrumentation::RenderScope SCOPE_NAME_HELPER(scope,__LINE__)(context, name)
147
#define DynamicRenderInstrumentationScope(context, group, name, dynamicName) MICROPROFILE_SCOPEI(group##_NAME, name, group##_COLOR); \
148
MICROPROFILE_SCOPEGPUI(name, group##_COLOR); \
149
Cogs::Core::Instrumentation::RenderScope SCOPE_NAME_HELPER(scope,__LINE__)(context, name)
150
151
#else
152
153
#define SCOPE_GENNAME(group, name) (name)
154
#define CpuInstrumentationScope(group, name)
155
#define CpuInstrumentationScope_(group, name) do { (void)(name); } while (0)
156
#define DynamicCpuInstrumentationScope(group, name, dynamicName) do { (void)(name); (void)(dynamicName); } while (0)
157
#define DynamicCpuInstrumentationScopeParam(group, name, dynamicName, dynamicParam) do { (void)(name); (void)(dynamicName); (void)(dynamicParam); } while (0)
158
#define RenderInstrumentationScope(context, group, name) do { (void)(context); (void)(name); } while (0)
159
#define DynamicRenderInstrumentationScope(context, group, name, dynamicName) do { (void)(context); (void)(name); (void)(dynamicName); } while (0)
160
161
#endif
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::Core::Instrumentation::RenderScope
Definition:
Instrumentation.h:35
Cogs::IContext
Represents a graphics device context which can receive rendering commands.
Definition:
IContext.h:43
Generated by
1.9.6