![]() |
LiteFX 0.3.1.2022
Computer Graphics Engine
|
A class that can be used to manage the state of a IGraphicsDevice. More...
#include <rendering_api.hpp>
Classes | |
class | DeviceStateImpl |
Public Member Functions | |
DeviceState () noexcept | |
Creates a new device state instance. More... | |
DeviceState (DeviceState &&)=delete | |
DeviceState (const DeviceState &)=delete | |
virtual | ~DeviceState () noexcept |
void | clear () |
Release all resources managed by the device state. More... | |
void | add (UniquePtr< IRenderPass > &&renderPass) |
Adds a new render pass to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< IRenderPass > &&renderPass) |
Adds a new render pass to the device state. More... | |
void | add (UniquePtr< IPipeline > &&pipeline) |
Adds a new pipeline to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< IPipeline > &&pipeline) |
Adds a new pipeline to the device state. More... | |
void | add (UniquePtr< IBuffer > &&buffer) |
Adds a new buffer to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< IBuffer > &&buffer) |
Adds a new buffer to the device state. More... | |
void | add (UniquePtr< IVertexBuffer > &&vertexBuffer) |
Adds a new vertex buffer to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< IVertexBuffer > &&vertexBuffer) |
Adds a new vertex buffer to the device state. More... | |
void | add (UniquePtr< IIndexBuffer > &&indexBuffer) |
Adds a new index buffer to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< IIndexBuffer > &&indexBuffer) |
Adds a new index buffer to the device state. More... | |
void | add (UniquePtr< IImage > &&image) |
Adds a new image to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< IImage > &&image) |
Adds a new image to the device state. More... | |
void | add (UniquePtr< ISampler > &&sampler) |
Adds a new sampler to the device state and uses its name as identifier. More... | |
void | add (const String &id, UniquePtr< ISampler > &&sampler) |
Adds a new sampler to the device state. More... | |
void | add (const String &id, UniquePtr< IDescriptorSet > &&descriptorSet) |
Adds a new descriptor set to the device state. More... | |
IRenderPass & | renderPass (const String &id) const |
Returns a render pass from the device state. More... | |
IPipeline & | pipeline (const String &id) const |
Returns a pipeline from the device state. More... | |
IBuffer & | buffer (const String &id) const |
Returns a buffer from the device state. More... | |
IVertexBuffer & | vertexBuffer (const String &id) const |
Returns a vertex buffer from the device state. More... | |
IIndexBuffer & | indexBuffer (const String &id) const |
Returns an index buffer from the device state. More... | |
IImage & | image (const String &id) const |
Returns an image from the device state. More... | |
ISampler & | sampler (const String &id) const |
Returns an sampler from the device state. More... | |
IDescriptorSet & | descriptorSet (const String &id) const |
Returns an descriptor set from the device state. More... | |
bool | release (const IRenderPass &renderPass) |
Releases a render pass. More... | |
bool | release (const IPipeline &pipeline) |
Releases a pipeline. More... | |
bool | release (const IBuffer &buffer) |
Releases a buffer. More... | |
bool | release (const IVertexBuffer &buffer) |
Releases a vertex buffer. More... | |
bool | release (const IIndexBuffer &buffer) |
Releases a index buffer. More... | |
bool | release (const IImage &image) |
Releases an image. More... | |
bool | release (const ISampler &sampler) |
Releases a sampler. More... | |
bool | release (const IDescriptorSet &descriptorSet) |
Releases a descriptor set. More... | |
Friends | |
class | IGraphicsDevice |
A class that can be used to manage the state of a IGraphicsDevice.
The device state makes managing resources created by a device easier, since you do not have to worry about storage and release order. Note, however, that this is not free. Requesting a resource requires a lookup within a hash-map. Also device states are not specialized for the concrete device, so you can only work with interfaces. This implies potentially inefficient upcasting of the state resource when its passed to another object. You have to decide if or to which degree you want to rely on storing resources in a device state.
|
explicitnoexcept |
Creates a new device state instance.
|
delete |
|
delete |
|
virtualnoexcept |
Adds a new buffer to the device state.
id | The identifier for the buffer. |
buffer | The buffer to add to the device state. |
InvalidArgumentException | Thrown, if another buffer with the same id has already been added. |
void DeviceState::add | ( | const String & | id, |
UniquePtr< IDescriptorSet > && | descriptorSet | ||
) |
Adds a new descriptor set to the device state.
id | The identifier for the descriptor set. |
sampler | The descriptor set to add to the device state. |
InvalidArgumentException | Thrown, if another descriptor set with the same id has already been added. |
Adds a new image to the device state.
id | The identifier for the image. |
image | The image to add to the device state. |
InvalidArgumentException | Thrown, if another image with the same id has already been added. |
void DeviceState::add | ( | const String & | id, |
UniquePtr< IIndexBuffer > && | indexBuffer | ||
) |
Adds a new index buffer to the device state.
id | The identifier for the index buffer. |
indexBuffer | The index buffer to add to the device state. |
InvalidArgumentException | Thrown, if another index buffer with the same id has already been added. |
Adds a new pipeline to the device state.
id | The identifier for the pipeline. |
pipeline | The pipeline to add to the device state. |
InvalidArgumentException | Thrown, if another pipeline with the same id has already been added. |
void DeviceState::add | ( | const String & | id, |
UniquePtr< IRenderPass > && | renderPass | ||
) |
Adds a new render pass to the device state.
id | The identifier for the render pass. |
renderPass | The render pass to add to the device state. |
InvalidArgumentException | Thrown, if another render pass with the same id has already been added. |
Adds a new sampler to the device state.
id | The identifier for the sampler. |
sampler | The sampler to add to the device state. |
InvalidArgumentException | Thrown, if another sampler with the same id has already been added. |
void DeviceState::add | ( | const String & | id, |
UniquePtr< IVertexBuffer > && | vertexBuffer | ||
) |
Adds a new vertex buffer to the device state.
id | The identifier for the vertex buffer. |
vertexBuffer | The vertex buffer to add to the device state. |
InvalidArgumentException | Thrown, if another vertex buffer with the same id has already been added. |
Adds a new buffer to the device state and uses its name as identifier.
buffer | The buffer to add to the device state. |
InvalidArgumentException | Thrown, if another buffer with the same identifier has already been added. |
Adds a new image to the device state and uses its name as identifier.
image | The image to add to the device state. |
InvalidArgumentException | Thrown, if another image with the same identifier has already been added. |
void DeviceState::add | ( | UniquePtr< IIndexBuffer > && | indexBuffer | ) |
Adds a new index buffer to the device state and uses its name as identifier.
indexBuffer | The index buffer to add to the device state. |
InvalidArgumentException | Thrown, if another index buffer with the same identifier has already been added. |
Adds a new pipeline to the device state and uses its name as identifier.
pipeline | The pipeline to add to the device state. |
InvalidArgumentException | Thrown, if another pipeline with the same identifier has already been added. |
void DeviceState::add | ( | UniquePtr< IRenderPass > && | renderPass | ) |
Adds a new render pass to the device state and uses its name as identifier.
renderPass | The render pass to add to the device state. |
InvalidArgumentException | Thrown, if another render pass with the same identifier has already been added. |
Adds a new sampler to the device state and uses its name as identifier.
sampler | The sampler to add to the device state. |
InvalidArgumentException | Thrown, if another sampler with the same identifier has already been added. |
void DeviceState::add | ( | UniquePtr< IVertexBuffer > && | vertexBuffer | ) |
Adds a new vertex buffer to the device state and uses its name as identifier.
vertexBuffer | The vertex buffer to add to the device state. |
InvalidArgumentException | Thrown, if another vertex buffer with the same identifier has already been added. |
Returns a buffer from the device state.
id | The identifier associated with the buffer. |
InvalidArgumentExceptoin | Thrown, if no buffer has been added for the provided id . |
void DeviceState::clear | ( | ) |
Release all resources managed by the device state.
IDescriptorSet & DeviceState::descriptorSet | ( | const String & | id | ) | const |
Returns an descriptor set from the device state.
id | The identifier associated with the descriptor set. |
InvalidArgumentExceptoin | Thrown, if no descriptor set has been added for the provided id . |
Returns an image from the device state.
id | The identifier associated with the image. |
InvalidArgumentExceptoin | Thrown, if no image has been added for the provided id . |
IIndexBuffer & DeviceState::indexBuffer | ( | const String & | id | ) | const |
Returns an index buffer from the device state.
id | The identifier associated with the index buffer. |
InvalidArgumentExceptoin | Thrown, if no index buffer has been added for the provided id . |
Returns a pipeline from the device state.
id | The identifier associated with the pipeline. |
InvalidArgumentExceptoin | Thrown, if no pipeline has been added for the provided id . |
bool DeviceState::release | ( | const IBuffer & | buffer | ) |
Releases a buffer.
buffer | The buffer to release. |
true
, if the buffer was properly released, false
otherwise.bool DeviceState::release | ( | const IDescriptorSet & | descriptorSet | ) |
Releases a descriptor set.
descriptorSet | The descriptor set to release. |
true
, if the descriptor set was properly released, false
otherwise.bool DeviceState::release | ( | const IImage & | image | ) |
Releases an image.
image | The image to release. |
true
, if the image was properly released, false
otherwise.bool DeviceState::release | ( | const IIndexBuffer & | buffer | ) |
Releases a index buffer.
buffer | The index buffer to release. |
true
, if the index buffer was properly released, false
otherwise.bool DeviceState::release | ( | const IPipeline & | pipeline | ) |
Releases a pipeline.
pipeline | The pipeline to release. |
true
, if the pipeline was properly released, false
otherwise.bool DeviceState::release | ( | const IRenderPass & | renderPass | ) |
Releases a render pass.
Calling this method will destroy the render pass. Before calling it, the render pass must be requested using renderPass. After this method has been executed, all references (including the renderPass parameter) will be invalid. If the render pass is not managed by the device state, this method will do nothing and return false
.
renderPass | The render pass to release. |
true
, if the render pass was properly released, false
otherwise.bool DeviceState::release | ( | const ISampler & | sampler | ) |
Releases a sampler.
sampler | The sampler to release. |
true
, if the sampler was properly released, false
otherwise.bool DeviceState::release | ( | const IVertexBuffer & | buffer | ) |
Releases a vertex buffer.
buffer | The vertex buffer to release. |
true
, if the vertex buffer was properly released, false
otherwise.IRenderPass & DeviceState::renderPass | ( | const String & | id | ) | const |
Returns a render pass from the device state.
id | The identifier associated with the render pass. |
InvalidArgumentExceptoin | Thrown, if no render pass has been added for the provided id . |
Returns an sampler from the device state.
id | The identifier associated with the sampler. |
InvalidArgumentExceptoin | Thrown, if no sampler has been added for the provided id . |
IVertexBuffer & DeviceState::vertexBuffer | ( | const String & | id | ) | const |
Returns a vertex buffer from the device state.
id | The identifier associated with the vertex buffer. |
InvalidArgumentExceptoin | Thrown, if no vertex buffer has been added for the provided id . |
|
friend |