diff --git a/include/tz/gpu/resource.hpp b/include/tz/gpu/resource.hpp index faeacccf52..b369e20772 100644 --- a/include/tz/gpu/resource.hpp +++ b/include/tz/gpu/resource.hpp @@ -203,6 +203,15 @@ namespace tz::gpu * - If the image was created with @ref image_type::depth or @ref image_type::floats, then each pixel should be 4 bytes - a single signed 32-bit float. */ void resource_write(resource_handle res, std::span new_data); + /** + * @ingroup tz_gpu_resource + * @brief Retrieves the current data within a resource. + * + * You aren't allowed to read from @ref tz::gpu::window_resource. + */ + std::span resource_read(resource_handle res); + void buffer_resize(resource_handle bufh, std::size_t new_size_bytes); + void image_resize(resource_handle imgh, unsigned int new_width, unsigned int new_height); /** * @ingroup tz_gpu_resource * @brief Write indices into a buffer resource. diff --git a/src/tz/gpu/rhi_vulkan.cpp b/src/tz/gpu/rhi_vulkan.cpp index 4480c607e2..21fd484d5b 100644 --- a/src/tz/gpu/rhi_vulkan.cpp +++ b/src/tz/gpu/rhi_vulkan.cpp @@ -902,6 +902,26 @@ namespace tz::gpu impl_write_single_resource(resh); } + std::span resource_read(resource_handle resh) + { + auto& res = resources[resh.peek()]; + return res.data; + } + + void buffer_resize(resource_handle bufh, std::size_t new_size_bytes) + { + (void)bufh; + (void)new_size_bytes; + tz_error("buffer resize NYI"); + } + + void image_resize(resource_handle imgh, unsigned int new_width, unsigned int new_height) + { + (void)imgh; + (void)new_width; (void)new_height; + tz_error("image resize NYI"); + } + void index_buffer_write(resource_handle index_buffer, std::span indices) { resource_write(index_buffer, std::as_bytes(indices));