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

◆ create_render_target()

std::shared_ptr< Core::VKImage > MayaFlux::Portal::Graphics::TextureLoom::create_render_target ( uint32_t  width,
uint32_t  height,
ImageFormat  format = ImageFormat::RGBA8 
)

Create a render target (color attachment)

Parameters
widthWidth in pixels
heightHeight in pixels
formatImage format (default RGBA8)
Returns
Initialized VKImage configured for rendering

Creates image suitable for use as framebuffer color attachment. Can also be sampled in shaders after rendering.

Definition at line 213 of file TextureLoom.cpp.

215{
216 if (!is_initialized()) {
218 "TextureLoom not initialized");
219 return nullptr;
220 }
221
222 auto vk_format = to_vulkan_format(format);
223 auto image = std::make_shared<Core::VKImage>(
224 width, height, 1, vk_format,
228
230
231 if (!image->is_initialized()) {
233 "Failed to initialize render target VKImage");
234 return nullptr;
235 }
236
238 image->get_image(),
239 vk::ImageLayout::eUndefined,
240 vk::ImageLayout::eColorAttachmentOptimal,
241 1, 1, vk::ImageAspectFlagBits::eColor);
242 image->set_current_layout(vk::ImageLayout::eColorAttachmentOptimal);
243
244 m_textures.push_back(image);
246 "Created render target: {}x{}, format: {}",
247 width, height, vk::to_string(vk_format));
248 return image;
249}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
IO::ImageData image
uint32_t width
void initialize_image(const std::shared_ptr< VKImage > &image)
Initialize a VKImage (allocate VkImage, memory, and create image view)
void transition_image_layout(vk::Image image, vk::ImageLayout old_layout, vk::ImageLayout new_layout, uint32_t mip_levels=1, uint32_t array_layers=1, vk::ImageAspectFlags aspect_flags=vk::ImageAspectFlagBits::eColor)
Transition image layout using a pipeline barrier.
@ RENDER_TARGET
Color attachment for rendering.
static vk::Format to_vulkan_format(ImageFormat format)
Convert Portal ImageFormat to Vulkan format.
Core::BackendResourceManager * m_resource_manager
std::vector< std::shared_ptr< Core::VKImage > > m_textures
bool is_initialized() const
Check if manager is initialized.
@ ImageProcessing
Image processing tasks (filters, transformations)
@ Portal
High-level user-facing API layer.
@ IMAGE_COLOR
2D RGB/RGBA image

References image, MayaFlux::Kakshya::IMAGE_COLOR, MayaFlux::Journal::ImageProcessing, MayaFlux::Core::BackendResourceManager::initialize_image(), is_initialized(), m_resource_manager, m_textures, MF_ERROR, MF_INFO, MayaFlux::Journal::Portal, MayaFlux::Core::VKImage::RENDER_TARGET, to_vulkan_format(), MayaFlux::Core::BackendResourceManager::transition_image_layout(), MayaFlux::Core::VKImage::TYPE_2D, and width.

+ Here is the call graph for this function: