MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
TextureWriteProcessor.cpp
Go to the documentation of this file.
2
3#include "TextureBuffer.hpp"
4
5namespace MayaFlux::Buffers {
6
12
14{
15 m_pending = std::move(variant);
16 m_dirty.test_and_set(std::memory_order_release);
17
18 if (m_texture_buffer) {
19 m_texture_buffer->mark_texture_dirty();
20 }
21}
22
24{
25 return m_dirty.test(std::memory_order_acquire);
26}
27
28std::optional<Kakshya::DataVariant> TextureWriteProcessor::get_variant_source()
29{
30 if (m_dirty.test(std::memory_order_acquire)) {
31 m_dirty.clear(std::memory_order_release);
32 std::swap(m_active, m_pending);
33 }
34
35 return m_active;
36}
37
38} // namespace MayaFlux::Buffers
void set_streaming_mode(bool enabled)
Enable or disable streaming mode for pixel uploads.
std::shared_ptr< TextureBuffer > m_texture_buffer
bool has_pending() const noexcept
Returns true if a snapshot has been set and not yet consumed.
std::optional< Kakshya::DataVariant > m_active
std::optional< Kakshya::DataVariant > m_pending
std::optional< Kakshya::DataVariant > get_variant_source() override
void set_data(Kakshya::DataVariant variant)
Supply pixel data for the next cycle.
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:76