Persistent system managing the rendering context of a Window.
More...
#include <GREM/graphics/Device.hpp>
|
| | Device (Window &window, const DeviceOptions &options={}) |
| | Construct a device.
|
| | Device (Filesystem &filesystem, Window &window, const DeviceOptions &options={}) |
| | Construct a device with an associated filesystem, allowing for graphics pipelines to be cached.
|
| | ~Device () |
| | Destructor.
|
| | Device (const Device &)=delete |
| | Copying a device is not allowed.
|
| | Device (Device &&)=delete |
| | Moving a device is not allowed.
|
| Device & | operator= (const Device &)=delete |
| | Copying a device is not allowed.
|
| Device & | operator= (Device &&)=delete |
| | Moving a device is not allowed.
|
| void | blit (TextureRegion2DReference renderTarget, TextureRegion2DConstReference renderSource, TextureFilter filter) |
| | Copy and paste a rectangular region of a texture onto a region of another texture.
|
| void | blit (TextureSubresourceReference renderTarget, Offset2D targetOffset, TextureRegion2DConstReference renderSource) |
| | Copy and paste a rectangular region of a texture at its original size onto another texture at a specific offset.
|
| void | blit (TextureSubresourceReference renderTarget, TextureRegion2DConstReference renderSource) |
| | Copy and paste a rectangular region of a texture at its original size onto another texture at its bottom left corner.
|
| void | render (const RenderPass &renderPass) |
| | Submit a list of graphics commands to be rendered.
|
| void | await () noexcept |
| | Wait for all submitted graphics commands to finish being rendered and presented.
|
| bool | awaitPresentation (const Swapchain &swapchain, PresentationSubmissionID presentationSubmissionID, Duration timeout={}) noexcept |
| | Wait for a specific frame to finish being rendered and presented.
|
| PresentationSubmission | present (Swapchain &swapchain) |
| | Submit the current back buffer of a swapchain for display to its associated window, and acquire the next back buffer frame of the swapchain for subsequent rendering.
|
| const FeatureSupport & | getSupportedFeatures () const noexcept |
| | Get the features supported by the device.
|
| DeviceImplementation * | get () noexcept |
| | Get a pointer to the underlying resource implementation.
|
| const DeviceImplementation * | get () const noexcept |
| | Get a pointer to the underlying resource implementation.
|
Persistent system managing the rendering context of a Window.
An instance of this class should typically be kept throughout the lifetime of the application in order to continuously render the visual state of the latest produced frame through the application::Application::display() callback.
◆ Device() [1/4]
Construct a device.
- Parameters
-
| window | window for which to manage the rendering context, and to which frames presented through this device will be rendered. Must outlive the device. |
| options | initial configuration of the device, see DeviceOptions. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ Device() [2/4]
Construct a device with an associated filesystem, allowing for graphics pipelines to be cached.
- Parameters
-
| filesystem | filesystem to load the shader and graphics pipeline caches from, and save the caches to, when the device is destroyed, if caching is supported by the implementation. |
| window | window for which to manage the rendering context, and to which frames presented through this device will be rendered. Must outlive the device. |
| options | initial configuration of the device, see DeviceOptions. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
- Note
- Loading/saving the pipeline cache might silently fail if the file doesn't exist or couldn't be written.
◆ ~Device()
| grem::graphics::Device::~Device |
( |
| ) |
|
◆ Device() [3/4]
| grem::graphics::Device::Device |
( |
const Device & | | ) |
|
|
delete |
Copying a device is not allowed.
◆ Device() [4/4]
| grem::graphics::Device::Device |
( |
Device && | | ) |
|
|
delete |
Moving a device is not allowed.
◆ operator=() [1/2]
| Device & grem::graphics::Device::operator= |
( |
const Device & | | ) |
|
|
delete |
Copying a device is not allowed.
◆ operator=() [2/2]
Moving a device is not allowed.
◆ blit() [1/3]
Copy and paste a rectangular region of a texture onto a region of another texture.
- Parameters
-
| renderTarget | target region to paste to. Must reference a valid region of a non-multisampled texture. |
| renderSource | source region to copy from. Must reference a valid region of a non-multisampled texture. |
| filter | texture filtering method to use if the target and source extents don't match. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
- Note
- Use the unscaled version of blit() instead to allow for multisampled textures.
◆ blit() [2/3]
Copy and paste a rectangular region of a texture at its original size onto another texture at a specific offset.
- Parameters
-
| renderTarget | target to paste to. Must reference a valid subresource of a valid texture. |
| targetOffset | offset, in texels, from the bottom left corner of the target texture at which to paste the copied texture region. |
| renderSource | source region to copy from. Must reference a valid region of a valid texture that fits into the render target at the specified offset. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
- Note
- This version of blit() may be used to resolve a multisampled texture into a non-multisampled one. However, for better performance, it should generally be preferred to use a resolve render target directly in the render pass that performed the multisampling instead.
- Warning
- If the source texture is multisampled and the target texture is not, the target and source textures must have the same texture format.
◆ blit() [3/3]
Copy and paste a rectangular region of a texture at its original size onto another texture at its bottom left corner.
- Parameters
-
| renderTarget | target to paste to. Must reference a valid subresource of a valid texture. |
| renderSource | source region to copy from. Must reference a valid region of a valid texture that fits into the render target. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
- Note
- This version of blit() may be used to resolve a multisampled texture into a non-multisampled one. However, for better performance, it should generally be preferred to use a resolve render target directly in the render pass that performed the multisampling instead.
- Warning
- If the source texture is multisampled and the target texture is not, the target and source textures must have the same texture format.
◆ render()
| void grem::graphics::Device::render |
( |
const RenderPass & | renderPass | ) |
|
Submit a list of graphics commands to be rendered.
- Parameters
-
| renderPass | list of commands to execute. |
- Exceptions
-
| graphics::Error | on failure to render the render pass. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ await()
| void grem::graphics::Device::await |
( |
| ) |
|
|
noexcept |
Wait for all submitted graphics commands to finish being rendered and presented.
◆ awaitPresentation()
Wait for a specific frame to finish being rendered and presented.
- Parameters
-
| swapchain | swapchain that the frame was presented to. |
| presentationSubmissionID | identifier for the frame to wait for. Must be a valid identifier acquired from a call to present() on this device with the given swapchain. |
| timeout | maximum duration to wait before returning early, or a non-positive value for an infinite timeout. |
- Returns
- true if the frame was successfully awaited, false otherwise.
- Note
- This function requires frame waiting to be supported, which can be queried using device.getSupportedFeatures().supportsAwaitPresentation. If the feature is not supported, awaitPresentation() will immediately return false.
◆ present()
Submit the current back buffer of a swapchain for display to its associated window, and acquire the next back buffer frame of the swapchain for subsequent rendering.
- Parameters
-
| swapchain | swapchain to present the back buffer of. |
- Exceptions
-
| graphics::Error | on failure to acquire the next frame. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
- Returns
- information about the submitted frame.
◆ getSupportedFeatures()
| const FeatureSupport & grem::graphics::Device::getSupportedFeatures |
( |
| ) |
const |
|
nodiscardnoexcept |
Get the features supported by the device.
- Returns
- a read-only reference to the supported features.
◆ get() [1/2]
| DeviceImplementation * grem::graphics::Device::get |
( |
| ) |
|
|
inlinenodiscardnoexcept |
Get a pointer to the underlying resource implementation.
- Returns
- a non-owning pointer to the underlying resource.
- Note
- The type of the returned resource is backend-specific and has no meaning to application code.
◆ get() [2/2]
| const DeviceImplementation * grem::graphics::Device::get |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get a pointer to the underlying resource implementation.
- Returns
- a non-owning read-only pointer to the underlying resource.
- Note
- The type of the returned resource is backend-specific and has no meaning to application code.
The documentation for this class was generated from the following file: