Foundation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Foundation::RHI::RHIHandle< Factory, T > Class Template Reference

Handle type for RHI Objects.
More...

#include <Details.hpp>

Inheritance diagram for Foundation::RHI::RHIHandle< Factory, T >:
Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIDeviceDescriptorPool > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIDeviceSemaphore > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHICommandPool > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIDeviceFence > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHITextureView > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIPipelineState > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIDevice > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHISwapchain > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIBuffer > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIDeviceDescriptorSetLayout > Foundation::RHI::RHIScopedHandle< Foundation::RHI::RHIDeviceDescriptorSet > Foundation::RHI::RHIScopedHandle< Factory, T >

Public Member Functions

template<typename U = T>
UGet () const
 Retrieves the underlying RHIObject pointer. It is undefined behavior to use the returned pointer after the underlying resource has been destroyed.
 
Toperator-> () const
 
constexpr Handle operator() () const
 
constexpr operator bool () const noexcept
 
bool operator== (const RHIHandle &other) const
 
bool IsValid () const
 Check if the handle is valid (i.e. associated with a Factory and not kInvalidHandle)
 
void Invalidate ()
 Resets the handle to an invalid state. After calling this, the handle is no longer associated with any Factory or resource.
 

Public Attributes

FactorymFactory { nullptr }
 
Handle mHandle { kInvalidHandle }
 

Detailed Description

template<typename Factory, typename T>
class Foundation::RHI::RHIHandle< Factory, T >

Handle type for RHI Objects.

RHIHandle<Factory, T> are trivially copiable objects that provide a view into the underlying RHIObject storage. When a Factory goes out of scope, all underlying RHIObjects are destroyed.

The behavior is undefined to use a Handle after it's Factory has been destroyed or the resource it refers to has been destroyed.

Member Function Documentation

◆ Get()

template<typename Factory , typename T >
template<typename U = T>
U * Foundation::RHI::RHIHandle< Factory, T >::Get ( ) const
inline

Retrieves the underlying RHIObject pointer. It is undefined behavior to use the returned pointer after the underlying resource has been destroyed.

Template Parameters
UPointer type to retrieve as. U is required to be castable from T

◆ Invalidate()

template<typename Factory , typename T >
void Foundation::RHI::RHIHandle< Factory, T >::Invalidate ( )
inline

Resets the handle to an invalid state. After calling this, the handle is no longer associated with any Factory or resource.

◆ IsValid()

template<typename Factory , typename T >
bool Foundation::RHI::RHIHandle< Factory, T >::IsValid ( ) const
inline

Check if the handle is valid (i.e. associated with a Factory and not kInvalidHandle)

Note
THIS CHECK IS CONSERVATIVE. A true handle may still refer to a destroyed resource. Always ensure correct destruction order, possibly with the help of UniquePtr or SharedPtr

◆ operator bool()

template<typename Factory , typename T >
constexpr Foundation::RHI::RHIHandle< Factory, T >::operator bool ( ) const
inlineconstexprnoexcept

◆ operator()()

◆ operator->()

template<typename Factory , typename T >
T * Foundation::RHI::RHIHandle< Factory, T >::operator-> ( ) const
inline

◆ operator==()

Member Data Documentation

◆ mFactory

◆ mHandle


The documentation for this class was generated from the following file: