core::ivk::material 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, this describes all the resources you need to render something on screen.

constructors, destructors, conversion operators

material
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
shaders
returns all the shaders that are being used right now by this material.
const public
textures
returns all currently used textures and their binding slots.
const public
samplers
returns all currently used samplers and their binding slots.
const public
buffers
returns all currently used buffers and their binding slots.
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
get
private
get
private

Function documentation

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

Brief

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

Parameters
cache
metaData
metaFile
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.
pipeline_cache
materialBuffer in a GPU buffer that can be used by this instance to upload data to (if needed).

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

Brief

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

Details

const std::vector<std::pair<uint32_t, core::resource::handle<core::ivk::buffer>>>& core::ivk::material::buffers() const

Brief

returns all currently used buffers and their binding slots.

Details

bool core::ivk::material::bind_pipeline(vk::CommandBuffer cmdBuffer, core::resource::handle<core::ivk::framebuffer> 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::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::get(core::resource::handle<core::ivk::framebuffer> 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::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.