15#include <vsg/core/Inherit.h>
16#include <vsg/core/Version.h>
17#include <vsg/io/Logger.h>
18#include <vsg/maths/vec4.h>
31 uint8_t b = 255, g = 255, r = 255, a = 255;
33 constexpr uint_color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) :
34 b(blue), g(green), r(red), a(alpha) {}
57 virtual void setThreadName(
const std::string& )
const {};
71 virtual void finish()
const {};
89 instr(in_instr), sl(in_sl), object(in_object)
91 if (instr) instr->enter(sl, reference,
object);
95 if (instr) instr->leave(sl, reference,
object);
108 instr(in_instr), sl(in_sl), commandBuffer(in_commandBuffer), object(in_object)
110 if (instr) instr->enter(sl, reference, commandBuffer,
object);
114 if (instr) instr->leave(sl, reference, commandBuffer,
object);
126 instr(in_instr), sl(in_sl), commandBuffer(in_commandBuffer)
128 if (instr) instr->enterCommandBuffer(sl, reference, commandBuffer);
132 if (instr) instr->leaveCommandBuffer(sl, reference, commandBuffer);
137#define COLOR_VIEWER uint_color(127, 240, 240, 255)
138#define COLOR_UPDATE uint_color(0, 255, 0, 255)
139#define COLOR_GPU uint_color(255, 127, 0, 255)
140#define COLOR_RECORD_L1 uint_color(140, 247, 0, 255)
141#define COLOR_RECORD_L2 uint_color(176, 176, 0, 255)
142#define COLOR_RECORD_L3 COLOR_GPU
143#define COLOR_RECORD COLOR_RECORD_L1
144#define COLOR_COMPILE uint_color(255, 249, 64, 255)
145#define COLOR_PAGER uint_color(240, 255, 64, 255)
146#define COLOR_READ uint_color(0, 255, 128, 255)
147#define COLOR_WRITE uint_color(0, 128, 255, 255)
149#if defined(__clang__) || defined(__GNUC__)
150# define VsgFunctionName __PRETTY_FUNCTION__
151#elif defined(_MSC_VER)
152# define VsgFunctionName __FUNCSIG__
155#define __CPU_INSTRUMENTATION(level, instrumentation, name, color, object) \
156 static constexpr SourceLocation s_cpu_source_location_##__LINE__{name, VsgFunctionName, __FILE__, __LINE__, color, level}; \
157 CpuInstrumentation __cpu_scoped_instrumentation_##__LINE__(instrumentation, &(s_cpu_source_location_##__LINE__), object);
159#define __GPU_INSTRUMENTATION(level, instrumentation, cg, name, color, object) \
160 static constexpr SourceLocation s_gpu_source_location_##__LINE__{name, VsgFunctionName, __FILE__, __LINE__, color, level}; \
161 GpuInstrumentation __gpu_scoped_instrumentation_##__LINE__(instrumentation, &(s_gpu_source_location_##__LINE__), cg, object);
163#define __COMMAND_BUFFER_INSTRUMENTATION(level, instrumentation, cg, name, color) \
164 static constexpr SourceLocation s_cg_source_location_##__LINE__{name, VsgFunctionName, __FILE__, __LINE__, color, level}; \
165 CommandBufferInstrumentation __cg_scoped_instrumentation_##__LINE__(instrumentation, &(s_cg_source_location_##__LINE__), cg);
167#if VSG_MAX_INSTRUMENTATION_LEVEL >= 1
169# define CPU_INSTRUMENTATION_L1(instrumentation) __CPU_INSTRUMENTATION(1, instrumentation, nullptr, uint_color(255, 255, 255, 255), nullptr)
170# define CPU_INSTRUMENTATION_L1_N(instrumentation, name) __CPU_INSTRUMENTATION(1, instrumentation, name, uint_color(255, 255, 255, 255), nullptr)
171# define CPU_INSTRUMENTATION_L1_C(instrumentation, color) __CPU_INSTRUMENTATION(1, instrumentation, nullptr, color, nullptr)
172# define CPU_INSTRUMENTATION_L1_NC(instrumentation, name, color) __CPU_INSTRUMENTATION(1, instrumentation, name, color, nullptr)
174# define GPU_INSTRUMENTATION_L1(instrumentation, cg) __GPU_INSTRUMENTATION(1, instrumentation, cg, nullptr, uint_color(255, 255, 255, 255), nullptr)
175# define GPU_INSTRUMENTATION_L1_N(instrumentation, cg, name) __GPU_INSTRUMENTATION(1, instrumentation, cg, name, uint_color(255, 255, 255, 255), nullptr)
176# define GPU_INSTRUMENTATION_L1_C(instrumentation, cg, color) __GPU_INSTRUMENTATION(1, instrumentation, cg, nullptr, color, nullptr)
177# define GPU_INSTRUMENTATION_L1_NC(instrumentation, cg, name, color) __GPU_INSTRUMENTATION(1, instrumentation, cg, name, color, nullptr)
179# define CPU_INSTRUMENTATION_L1_O(instrumentation, object) __CPU_INSTRUMENTATION(1, instrumentation, nullptr, uint_color(255, 255, 255, 255), object)
180# define CPU_INSTRUMENTATION_L1_NO(instrumentation, name, object) __CPU_INSTRUMENTATION(1, instrumentation, name, uint_color(255, 255, 255, 255), object)
181# define CPU_INSTRUMENTATION_L1_CO(instrumentation, color, object) __CPU_INSTRUMENTATION(1, instrumentation, nullptr, color, object)
182# define CPU_INSTRUMENTATION_L1_NCO(instrumentation, name, color, object) __CPU_INSTRUMENTATION(1, instrumentation, name, color, object)
184# define GPU_INSTRUMENTATION_L1_O(instrumentation, cg, object) __GPU_INSTRUMENTATION(1, instrumentation, cg, nullptr, uint_color(255, 255, 255, 255), object)
185# define GPU_INSTRUMENTATION_L1_NO(instrumentation, cg, name, object) __GPU_INSTRUMENTATION(1, instrumentation, cg, name, uint_color(255, 255, 255, 255), object)
186# define GPU_INSTRUMENTATION_L1_CO(instrumentation, cg, color, object) __GPU_INSTRUMENTATION(1, instrumentation, cg, nullptr, color, object)
187# define GPU_INSTRUMENTATION_L1_NCO(instrumentation, cg, name, color, object) __GPU_INSTRUMENTATION(1, instrumentation, cg, name, color, object)
189# define COMMAND_BUFFER_INSTRUMENTATION(instrumentation, cg, name, color) __COMMAND_BUFFER_INSTRUMENTATION(1, instrumentation, cg, name, color)
193# define CPU_INSTRUMENTATION_L1(instrumentation)
194# define CPU_INSTRUMENTATION_L1_N(instrumentation, name)
195# define CPU_INSTRUMENTATION_L1_C(instrumentation, color)
196# define CPU_INSTRUMENTATION_L1_NC(instrumentation, name, color)
198# define GPU_INSTRUMENTATION_L1(instrumentation, cg)
199# define GPU_INSTRUMENTATION_L1_N(instrumentation, cg, name)
200# define GPU_INSTRUMENTATION_L1_C(instrumentation, cg, color)
201# define GPU_INSTRUMENTATION_L1_NC(instrumentation, cg, name, color)
203# define CPU_INSTRUMENTATION_L1_O(instrumentation, object)
204# define CPU_INSTRUMENTATION_L1_NO(instrumentation, name, object)
205# define CPU_INSTRUMENTATION_L1_CO(instrumentation, color, object)
206# define CPU_INSTRUMENTATION_L1_NCO(instrumentation, name, color, object)
208# define GPU_INSTRUMENTATION_L1_O(instrumentation, cg, object)
209# define GPU_INSTRUMENTATION_L1_NO(instrumentation, cg, name, object)
210# define GPU_INSTRUMENTATION_L1_CO(instrumentation, cg, color, object)
211# define GPU_INSTRUMENTATION_L1_NCO(instrumentation, cg, name, color, object)
213# define COMMAND_BUFFER_INSTRUMENTATION(instrumentation, cg, name, color)
217#if VSG_MAX_INSTRUMENTATION_LEVEL >= 2
219# define CPU_INSTRUMENTATION_L2(instrumentation) __CPU_INSTRUMENTATION(2, instrumentation, nullptr, uint_color(255, 255, 255, 255), nullptr)
220# define CPU_INSTRUMENTATION_L2_N(instrumentation, name) __CPU_INSTRUMENTATION(2, instrumentation, name, uint_color(255, 255, 255, 255), nullptr)
221# define CPU_INSTRUMENTATION_L2_C(instrumentation, color) __CPU_INSTRUMENTATION(2, instrumentation, nullptr, color, nullptr)
222# define CPU_INSTRUMENTATION_L2_NC(instrumentation, name, color) __CPU_INSTRUMENTATION(2, instrumentation, name, color, nullptr)
224# define GPU_INSTRUMENTATION_L2(instrumentation, cg) __GPU_INSTRUMENTATION(2, instrumentation, cg, nullptr, uint_color(255, 255, 255, 255), nullptr)
225# define GPU_INSTRUMENTATION_L2_N(instrumentation, cg, name) __GPU_INSTRUMENTATION(2, instrumentation, cg, name, uint_color(255, 255, 255, 255), nullptr)
226# define GPU_INSTRUMENTATION_L2_C(instrumentation, cg, color) __GPU_INSTRUMENTATION(2, instrumentation, cg, nullptr, color, nullptr)
227# define GPU_INSTRUMENTATION_L2_NC(instrumentation, cg, name, color) __GPU_INSTRUMENTATION(2, instrumentation, cg, name, color, nullptr)
229# define CPU_INSTRUMENTATION_L2_O(instrumentation, object) __CPU_INSTRUMENTATION(2, instrumentation, nullptr, uint_color(255, 255, 255, 255), object)
230# define CPU_INSTRUMENTATION_L2_NO(instrumentation, name, object) __CPU_INSTRUMENTATION(2, instrumentation, name, uint_color(255, 255, 255, 255), object)
231# define CPU_INSTRUMENTATION_L2_CO(instrumentation, color, object) __CPU_INSTRUMENTATION(2, instrumentation, nullptr, color, object)
232# define CPU_INSTRUMENTATION_L2_NCO(instrumentation, name, color, object) __CPU_INSTRUMENTATION(2, instrumentation, name, color, object)
234# define GPU_INSTRUMENTATION_L2_O(instrumentation, cg, object) __GPU_INSTRUMENTATION(2, instrumentation, cg, nullptr, uint_color(255, 255, 255, 255), object)
235# define GPU_INSTRUMENTATION_L2_NO(instrumentation, cg, name, object) __GPU_INSTRUMENTATION(2, instrumentation, cg, name, uint_color(255, 255, 255, 255), object)
236# define GPU_INSTRUMENTATION_L2_CO(instrumentation, cg, color, object) __GPU_INSTRUMENTATION(2, instrumentation, cg, nullptr, color, object)
237# define GPU_INSTRUMENTATION_L2_NCO(instrumentation, cg, name, color, object) __GPU_INSTRUMENTATION(2, instrumentation, cg, name, color, object)
241# define CPU_INSTRUMENTATION_L2(instrumentation)
242# define CPU_INSTRUMENTATION_L2_N(instrumentation, name)
243# define CPU_INSTRUMENTATION_L2_C(instrumentation, color)
244# define CPU_INSTRUMENTATION_L2_NC(instrumentation, name, color)
246# define GPU_INSTRUMENTATION_L2(instrumentation, cg)
247# define GPU_INSTRUMENTATION_L2_N(instrumentation, cg, name)
248# define GPU_INSTRUMENTATION_L2_C(instrumentation, cg, color)
249# define GPU_INSTRUMENTATION_L2_NC(instrumentation, cg, name, color)
251# define CPU_INSTRUMENTATION_L2_O(instrumentation, object)
252# define CPU_INSTRUMENTATION_L2_NO(instrumentation, name, object)
253# define CPU_INSTRUMENTATION_L2_CO(instrumentation, color, object)
254# define CPU_INSTRUMENTATION_L2_NCO(instrumentation, name, color, object)
256# define GPU_INSTRUMENTATION_L2_O(instrumentation, cg, object)
257# define GPU_INSTRUMENTATION_L2_NO(instrumentation, cg, name, object)
258# define GPU_INSTRUMENTATION_L2_CO(instrumentation, cg, color, object)
259# define GPU_INSTRUMENTATION_L2_NCO(instrumentation, cg, name, color, object)
263#if VSG_MAX_INSTRUMENTATION_LEVEL >= 3
265# define CPU_INSTRUMENTATION_L3(instrumentation) __CPU_INSTRUMENTATION(3, instrumentation, nullptr, uint_color(255, 255, 255, 255), nullptr)
266# define CPU_INSTRUMENTATION_L3_N(instrumentation, name) __CPU_INSTRUMENTATION(3, instrumentation, name, uint_color(255, 255, 255, 255), nullptr)
267# define CPU_INSTRUMENTATION_L3_C(instrumentation, color) __CPU_INSTRUMENTATION(3, instrumentation, nullptr, color, nullptr)
268# define CPU_INSTRUMENTATION_L3_NC(instrumentation, name, color) __CPU_INSTRUMENTATION(3, instrumentation, name, color, nullptr)
270# define GPU_INSTRUMENTATION_L3(instrumentation, cg) __GPU_INSTRUMENTATION(3, instrumentation, cg, nullptr, uint_color(255, 255, 255, 255), nullptr)
271# define GPU_INSTRUMENTATION_L3_N(instrumentation, cg, name) __GPU_INSTRUMENTATION(3, instrumentation, cg, name, uint_color(255, 255, 255, 255), nullptr)
272# define GPU_INSTRUMENTATION_L3_C(instrumentation, cg, color) __GPU_INSTRUMENTATION(3, instrumentation, cg, nullptr, color, nullptr)
273# define GPU_INSTRUMENTATION_L3_NC(instrumentation, cg, name, color) __GPU_INSTRUMENTATION(3, instrumentation, cg, name, color, nullptr)
275# define CPU_INSTRUMENTATION_L3_O(instrumentation, object) __CPU_INSTRUMENTATION(3, instrumentation, nullptr, uint_color(255, 255, 255, 255), object)
276# define CPU_INSTRUMENTATION_L3_NO(instrumentation, name, object) __CPU_INSTRUMENTATION(3, instrumentation, name, uint_color(255, 255, 255, 255), object)
277# define CPU_INSTRUMENTATION_L3_CO(instrumentation, color, object) __CPU_INSTRUMENTATION(3, instrumentation, nullptr, color, object)
278# define CPU_INSTRUMENTATION_L3_NCO(instrumentation, name, color, object) __CPU_INSTRUMENTATION(3, instrumentation, name, color, object)
280# define GPU_INSTRUMENTATION_L3_O(instrumentation, cg, object) __GPU_INSTRUMENTATION(3, instrumentation, cg, nullptr, uint_color(255, 255, 255, 255), object)
281# define GPU_INSTRUMENTATION_L3_NO(instrumentation, cg, name, object) __GPU_INSTRUMENTATION(3, instrumentation, cg, name, uint_color(255, 255, 255, 255), object)
282# define GPU_INSTRUMENTATION_L3_CO(instrumentation, cg, color, object) __GPU_INSTRUMENTATION(3, instrumentation, cg, nullptr, color, object)
283# define GPU_INSTRUMENTATION_L3_NCO(instrumentation, cg, name, color, object) __GPU_INSTRUMENTATION(3, instrumentation, cg, name, color, object)
287# define CPU_INSTRUMENTATION_L3(instrumentation)
288# define CPU_INSTRUMENTATION_L3_N(instrumentation, name)
289# define CPU_INSTRUMENTATION_L3_C(instrumentation, color)
290# define CPU_INSTRUMENTATION_L3_NC(instrumentation, name, color)
292# define GPU_INSTRUMENTATION_L3(instrumentation, cg)
293# define GPU_INSTRUMENTATION_L3_N(instrumentation, cg, name)
294# define GPU_INSTRUMENTATION_L3_C(instrumentation, cg, color)
295# define GPU_INSTRUMENTATION_L3_NC(instrumentation, cg, name, color)
297# define CPU_INSTRUMENTATION_L3_O(instrumentation, object)
298# define CPU_INSTRUMENTATION_L3_NO(instrumentation, name, object)
299# define CPU_INSTRUMENTATION_L3_CO(instrumentation, color, object)
300# define CPU_INSTRUMENTATION_L3_NCO(instrumentation, name, color, object)
302# define GPU_INSTRUMENTATION_L3_O(instrumentation, cg, object)
303# define GPU_INSTRUMENTATION_L3_NO(instrumentation, cg, name, object)
304# define GPU_INSTRUMENTATION_L3_CO(instrumentation, cg, color, object)
305# define GPU_INSTRUMENTATION_L3_NCO(instrumentation, cg, name, color, object)
CommandBuffer encapsulates VkCommandBuffer.
Definition CommandBuffer.h:27
FrameStamp represents the time and frame count of a specific frame.
Definition FrameStamp.h:22
base class for Instrumentation implentations
Definition Instrumentation.h:51
Definition Instrumentation.h:119
Definition Instrumentation.h:82
Definition Instrumentation.h:100
Definition Instrumentation.h:40
uint_color struct used to provide a {r, g, b, a} interface a colors assigned as uint32_t
Definition Instrumentation.h:29