Topaz 5.0
Topaz Game Engine
|
Create/edit/destroy resources (images and buffers).
Typedefs | |
using | tz::gpu::resource_handle = tz::handle<buffer_info> |
Corresponds to a previously-created resource (buffer or image). | |
Classes | |
struct | tz::gpu::buffer_info |
Specifies creation flags for a buffer. More... | |
struct | tz::gpu::image_info |
Specifies creation flags for an image. More... | |
std::expected< resource_handle, tz::error_code > tz::gpu::create_buffer | ( | buffer_info | ) |
Create a new buffer.
Once you successfully create a resource, you can use the returned resource_handle to create a new renderer that uses that resource.
Once you're done with a resource, you can destroy it using destroy_resource.
std::expected< resource_handle, tz::error_code > tz::gpu::create_image | ( | image_info | ) |
Create a new image.
Once you successfully create a resource, you can use the returned resource_handle to create a new renderer that uses that resource.
Once you're done with a resource, you can destroy it using destroy_resource.
tz::error_code tz::gpu::destroy_resource | ( | resource_handle | res | ) |
Manually destroy a resource.
If you know a resource uses alot of memory, or you're sure you're not going to use it anymore, you can destroy it here, causing all of its memory to be available for reuse.
tz::error_code tz::gpu::resource_write | ( | resource_handle | res, |
std::span< const std::byte > | new_data, | ||
std::size_t | offset = 0 ) |
Write some new data to a resource. The thread will block until the changes are resident GPU-side.
res | Resource whose data should be changed. |
new_data | Region containing new memory for the provided resource. |
If the region of new data is smaller than the total size of the resource's underlying data, then all bytes beyond the new data region will be unchanged and keep their previous state.
Regarding buffer resources:
std::size_t tz::gpu::resource_size | ( | resource_handle | res | ) |
Retrieve the size of a resource's data, in bytes.
unsigned int tz::gpu::image_get_width | ( | resource_handle | res | ) |
Retrieve the width of an image resource.
unsigned int tz::gpu::image_get_height | ( | resource_handle | res | ) |
Retrieve the height of an image resource.
std::span< const std::byte > tz::gpu::resource_read | ( | resource_handle | res | ) |
Retrieves the current data within a resource.
You aren't allowed to read from tz::gpu::window_resource.
void tz::gpu::buffer_resize | ( | resource_handle | bufh, |
std::size_t | new_size_bytes ) |
Resize a buffer resource.
void tz::gpu::image_resize | ( | resource_handle | imgh, |
unsigned int | new_width, | ||
unsigned int | new_height ) |
Resize an image resource.
tz::error_code tz::gpu::index_buffer_write | ( | resource_handle | index_buffer, |
std::span< const index_t > | indices ) |
Write indices into a buffer resource.
This is a helper function which will call resource_write under-the-hood.
tz::error_code tz::gpu::draw_buffer_write | ( | resource_handle | draw_buffer, |
std::uint32_t | count, | ||
std::span< const draw_t > | draws ) |
Write draw-indirect-count + commands into a buffer resource.
This is a helper function which will call resource_write under-the-hood.
tz::error_code tz::gpu::draw_buffer_indexed_write | ( | resource_handle | draw_buffer, |
std::uint32_t | count, | ||
std::span< const draw_indexed_t > | draws ) |
Write draw-indirect-count + indexed commands into a buffer resource.
This is a helper function which will call resource_write under-the-hood.
Corresponds to a previously-created resource (buffer or image).
enum tz::gpu::buffer_flag |
Specifies optional behaviours for a buffer.
|
strong |
Describes the internal format of an image's data.
You are not able to choose a specific sized format.
enum tz::gpu::image_flag |
Specifies optional behaviours for a buffer.
Enumerator | |
---|---|
colour_target | Image can be used as a colour target by a graphics pass. |
depth_target | Image can be used as a depth target by a graphics pass. |
resize_to_match_window_resource | Image will be automatically resized to match the dimensions of the window. In addition, tz::gpu::image_info::width and tz::gpu::image_info::height are ignored. |
|
constexpr |
Corresponds to either the window image (as a colour target) or the system depth image (as a depth target). Note that it is invalid to use this value for anything other than pass_graphics_state::colour_targets or pass_graphics_state::depth_target.