core::ivk::material_t class final

class that creates a bindable collection of resources that can be used in conjuction with a surface to render.

The material class is a container of various resources that can, together, describe what should happen to a surface in the render pipeline on the GPU, and what is all needed. The material class also can contain instance data and will manage this for you. Together with a core::ivk::geometry_t, this describes all the resources you need to render something on screen.

constructors, destructors, conversion operators

material_t
the constructor that will create and bind the necesary resources to create a valid pipeline.
public

member-functions

data
returns a handle to the material data used to construct this object.
const public
bind_pipeline
prepares the material for rendering by binding the pipeline.
public
bind_pipeline
prepares the material for rendering by binding the pipeline.
public
shaders
returns all the shaders that are being used right now by this material.
const private
textures
returns all currently used textures and their binding slots.
const private
samplers
returns all currently used samplers and their binding slots.
const private
get
private
get
private

Function documentation

core::ivk::material_t::material_t(core::resource::cache_t& cache, const core::resource::metadata& metaData, psl::meta::file* metaFile, core::resource::handle<core::ivk::context> context, core::resource::handle<core::data::material_t> data, core::resource::handle<core::ivk::pipeline_cache> pipelineCache, core::resource::handle<core::ivk::buffer_t> materialBuffer)

Brief

the constructor that will create and bind the necesary resources to create a valid pipeline.

Parameters
cache in resource cache that is constructing this material.
metaData in metadata associated with the material.
metaFile in metafile associated with the material's instance.
context in a handle to a graphics context (needs to be valid and loaded) which will own the material.
data in the material data this instance will be based on.
pipelineCache in the cache this instance can request a pipeline from.
materialBuffer in a GPU buffer that can be used by this instance to upload data to (if needed).

core::resource::handle<core::data::material_t> core::ivk::material_t::data() const

Brief

returns a handle to the material data used to construct this object.

Details

bool core::ivk::material_t::bind_pipeline(vk::CommandBuffer cmdBuffer, core::resource::handle<core::ivk::framebuffer_t> framebuffer, uint32_t drawIndex)

Brief

prepares the material for rendering by binding the pipeline.

Details

Parameters
cmdBuffer in the command buffer you'll be recording to
framebuffer in the framebuffer the pipeline will be bound to.
drawIndex in the index to be set in the push constant.

bool core::ivk::material_t::bind_pipeline(vk::CommandBuffer cmdBuffer, core::resource::handle<core::ivk::swapchain> swapchain, uint32_t drawIndex)

Brief

prepares the material for rendering by binding the pipeline.

Details

Parameters
cmdBuffer in the command buffer you'll be recording to
swapchain in the swapchain the pipeline will be bound to.
drawIndex in the index to be set in the push constant.

core::resource::handle<core::ivk::pipeline> core::ivk::material_t::get(core::resource::handle<core::ivk::framebuffer_t> framebuffer) private

Details

tries to find, and return a core::ivk::pipeline that can satisfy the requirements of this material. In case none is present, then one will be created instead.

Parameters
framebuffer in the framebuffer to bind to.
Returns the pipeline this material instance uses for the given framebuffer.

core::resource::handle<core::ivk::pipeline> core::ivk::material_t::get(core::resource::handle<core::ivk::swapchain> swapchain) private

Details

tries to find, and return a core::ivk::pipeline that can satisfy the requirements of this material. In case none is present, then one will be created instead.

Parameters
swapchain in the swapchain to bind to.
Returns the pipeline this material instance uses for the given framebuffer.