diff --git a/Source/Engine/Graphics/GPUDevice.h b/Source/Engine/Graphics/GPUDevice.h
index d424ec67d..82b221879 100644
--- a/Source/Engine/Graphics/GPUDevice.h
+++ b/Source/Engine/Graphics/GPUDevice.h
@@ -371,7 +371,7 @@ public:
virtual void WaitForGPU() = 0;
///
- /// Reads the query result from the GPU.
+ /// Reads the query result from the GPU. Timer queries return time in microseconds (1/1000 ms).
///
/// 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.
/// Query identifier returned by GPUContext::BeginQuery.
@@ -435,9 +435,10 @@ public:
///
/// Creates the timer query object.
+ /// [Deprecated in v1.12]
///
/// The timer query.
- 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;
///
/// Creates the buffer.
diff --git a/Source/Engine/Graphics/GPUTimerQuery.h b/Source/Engine/Graphics/GPUTimerQuery.h
index 0b1cc03ca..3100abcf3 100644
--- a/Source/Engine/Graphics/GPUTimerQuery.h
+++ b/Source/Engine/Graphics/GPUTimerQuery.h
@@ -7,6 +7,7 @@
///
/// 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]
///
///
class FLAXENGINE_API GPUTimerQuery : public GPUResource
diff --git a/Source/Engine/Tools/ModelTool/ModelTool.cpp b/Source/Engine/Tools/ModelTool/ModelTool.cpp
index aedaf12a4..50f2b9184 100644
--- a/Source/Engine/Tools/ModelTool/ModelTool.cpp
+++ b/Source/Engine/Tools/ModelTool/ModelTool.cpp
@@ -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
}