Deprecate GPUTimerQuery in favor of new queries API
This commit is contained in:
@@ -371,7 +371,7 @@ public:
|
||||
virtual void WaitForGPU() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Reads the query result from the GPU.
|
||||
/// Reads the query result from the GPU. Timer queries return time in microseconds (1/1000 ms).
|
||||
/// </summary>
|
||||
/// <remarks>GPU query results are short-lived, meaning that in the frame that results are ready, they won't be available in the next frame, as queries are reused.</remarks>
|
||||
/// <param name="queryID">Query identifier returned by GPUContext::BeginQuery.</param>
|
||||
@@ -435,9 +435,10 @@ public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates the timer query object.
|
||||
/// [Deprecated in v1.12]
|
||||
/// </summary>
|
||||
/// <returns>The timer query.</returns>
|
||||
virtual GPUTimerQuery* CreateTimerQuery() = 0;
|
||||
virtual DEPRECATED("Use new BeginQuery/EndQuery on GPUContext to insert queries and GetQueryResult on GPUDevice to read the results.") GPUTimerQuery* CreateTimerQuery() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the buffer.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
/// <summary>
|
||||
/// Represents a GPU query that measures execution time of GPU operations.
|
||||
/// The query will measure any GPU operations that take place between its Begin() and End() calls.
|
||||
/// [Deprecated in v1.12]
|
||||
/// </summary>
|
||||
/// <seealso cref="GPUResource" />
|
||||
class FLAXENGINE_API GPUTimerQuery : public GPUResource
|
||||
|
||||
@@ -92,7 +92,7 @@ class GPUModelSDFTask : public GPUTask
|
||||
GPUTexture* _sdfResult;
|
||||
Float3 _xyzToLocalMul, _xyzToLocalAdd;
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
GPUTimerQuery* _timerQuery;
|
||||
uint64 _timerQuery = 0;
|
||||
#endif
|
||||
|
||||
const uint32 ThreadGroupSize = 64;
|
||||
@@ -124,17 +124,11 @@ public:
|
||||
, _sdfResult(sdfResult)
|
||||
, _xyzToLocalMul(xyzToLocalMul)
|
||||
, _xyzToLocalAdd(xyzToLocalAdd)
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
, _timerQuery(GPUDevice::Instance->CreateTimerQuery())
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
~GPUModelSDFTask()
|
||||
{
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
SAFE_DELETE_GPU_RESOURCE(_timerQuery);
|
||||
#endif
|
||||
}
|
||||
|
||||
Result run(GPUTasksContext* tasksContext) override
|
||||
@@ -142,7 +136,7 @@ public:
|
||||
PROFILE_GPU_CPU("GPUModelSDFTask");
|
||||
GPUContext* context = tasksContext->GPU;
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
_timerQuery->Begin();
|
||||
_timerQuery = context->BeginQuery(GPUQueryType::Timer);
|
||||
#endif
|
||||
|
||||
// Allocate resources
|
||||
@@ -216,7 +210,7 @@ public:
|
||||
SAFE_DELETE_GPU_RESOURCE(sdfTexture);
|
||||
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
_timerQuery->End();
|
||||
context->EndQuery(_timerQuery);
|
||||
#endif
|
||||
return Result::Ok;
|
||||
}
|
||||
@@ -226,8 +220,9 @@ public:
|
||||
GPUTask::OnSync();
|
||||
_signal->NotifyOne();
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
if (_timerQuery->HasResult())
|
||||
LOG(Info, "GPU SDF generation took {} ms", Utilities::RoundTo1DecimalPlace(_timerQuery->GetResult()));
|
||||
uint64 time;
|
||||
if (GPUDevice::Instance->GetQueryResult(_timerQuery, time, true))
|
||||
LOG(Info, "GPU SDF generation took {} ms", Utilities::RoundTo1DecimalPlace(time * 0.001f));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user