Built-in functions

vuk provides some standard built-in functions that operate on vuk::Value s.

namespace vuk

Functions

inline Value<Buffer> host_data_to_buffer(Allocator &allocator, DomainFlagBits copy_domain, Buffer dst, const void *src_data, size_t size, VUK_CALLSTACK)

Fill a buffer with host data.

Parameters:
  • allocatorAllocator to use for temporary allocations

  • copy_domain – The domain where the copy should happen (when dst is mapped, the copy happens on host)

  • buffer – Buffer to fill

  • src_data – pointer to source data

  • size – size of source data

template<class T>
Value<Buffer> host_data_to_buffer(Allocator &allocator, DomainFlagBits copy_domain, Buffer dst, std::span<T> data, VUK_CALLSTACK)

Fill a buffer with host data.

Parameters:
  • allocatorAllocator to use for temporary allocations

  • copy_domain – The domain where the copy should happen (when dst is mapped, the copy happens on host)

  • dst – Buffer to fill

  • data – source data

inline Value<Buffer> download_buffer(Value<Buffer> buffer_src, VUK_CALLSTACK)

Download a buffer to GPUtoCPU memory.

Parameters:

buffer_src – Buffer to download

inline Value<ImageAttachment> host_data_to_image(Allocator &allocator, DomainFlagBits copy_domain, ImageAttachment image, const void *src_data, VUK_CALLSTACK)

Fill an image with host data.

Parameters:
  • allocatorAllocator to use for temporary allocations

  • copy_domain – The domain where the copy should happen

  • image – ImageAttachment to fill

  • src_data – pointer to source data

template<class T>
std::pair<Unique<Buffer>, Value<Buffer>> create_buffer(Allocator &allocator, MemoryUsage memory_usage, DomainFlagBits domain, std::span<T> data, size_t alignment = 1, VUK_CALLSTACK)

Allocates & fills a buffer with explicitly managed lifetime.

Parameters:
  • allocatorAllocator to allocate this Buffer from

  • mem_usage – Where to allocate the buffer (host visible buffers will be automatically mapped)

inline std::pair<Unique<Image>, Value<ImageAttachment>> create_image_with_data(Allocator &allocator, DomainFlagBits copy_domain, ImageAttachment &ia, const void *data, VUK_CALLSTACK)
template<class T>
std::pair<Unique<Image>, Value<ImageAttachment>> create_image_with_data(Allocator &allocator, DomainFlagBits copy_domain, ImageAttachment &ia, std::span<T> data, VUK_CALLSTACK)
inline std::tuple<Unique<Image>, Unique<ImageView>, Value<ImageAttachment>> create_image_and_view_with_data(Allocator &allocator, DomainFlagBits copy_domain, ImageAttachment &ia, const void *data, VUK_CALLSTACK)
template<class T>
std::tuple<Unique<Image>, Unique<ImageView>, Value<ImageAttachment>> create_image_and_view_with_data(Allocator &allocator, DomainFlagBits copy_domain, ImageAttachment ia, std::span<T> data, VUK_CALLSTACK)
inline Value<ImageAttachment> clear_image(Value<ImageAttachment> in, Clear clear_value, VUK_CALLSTACK)
inline Value<ImageAttachment> blit_image(Value<ImageAttachment> src, Value<ImageAttachment> dst, Filter filter, VUK_CALLSTACK)
inline Value<Buffer> copy(Value<ImageAttachment> src, Value<Buffer> dst, VUK_CALLSTACK)
inline Value<Buffer> copy(Value<Buffer> src, Value<Buffer> dst, VUK_CALLSTACK)
template<class T>
inline void fill(Value<Buffer> dst, T value, VUK_CALLSTACK)
inline Value<ImageAttachment> copy(Value<Buffer> src, Value<ImageAttachment> dst, VUK_CALLSTACK)
inline Value<ImageAttachment> copy(Value<ImageAttachment> src, Value<ImageAttachment> dst, VUK_CALLSTACK)
inline Value<ImageAttachment> resolve_into(Value<ImageAttachment> src, Value<ImageAttachment> dst, VUK_CALLSTACK)
inline Value<ImageAttachment> generate_mips(Value<ImageAttachment> image, uint32_t base_mip, uint32_t num_mips)

Generate mips for given ImageAttachment.

Parameters:
  • image – input Future of ImageAttachment

  • base_mip – source mip level

  • num_mips – number of mip levels to generate