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

◆ bind_texture() [2/2]

void MayaFlux::Buffers::RenderProcessor::bind_texture ( uint32_t  binding,
const std::shared_ptr< Core::VKImage > &  texture,
vk::Sampler  sampler = nullptr 
)

Bind a texture to a descriptor binding point.

Parameters
bindingBinding index (matches shader layout(binding = N))
textureVKImage texture to bind
samplerOptional sampler (uses default linear if null)

Definition at line 61 of file RenderProcessor.cpp.

65{
66 if (!texture) {
68 "Cannot bind null texture to binding {}", binding);
69 return;
70 }
71
72 if (!sampler) {
74 sampler = loom.get_default_sampler();
75 }
76
77 m_texture_bindings[binding] = { .texture = texture, .sampler = sampler };
78
80
82 foundry.update_descriptor_image(
84 binding,
85 texture->get_image_view(),
86 sampler,
87 vk::ImageLayout::eShaderReadOnlyOptimal);
88 }
89
91 "Bound texture to binding {}", binding);
92}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::unordered_map< uint32_t, TextureBinding > m_texture_bindings
Portal::Graphics::RenderPipelineID m_render_pipeline_id
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
constexpr RenderPipelineID INVALID_RENDER_PIPELINE
MAYAFLUX_API TextureLoom & get_texture_manager()
Get the global texture manager instance.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::get_texture_manager(), MayaFlux::Portal::Graphics::INVALID_RENDER_PIPELINE, MayaFlux::Buffers::ShaderProcessor::m_descriptor_set_ids, m_render_pipeline_id, m_texture_bindings, MF_DEBUG, and MF_ERROR.

Referenced by bind_texture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: