|
@@ -48,10 +48,10 @@ namespace bs
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Profiler that measures time and amount of various GPU operations.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Core thread only except where noted otherwise.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Profiler that measures time and amount of various GPU operations.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note Core thread only except where noted otherwise.
|
|
|
|
|
+ */
|
|
|
class BS_CORE_EXPORT ProfilerGPU : public Module<ProfilerGPU>
|
|
class BS_CORE_EXPORT ProfilerGPU : public Module<ProfilerGPU>
|
|
|
{
|
|
{
|
|
|
private:
|
|
private:
|
|
@@ -75,65 +75,66 @@ namespace bs
|
|
|
~ProfilerGPU();
|
|
~ProfilerGPU();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Signals a start of a new frame. Every frame will generate a separate profiling report. This call must be followed
|
|
|
|
|
- * by endFrame(), and any sampling operations must happen between beginFrame() and endFrame().
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Signals a start of a new frame. Every frame will generate a separate profiling report. This call must be followed
|
|
|
|
|
+ * by endFrame(), and any sampling operations must happen between beginFrame() and endFrame().
|
|
|
|
|
+ */
|
|
|
void beginFrame();
|
|
void beginFrame();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Signals an end of the currently sampled frame. Results of the sampling will be available once
|
|
|
|
|
- * getNumAvailableReports increments. This may take a while as the sampling is scheduled on the core thread and
|
|
|
|
|
- * on the GPU.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Signals an end of the currently sampled frame. Results of the sampling will be available once
|
|
|
|
|
+ * getNumAvailableReports increments. This may take a while as the sampling is scheduled on the core thread and
|
|
|
|
|
+ * on the GPU.
|
|
|
|
|
+ */
|
|
|
void endFrame();
|
|
void endFrame();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Begins sample measurement. Must be followed by endSample().
|
|
|
|
|
- *
|
|
|
|
|
- * @param[in] name Unique name for the sample you can later use to find the sampling data.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Must be called between beginFrame()/endFrame() calls.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Begins sample measurement. Must be followed by endSample().
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param[in] name Unique name for the sample you can later use to find the sampling data.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note Must be called between beginFrame()/endFrame() calls.
|
|
|
|
|
+ */
|
|
|
void beginSample(const ProfilerString& name);
|
|
void beginSample(const ProfilerString& name);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Ends sample measurement.
|
|
|
|
|
- *
|
|
|
|
|
- * @param[in] name Unique name for the sample.
|
|
|
|
|
- *
|
|
|
|
|
- * @note
|
|
|
|
|
- * Unique name is primarily needed to more easily identify mismatched begin/end sample pairs. Otherwise the name in
|
|
|
|
|
- * beginSample() would be enough. Must be called between beginFrame()/endFrame() calls.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Ends sample measurement.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param[in] name Unique name for the sample.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * Unique name is primarily needed to more easily identify mismatched begin/end sample pairs. Otherwise the name in
|
|
|
|
|
+ * beginSample() would be enough. Must be called between beginFrame()/endFrame() calls.
|
|
|
|
|
+ */
|
|
|
void endSample(const ProfilerString& name);
|
|
void endSample(const ProfilerString& name);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Returns number of profiling reports that are ready but haven't been retrieved yet.
|
|
|
|
|
- *
|
|
|
|
|
- * @note
|
|
|
|
|
- * There is an internal limit of maximum number of available reports, where oldest ones will get deleted so make
|
|
|
|
|
- * sure to call this often if you don't want to miss some.
|
|
|
|
|
- * @note
|
|
|
|
|
- * Thread safe.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Returns number of profiling reports that are ready but haven't been retrieved yet.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * There is an internal limit of maximum number of available reports, where oldest ones will get deleted so make
|
|
|
|
|
+ * sure to call this often if you don't want to miss some.
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * Thread safe.
|
|
|
|
|
+ */
|
|
|
UINT32 getNumAvailableReports();
|
|
UINT32 getNumAvailableReports();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Gets the oldest report available and removes it from the internal list. Throws an exception if no reports are
|
|
|
|
|
- * available.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Thread safe.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Gets the oldest report available and removes it from the internal list. Throws an exception if no reports are
|
|
|
|
|
+ * available.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @note Thread safe.
|
|
|
|
|
+ */
|
|
|
GPUProfilerReport getNextReport();
|
|
GPUProfilerReport getNextReport();
|
|
|
|
|
|
|
|
- public: // ***** INTERNAL ******
|
|
|
|
|
- /** @name Internal
|
|
|
|
|
- * @{
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ public:
|
|
|
|
|
+ // ***** INTERNAL ******
|
|
|
|
|
+ /** @name Internal
|
|
|
|
|
+ * @{
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * To be called once per frame from the Core thread.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * To be called once per frame from the Core thread.
|
|
|
|
|
+ */
|
|
|
void _update();
|
|
void _update();
|
|
|
|
|
|
|
|
/** @} */
|
|
/** @} */
|
|
@@ -152,9 +153,9 @@ namespace bs
|
|
|
SPtr<ct::OcclusionQuery> getOcclusionQuery() const;
|
|
SPtr<ct::OcclusionQuery> getOcclusionQuery() const;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Interprets the active frame results and generates a profiler report for the frame. Provided frame queries must
|
|
|
|
|
- * have finished before calling this.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ * Interprets the active frame results and generates a profiler report for the frame. Provided frame queries must
|
|
|
|
|
+ * have finished before calling this.
|
|
|
|
|
+ */
|
|
|
GPUProfilerReport resolveFrame(ActiveFrame& frame);
|
|
GPUProfilerReport resolveFrame(ActiveFrame& frame);
|
|
|
|
|
|
|
|
/** Resolves an active sample and converts it to report sample. */
|
|
/** Resolves an active sample and converts it to report sample. */
|