|
using | UniformStructInstanceList = std::vector< std::unique_ptr< UniformStructInstance > > |
|
using | BufferBindingInstanceList = std::vector< std::unique_ptr< BufferBindingInstance > > |
|
using | SamplerInstanceList = std::vector< std::unique_ptr< SamplerInstance > > |
|
bool | initInternal (RenderService &renderService, BaseMaterial &material, BaseMaterialInstanceResource &instanceResource, utility::ErrorState &errorState) |
|
void | rebuildUBO (UniformBufferObject &ubo, UniformStructInstance *overrideStruct) |
|
void | onUniformCreated () |
|
void | onSamplerChanged (int imageStartIndex, SamplerInstance &samplerInstance) |
|
void | onBufferChanged (int storageBufferIndex, BufferBindingInstance &bindingInstance) |
|
void | updateBuffers (const DescriptorSet &descriptorSet) |
|
bool | initBuffers (BaseMaterialInstanceResource &resource, utility::ErrorState &errorState) |
|
void | updateSamplers (const DescriptorSet &descriptorSet) |
|
bool | initSamplers (BaseMaterialInstanceResource &resource, utility::ErrorState &errorState) |
|
void | addImageInfo (const Texture2D &texture2D, VkSampler sampler) |
|
BufferBindingInstance * | getOrCreateBufferInternal (const std::string &name) |
|
SamplerInstance * | getOrCreateSamplerInternal (const std::string &name) |
|
UniformStructInstance & | createUniformRootStruct (const ShaderVariableStructDeclaration &declaration, const UniformCreatedCallback &uniformCreatedCallback) |
|
BufferBindingInstance & | addBindingInstance (std::unique_ptr< BufferBindingInstance > instance) |
|
SamplerInstance & | addSamplerInstance (std::unique_ptr< SamplerInstance > instance) |
|
VkDevice | mDevice = nullptr |
|
RenderService * | mRenderService = nullptr |
|
BaseMaterial * | mMaterial = nullptr |
|
BaseMaterialInstanceResource * | mResource = nullptr |
|
DescriptorSetCache * | mDescriptorSetCache |
|
std::vector< UniformBufferObject > | mUniformBufferObjects |
|
std::vector< VkWriteDescriptorSet > | mStorageWriteDescriptorSets |
|
std::vector< VkDescriptorBufferInfo > | mStorageDescriptors |
|
std::vector< VkWriteDescriptorSet > | mSamplerWriteDescriptorSets |
|
std::vector< VkDescriptorImageInfo > | mSamplerDescriptors |
|
bool | mUniformsCreated = false |
|
To run a compute shader, you must use a ComputeMaterialInstance. This material contains the runtime resources that are bound to shader variable inputs in your compute shader. ComputeMaterialInstance is intended to be used as a property in ComputeComponents. It must be initialized based on a ComputeMaterialInstanceResource object to fill its runtime data. init() must be called from the ComponentInstance's init() function. Before drawing, make sure to call update() to update the uniforms and samplers. A descriptorset will be returned that can be used to issue the Vulkan draw call.
Multiple ComputeMaterialInstances can share a single ComputeMaterial and a single ComputeMaterialInstance can override ComputeMaterial properties on a per-instance basis. This means that you can set uniform, buffer or texture data on ComputeMaterial level, which means that, as long as the property isn't overridden, you will set it for all ComputeMaterialInstances in one go. If you set a property on ComputeMaterialInstance level, you will set it only for that ComputeMaterialInstance.
It is also possible to set uniform, buffer or texture state on a single MaterialInstance multiple times per frame. When multiple draws are performed with the frame, the state at the point of draw will be used.