// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. #pragma once #include "GPUResource.h" /// /// 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. /// /// class FLAXENGINE_API GPUTimerQuery : public GPUResource { public: /// /// Finalizes an instance of the class. /// virtual ~GPUTimerQuery() { } public: /// /// Starts the counter. /// virtual void Begin() = 0; /// /// Stops the counter. Can be called more than once without failing. /// virtual void End() = 0; /// /// Determines whether this query has been completed and has valid result to gather. /// /// true if this query has result; otherwise, false. virtual bool HasResult() = 0; /// /// Gets the query result time (in milliseconds) it took to execute GPU commands between Begin/End calls. /// /// The time in milliseconds. virtual float GetResult() = 0; public: // [GPUResource] String ToString() const override { return TEXT("TimerQuery"); } GPUResourceType GetResourceType() const final override { return GPUResourceType::Query; } };