Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Base class enforcing common interface for all classes wrapping a device resource. More...
#include <foray_managedresource.hpp>
Public Member Functions | |
virtual std::string_view | GetTypeName () const |
Return a hint for the type of resource managed by the instantiation. | |
virtual bool | Exists () const =0 |
Return true, if the managed resource is allocated. | |
virtual void | Destroy ()=0 |
Destroy the resource. | |
ManagedResource () | |
Default constructor registers the resource. | |
ManagedResource (std::string_view name) | |
Registers the resource and sets its name. | |
virtual | ~ManagedResource () |
Unregisters the resource. | |
std::string_view | GetName () const |
Return a custom name for the object. | |
virtual void | SetName (std::string_view name) |
Set a custom name for the object. | |
std::string | Print () const |
Print name and type in one string. | |
![]() | |
NoMoveDefaults ()=default | |
NoMoveDefaults (const NoMoveDefaults &other)=delete | |
NoMoveDefaults (NoMoveDefaults &&other)=default | |
NoMoveDefaults & | operator= (const NoMoveDefaults &other)=delete |
Static Public Member Functions | |
static void | sPrintAllocatedResources (bool printAsWarning) |
Print a list of all registered existing resources. | |
static const std::unordered_set< ManagedResource * > * | GetTotalAllocatedResources () |
Protected Attributes | |
std::string | mName |
This objects custom name. | |
Base class enforcing common interface for all classes wrapping a device resource.
foray::core::ManagedResource::ManagedResource | ( | ) |
Default constructor registers the resource.
|
explicit |
Registers the resource and sets its name.
|
virtual |
Unregisters the resource.
|
pure virtual |
Destroy the resource.
Implemented in foray::bench::DeviceBenchmark, foray::util::PipelineLayout, foray::as::Blas, foray::as::Tlas, foray::core::CommandBuffer, foray::core::HostSyncCommandBuffer, foray::core::DescriptorSet, foray::core::ManagedBuffer, foray::core::ManagedImage, foray::core::SamplerCollection, foray::core::ShaderModule, foray::util::ExternalSemaphore, foray::util::ManagedUboBase, foray::util::ManagedVectorBuffer< TClass >, foray::util::ManagedVectorBuffer< foray::scene::Material >, and foray::util::NoiseSource.
|
pure virtual |
Return true, if the managed resource is allocated.
Example: Vulkan object stored could be nullptr or instantiated
Implemented in foray::bench::DeviceBenchmark, foray::util::PipelineLayout, foray::as::Blas, foray::as::Tlas, foray::core::CommandBuffer, foray::core::DescriptorSet, foray::core::ManagedBuffer, foray::core::ManagedImage, foray::core::SamplerCollection, foray::core::ShaderModule, foray::util::ExternalSemaphore, foray::util::ManagedUboBase, foray::util::ManagedVectorBuffer< TClass >, foray::util::ManagedVectorBuffer< foray::scene::Material >, and foray::util::NoiseSource.
|
inline |
Return a custom name for the object.
|
inlinestatic |
|
virtual |
Return a hint for the type of resource managed by the instantiation.
Reimplemented in foray::core::VulkanResource< OBJECT_TYPE >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_BUFFER >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_COMMAND_BUFFER >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_DESCRIPTOR_SET >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_IMAGE >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_PIPELINE_LAYOUT >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_SAMPLER >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_SEMAPHORE >, foray::core::VulkanResource< VkObjectType::VK_OBJECT_TYPE_SHADER_MODULE >, foray::as::Blas, and foray::as::Tlas.
std::string foray::core::ManagedResource::Print | ( | ) | const |
Print name and type in one string.
|
virtual |
Set a custom name for the object.
Reimplemented in foray::core::CommandBuffer, foray::core::ManagedBuffer, foray::core::ManagedImage, foray::util::ManagedVectorBuffer< TClass >, and foray::util::ManagedVectorBuffer< foray::scene::Material >.
|
static |
Print a list of all registered existing resources.
printAsWarning | If true, a non-zero amount is logged as a warning |
|
protected |
This objects custom name.