MayaFlux 0.1.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 206 of file TextureLoom.cpp.

208{
209 if (!is_initialized()) {
211 "TextureLoom not initialized");
212 return nullptr;
213 }
214
215 auto vk_format = to_vulkan_format(format);
216 auto image = std::make_shared<Core::VKImage>(
217 width, height, 1, vk_format,
221
223
224 if (!image->is_initialized()) {
226 "Failed to initialize render target VKImage");
227 return nullptr;
228 }
229
231 image->get_image(),
232 vk::ImageLayout::eUndefined,
233 vk::ImageLayout::eColorAttachmentOptimal,
234 1, 1, vk::ImageAspectFlagBits::eColor);
235 image->set_current_layout(vk::ImageLayout::eColorAttachmentOptimal);
236
237 m_textures.push_back(image);
239 "Created render target: {}x{}, format: {}",
240 width, height, vk::to_string(vk_format));
241 return image;
242}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
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 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(), and MayaFlux::Core::VKImage::TYPE_2D.

+ Here is the call graph for this function: