MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
PipelineGraphicsData.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace MayaFlux::Buffers {
7class VKBuffer;
8class DataReadProcessor;
9}
10
11namespace MayaFlux::Core {
12class VKImage;
13}
14
16
17/**
18 * @brief Arm the read that suits what the buffer is.
19 *
20 * A texture buffer that retains host pixels, such as a video or camera buffer,
21 * reads them without touching the GPU; a texture buffer without them and a node
22 * texture read their GPU image, which blocks the graphics cycle for the
23 * transfer. Mesh and geometry sources read their mesh,
24 * network geometry reads its declared vertices, and any other buffer reads its
25 * primary storage.
26 */
27void arm_graphics_read(Buffers::DataReadProcessor& reader, const std::shared_ptr<Buffers::VKBuffer>& buffer);
28
29/**
30 * @brief Finish the pending read as one DataVariant.
31 *
32 * Pixels yield their typed storage, a mesh yields its interleaved vertex bytes,
33 * and any other read yields raw bytes. Returns nullopt while nothing is ready.
34 */
35std::optional<Kakshya::DataVariant> resolve_graphics_read(Buffers::DataReadProcessor& reader);
36
37/**
38 * @brief Whether a DataVariant can be written to the buffer's primary storage.
39 *
40 * False for image, mesh, geometry, network and volume buffers: their primary
41 * storage is regenerated from another source or is not the data a caller means,
42 * so a raw write would be lost or would corrupt it.
43 */
44bool accepts_raw_write(const std::shared_ptr<Buffers::VKBuffer>& buffer);
45
46/**
47 * @brief Whether the buffer holds its frames as layers that can be written one at a time.
48 */
49bool accepts_layer_write(const std::shared_ptr<Buffers::VKBuffer>& buffer);
50
51/**
52 * @brief Write a DataVariant into one layer of a layered buffer.
53 *
54 * An empty variant is skipped, as when nothing has arrived yet. The bytes must
55 * match the layer's size, which the buffer reports when they do not.
56 *
57 * @param target Buffer that passed accepts_layer_write.
58 * @param layer Layer to replace.
59 * @param data Frame bytes.
60 */
61void write_layer(
62 const std::shared_ptr<Buffers::VKBuffer>& target,
63 uint32_t layer,
64 const Kakshya::DataVariant& data);
65
66/**
67 * @brief Write a GPU image into one layer of a layered buffer, with no host read.
68 *
69 * @param target Buffer that passed accepts_layer_write.
70 * @param layer Layer to replace.
71 * @param image Source image; the buffer fits it to the layer.
72 */
73void write_layer(
74 const std::shared_ptr<Buffers::VKBuffer>& target,
75 uint32_t layer,
76 const std::shared_ptr<Core::VKImage>& image);
77
78/**
79 * @brief The GPU image a buffer displays, or null when it has none to copy from.
80 */
81std::shared_ptr<Core::VKImage> source_image(const std::shared_ptr<Buffers::VKBuffer>& buffer);
82
83/**
84 * @brief Make a buffer draw to the window in a render config, unless it already does.
85 *
86 * A buffer that already has a render processor is left as it is; a different
87 * target window than the one requested is reported. Otherwise the config is
88 * applied through the buffer's own setup_rendering, chosen by buffer type: the
89 * texture, geometry, mesh, network, grid and Forma families are covered. Any
90 * other buffer is reported and left untouched.
91 *
92 * @return True if the buffer renders after the call.
93 */
94bool ensure_rendering(const std::shared_ptr<Buffers::VKBuffer>& buffer, const Portal::Graphics::RenderConfig& config);
95
96}
IO::ImageData image
Definition Decoder.cpp:47
std::shared_ptr< NetworkGeometryBuffer > buffer
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.
Definition NDData.hpp:70
void write_layer(const std::shared_ptr< Buffers::VKBuffer > &target, uint32_t layer, const Kakshya::DataVariant &data)
Write a DataVariant into one layer of a layered buffer.
bool accepts_layer_write(const std::shared_ptr< Buffers::VKBuffer > &buffer)
Whether the buffer holds its frames as layers that can be written one at a time.
void arm_graphics_read(Buffers::DataReadProcessor &reader, const std::shared_ptr< Buffers::VKBuffer > &buffer)
Arm the read that suits what the buffer is.
std::shared_ptr< Core::VKImage > source_image(const std::shared_ptr< Buffers::VKBuffer > &buffer)
The GPU image a buffer displays, or null when it has none to copy from.
bool ensure_rendering(const std::shared_ptr< Buffers::VKBuffer > &buffer, const Portal::Graphics::RenderConfig &config)
Make a buffer draw to the window in a render config, unless it already does.
std::optional< Kakshya::DataVariant > resolve_graphics_read(Buffers::DataReadProcessor &reader)
Finish the pending read as one DataVariant.
bool accepts_raw_write(const std::shared_ptr< Buffers::VKBuffer > &buffer)
Whether a DataVariant can be written to the buffer's primary storage.