MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ TextureBuffer()

MayaFlux::Buffers::TextureBuffer::TextureBuffer ( uint32_t  width,
uint32_t  height,
Portal::Graphics::ImageFormat  format,
const void *  initial_pixel_data = nullptr 
)

Create texture buffer with dimensions.

Parameters
widthTexture width in pixels
heightTexture height in pixels
formatPixel format
initial_pixel_dataOptional initial pixel data (nullptr = uninitialized)

The VKBuffer itself contains fullscreen quad vertices. The texture pixels are stored separately and uploaded to VKImage.

Definition at line 12 of file TextureBuffer.cpp.

17 : VKBuffer(
21 , m_width(width)
22 , m_height(height)
23 , m_format(format)
24{
25 RenderConfig default_config;
26 default_config.vertex_shader = "texture.vert.spv";
27 default_config.fragment_shader = "texture.frag.spv";
28 default_config.default_texture_binding = "texSampler";
30 set_default_render_config(default_config);
31
32 if (initial_pixel_data) {
33 size_t pixel_bytes = static_cast<size_t>(width) * height * Portal::Graphics::TextureLoom::get_bytes_per_pixel(format);
34 m_pixel_data.resize(pixel_bytes);
35 std::memcpy(m_pixel_data.data(), initial_pixel_data, pixel_bytes);
36 }
37
39
41 "Created TextureBuffer: {}x{} ({} pixel bytes, {} vertex bytes)",
43}
#define MF_INFO(comp, ctx,...)
std::vector< uint8_t > m_pixel_data
Portal::Graphics::ImageFormat m_format
std::vector< uint8_t > m_vertex_bytes
Portal::Graphics::RenderConfig RenderConfig
Definition VKBuffer.hpp:54
void set_default_render_config(const RenderConfig &config)
Called by derived classes to set their context-specific defaults.
Definition VKBuffer.hpp:502
static size_t get_bytes_per_pixel(ImageFormat format)
Get bytes per pixel for a format.
@ Init
Engine/subsystem initialization.
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::RenderConfig::default_texture_binding, MayaFlux::Portal::Graphics::RenderConfig::fragment_shader, generate_default_quad(), MayaFlux::Portal::Graphics::TextureLoom::get_bytes_per_pixel(), MayaFlux::Journal::Init, m_height, m_pixel_data, m_vertex_bytes, m_width, MF_INFO, MayaFlux::Buffers::VKBuffer::set_default_render_config(), MayaFlux::Portal::Graphics::RenderConfig::topology, MayaFlux::Portal::Graphics::TRIANGLE_STRIP, and MayaFlux::Portal::Graphics::RenderConfig::vertex_shader.

+ Here is the call graph for this function: