class GpuCommandBufferProfiler

Allows you to record timing and statistics for GPU command execution on a GPU command buffer.

Public

Constructors

GpuCommandBufferProfiler

GpuCommandBufferProfiler(render::GpuCommandBuffer &commandBuffer)

Constructs a new command buffer profiler and allocates query pool.

Query pool reset is issued on the provided command buffer. Command buffer must not be in a render pass.

Methods

~GpuCommandBufferProfiler

~GpuCommandBufferProfiler()

BeginSample

void BeginSample(render::GpuCommandBuffer &commandBuffer, ProfilerString name)

Begins sample measurement.

Must be followed by EndSample(). If command buffer is currently within a render pass, EndSample() must also be issued within a render pass. If command buffer is currently outside of a render pass, EndSample() must be issued outside of a render pass.

commandBuffer
Command buffer to record the sample on, must be the same as the profiler was created for.
name
Unique name for the sample you can later use to find the sampling data.

EndSample

void EndSample(render::GpuCommandBuffer &commandBuffer)

Ends sample measurement that started in BeginSample().

commandBuffer
Command buffer to record the sample on, must be the same as the profiler was created for.

IsEmpty

bool IsEmpty() const

Returns true if the profiler doesn't have any samples.

Private

Methods

Clear

void Clear()

Clears all the internal data.

Reset

void Reset(render::GpuCommandBuffer &commandBuffer)

Resets the object so it may be re-used.

ConvertToResultSample

void ConvertToResultSample(const Sample &sample, GpuProfilerSample &reportSample)

Converts a command buffer profiler sample and converts it to a result sample.

Caller must ensure that query pool has resolved the queries before calling.

GetResults

GpuProfilerResults GetResults()

Converts all command buffer profiler samples into report samples.

Caller must ensure that query pool has resolved the queries before calling.

Fields

mTimestampQueryPool

SPtr<render::GpuQueryPool> mTimestampQueryPool

mRootSamples

TArray<Sample *> mRootSamples

mActiveSampleChain

TArray<Sample *> mActiveSampleChain

mSamplePool

PoolAlloc<sizeof(Sample), 256> mSamplePool

mCommandBufferId

u64 mCommandBufferId