LiteFX 0.4.1.2025
Computer Graphics Engine
|
An event that is used to measure timestamps in a command queue. More...
#include <rendering_api.hpp>
Inherits LiteFX::SharedObject.
Classes | |
class | TimingEventImpl |
Public Member Functions | |
~TimingEvent () noexcept override | |
Releases the render target instance. | |
TimingEvent (TimingEvent &&) noexcept=delete | |
TimingEvent (const TimingEvent &)=delete | |
auto | operator= (TimingEvent &&) noexcept=delete |
auto | operator= (const TimingEvent &)=delete |
StringView | name () const noexcept |
Gets the name of the timing event. | |
UInt64 | readTimestamp () const |
Reads the current timestamp (as a tick count) of the event. | |
UInt32 | queryId () const |
Returns the query ID for the timing event. | |
![]() | |
virtual | ~SharedObject () noexcept=default |
Destroys the shared object. | |
template<typename TSelf > | |
auto | shared_from_this (this TSelf &&self) noexcept |
Returns a shared pointer to the current object instance. | |
template<typename TSelf > | |
auto | weak_from_this (this TSelf &&self) noexcept -> WeakPtr< std::remove_reference_t< TSelf > > |
Returns a weak pointer to the current object instance. | |
Friends | |
class | ISwapChain |
struct | SharedObject::Allocator< TimingEvent > |
Additional Inherited Members | |
![]() | |
SharedObject () noexcept=default | |
Initializes a new shared object. | |
SharedObject (SharedObject &&) noexcept=default | |
SharedObject (const SharedObject &)=default | |
SharedObject & | operator= (SharedObject &&) noexcept=default |
SharedObject & | operator= (const SharedObject &)=default |
![]() | |
template<typename T , typename... TArgs> | |
static auto | create (TArgs &&... args) -> SharedPtr< T > |
Generic factory method used to create instances of the shared object. | |
An event that is used to measure timestamps in a command queue.
Timing events are used to collect GPU time stamps asynchronously. A timing event can be inserted to a ICommandBuffer by calling ICommandBuffer::writeTimingEvent. This will cause the GPU to write the current time stamp when the command gets executed. Since command order is not preserved within command buffers, this is not guaranteed to be accurate an accurate point of time for when a certain command in order has been executed. However, since a time stamp is always written at the bottom of the pipe, the difference between two timestamps resembles the actual time the GPU was occupied with the commands between them.
Timing events are asynchronous. They are set for a certain back buffer of a ISwapChain. Reading the time stamp requires the back buffer to be ready (i.e., the frame in flight needs to have executed). The earliest point where this is guaranteed is, if the swap chain swaps to the back buffer again. This means that the time stamps issued in one frame can only be read the next time the frame's back buffer is used again.
Note that timing events are only supported on graphics and compute ICommandQueues.
<seeaslo cref="ISwapChain" >
|
overridedefaultnoexcept |
Releases the render target instance.
|
deletenoexcept |
|
delete |
|
noexcept |
Gets the name of the timing event.
|
delete |
|
deletenoexcept |
UInt32 TimingEvent::queryId | ( | ) | const |
Returns the query ID for the timing event.
RuntimeException | Thrown, if the parent device instance is already released. |
UInt64 TimingEvent::readTimestamp | ( | ) | const |
Reads the current timestamp (as a tick count) of the event.
In order to convert the number of ticks to (milli-)seconds, this value needs to be divided by IGraphicsDevice::ticksPerMillisecond. To improve precision, calculate the difference between two time stamps in ticks first and only then convert them to seconds.
RuntimeException | Thrown, if the parent device instance is already released. |
|
friend |
|
friend |