![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <rendering_resource_manager.hpp>
Public Types | |
template<typename ResourceT > | |
using | pool_type = typename ResourceRecord< ResourceT >::pool_type |
template<typename ResourceT > | |
using | key_type = typename pool_type< ResourceT >::key_type |
template<typename ResourceT > | |
using | value_type = typename pool_type< ResourceT >::value_type |
Public Member Functions | |
ResourceManager (ID3D11Device &device) | |
ResourceManager (const ResourceManager &manager)=delete | |
ResourceManager (ResourceManager &&manager) noexcept | |
~ResourceManager () | |
ResourceManager & | operator= (const ResourceManager &manager)=delete |
ResourceManager & | operator= (ResourceManager &&manager)=delete |
template<typename ResourceT > | |
bool | Contains (const typename key_type< ResourceT > &guid) noexcept |
template<typename ResourceT > | |
SharedPtr< typename value_type< ResourceT > > | Get (const typename key_type< ResourceT > &guid) noexcept |
template<typename ResourceT , typename VertexT , typename IndexT > | |
std::enable_if_t< std::is_same_v< ModelDescriptor, ResourceT >, ModelDescriptorPtr > | GetOrCreate (const std::wstring &fname, const MeshDescriptor< VertexT, IndexT > &desc=MeshDescriptor< VertexT, IndexT >(), bool export_as_MDL=false) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< VertexShader, ResourceT >, VertexShaderPtr > | GetOrCreate (const std::wstring &guid, const CompiledShader &compiled_shader, gsl::span< const D3D11_INPUT_ELEMENT_DESC > input_element_descs) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< HullShader, ResourceT >, HullShaderPtr > | GetOrCreate (const std::wstring &guid, const CompiledShader &compiled_shader) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< DomainShader, ResourceT >, DomainShaderPtr > | GetOrCreate (const std::wstring &guid, const CompiledShader &compiled_shader) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< GeometryShader, ResourceT >, GeometryShaderPtr > | GetOrCreate (const std::wstring &guid, const CompiledShader &compiled_shader) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< PixelShader, ResourceT >, PixelShaderPtr > | GetOrCreate (const std::wstring &guid, const CompiledShader &compiled_shader) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< ComputeShader, ResourceT >, ComputeShaderPtr > | GetOrCreate (const std::wstring &guid, const CompiledShader &compiled_shader) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< SpriteFont, ResourceT >, SpriteFontPtr > | GetOrCreate (const std::wstring &fname, const SpriteFontDescriptor &desc=SpriteFontDescriptor()) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< Texture, ResourceT >, TexturePtr > | GetOrCreate (const std::wstring &fname) |
template<typename ResourceT > | |
std::enable_if_t< std::is_same_v< Texture, ResourceT >, TexturePtr > | GetOrCreate (const std::wstring &guid, const D3D11_TEXTURE2D_DESC &desc, const D3D11_SUBRESOURCE_DATA &initial_data) |
Private Member Functions | |
template<typename ResourceT > | |
pool_type< ResourceT > & | GetPool () noexcept |
template<typename ResourceT > | |
const pool_type< ResourceT > & | GetPool () const noexcept |
Private Attributes | |
ID3D11Device & | m_device |
pool_type< ModelDescriptor > | m_model_descriptor_pool |
pool_type< VertexShader > | m_vs_pool |
pool_type< HullShader > | m_hs_pool |
pool_type< DomainShader > | m_ds_pool |
pool_type< GeometryShader > | m_gs_pool |
pool_type< PixelShader > | m_ps_pool |
pool_type< ComputeShader > | m_cs_pool |
pool_type< SpriteFont > | m_sprite_font_pool |
pool_type< Texture > | m_texture_pool |
A class of resource managers.
using mage::rendering::ResourceManager::key_type = typename pool_type< ResourceT >::key_type |
The key type of resource pools containing resources of the given type.
ResourceT | The resource type. |
using mage::rendering::ResourceManager::pool_type = typename ResourceRecord< ResourceT >::pool_type |
The pool type of resource pools containing resources of the given type.
ResourceT | The resource type. |
using mage::rendering::ResourceManager::value_type = typename pool_type< ResourceT >::value_type |
The value type of resource pools containing resources of the given type.
ResourceT | The resource type. |
|
explicit |
Constructs a resource manager.
[in,out] | device | A reference to the device. |
|
delete |
Constructs a resource manager from the given resource manager.
[in] | manager | A reference to the resource manager to copy. |
|
defaultnoexcept |
Constructs a resource manager by moving the given resource manager.
[in] | manager | A reference to the resource manager to move. |
|
default |
Destructs this resource manager.
|
noexcept |
Checks whether this resource manager contains a resource of the given type corresponding to the given globally unique identifier.
ResourceT | The resource type. |
[in] | guid | A reference to the globally unique identifier of the resource. |
true
if this resource managers contains a resource of the given type corresponding to the given globally unique identifier. false
otherwise.
|
noexcept |
Returns the resource of the given type corresponding to the given globally unique identifier of this resource manager.
ResourceT | The resource type. |
[in] | guid | A reference to the globally unique identifier of the model descriptor. |
nullptr
, if this resource managers does not contain a resource of the given type corresponding to the given globally unique identifier. std::enable_if_t< std::is_same_v< ModelDescriptor, ResourceT >, ModelDescriptorPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | fname, |
const MeshDescriptor< VertexT, IndexT > & | desc = MeshDescriptor< VertexT, IndexT >() , |
||
bool | export_as_MDL = false |
||
) |
Creates a model descriptor (if not existing).
ResourceT | The resource type. |
VertexT | The vertex type. |
IndexT | The index type. |
[in] | fname | The filename (the globally unique identifier). |
[in] | desc | A reference to the mesh descriptor. |
[in] | export_as_MDL | true if the model descriptor needs to be exported as MDL file. false otherwise. |
Exception | Failed to create the model descriptor. |
std::enable_if_t< std::is_same_v< VertexShader, ResourceT >, VertexShaderPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const CompiledShader & | compiled_shader, | ||
gsl::span< const D3D11_INPUT_ELEMENT_DESC > | input_element_descs | ||
) |
Creates a vertex shader (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | compiled_shader | A reference to the compiled vertex shader. |
[in] | input_element_descs | The input element descriptors. |
Exception | Failed to create the vertex shader. |
std::enable_if_t< std::is_same_v< HullShader, ResourceT >, HullShaderPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const CompiledShader & | compiled_shader | ||
) |
Creates a hull shader (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | compiled_shader | A reference to the compiled shader. |
Exception | Failed to create the hull shader. |
std::enable_if_t< std::is_same_v< DomainShader, ResourceT >, DomainShaderPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const CompiledShader & | compiled_shader | ||
) |
Creates a domain shader (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | compiled_shader | A reference to the compiled shader. |
Exception | Failed to create the domain shader. |
std::enable_if_t< std::is_same_v< GeometryShader, ResourceT >, GeometryShaderPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const CompiledShader & | compiled_shader | ||
) |
Creates a geometry shader (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | compiled_shader | A reference to the compiled shader. |
Exception | Failed to create the geometry shader. |
std::enable_if_t< std::is_same_v< PixelShader, ResourceT >, PixelShaderPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const CompiledShader & | compiled_shader | ||
) |
Creates a pixel shader (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | compiled_shader | A reference to the compiled shader. |
Exception | Failed to create the pixel shader. |
std::enable_if_t< std::is_same_v< ComputeShader, ResourceT >, ComputeShaderPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const CompiledShader & | compiled_shader | ||
) |
Creates a compute shader (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | compiled_shader | A reference to the compiled shader. |
Exception | Failed to create the compute shader. |
std::enable_if_t< std::is_same_v< SpriteFont, ResourceT >, SpriteFontPtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | fname, |
const SpriteFontDescriptor & | desc = SpriteFontDescriptor() |
||
) |
Creates a sprite font (if not existing).
ResourceT | The resource type. |
[in] | fname | The filename (the globally unique identifier). |
[in] | desc | A reference to the sprite font descriptor. |
Exception | Failed to create the sprite font. |
std::enable_if_t< std::is_same_v< Texture, ResourceT >, TexturePtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | fname | ) |
Creates a texture (if not existing).
ResourceT | The resource type. |
[in] | fname | The filename (the globally unique identifier). |
Exception | Failed to create the texture. |
std::enable_if_t< std::is_same_v< Texture, ResourceT >, TexturePtr > mage::rendering::ResourceManager::GetOrCreate | ( | const std::wstring & | guid, |
const D3D11_TEXTURE2D_DESC & | desc, | ||
const D3D11_SUBRESOURCE_DATA & | initial_data | ||
) |
Creates a texture (if not existing).
ResourceT | The resource type. |
[in] | guid | The globally unique identifier. |
[in] | desc | A reference to the texture descriptor. |
[in] | initial_data | A reference to the initial data. |
Exception | Failed to create the texture. |
|
privatenoexcept |
Returns the resource pool containing resources of the given type of this resource manager.
ResourceT | The resource type. |
|
privatenoexcept |
Returns the resource pool containing resources of the given type of this resource manager.
ResourceT | The resource type. |
|
delete |
Copies the given resource manager to this resource manager.
[in] | manager | A reference to the resource manager to copy. |
|
delete |
Moves the given resource manager to this resource manager.
[in] | manager | A reference to the resource manager to move. |
|
private |
The compute shader resource pool of this resource manager.
|
private |
A reference to the device of this resource manager.
|
private |
The domain shader resource pool of this resource manager.
|
private |
The geometry shader resource pool of this resource manager.
|
private |
The hull shader resource pool of this resource manager.
|
private |
The model descriptor resource pool of this resource manager.
|
private |
The pixel shader resource pool of this resource manager.
|
private |
The sprite font resource pool of this resource manager.
The texture resource pool of this resource manager.
|
private |
The vertex shader resource pool of this resource manager.