Encapsulates a Vulkan compute pipeline and all necessary resources to use it.
More...
|
| | ComputePipeline (const std::string &shaderPath, size_t numSSBOs, size_t pushConstantSize, size_t numStorageImages=0, size_t numSampledImages=0) |
| | Construct a new compute pipeline.
|
| |
| void | Reinitialize (const std::string &shaderPath, size_t numSSBOs, size_t pushConstantSize, size_t numStorageImages=0, size_t numSampledImages=0) |
| | Wipes the state of this object and recreates it with a new shader binary and configuration.
|
| |
| template<class T > |
| void | BindBuffer (size_t i, AcceleratorBuffer< T > &buf, bool outputOnly=false) |
| | Binds an input or output SSBO to a descriptor slot.
|
| |
| void | BindStorageImage (size_t i, vk::Sampler sampler, vk::ImageView view, vk::ImageLayout layout) |
| | Binds a storage (output) image to a descriptor slot.
|
| |
| void | BindSampledImage (size_t i, vk::Sampler sampler, vk::ImageView view, vk::ImageLayout layout) |
| | Binds a sampled (input) image to a descriptor slot.
|
| |
| template<class T > |
| void | BindBufferNonblocking (size_t i, AcceleratorBuffer< T > &buf, vk::raii::CommandBuffer &cmdBuf, bool outputOnly=false) |
| | Binds an input or output SSBO to a descriptor slot.
|
| |
| void | Bind (vk::raii::CommandBuffer &cmdBuf) |
| | Binds the pipeline to a command buffer.
|
| |
| template<class T > |
| void | Dispatch (vk::raii::CommandBuffer &cmdBuf, T pushConstants, uint32_t x, uint32_t y=1, uint32_t z=1) |
| | Adds a vkCmdDispatch operation to a command buffer to execute the compute shader.
|
| |
| template<class T > |
| void | DispatchNoRebind (vk::raii::CommandBuffer &cmdBuf, T pushConstants, uint32_t x, uint32_t y=1, uint32_t z=1) |
| | Similar to Dispatch() but does not bind descriptor sets.
|
| |
|
|
std::string | m_shaderPath |
| | Filesystem path to the compiled SPIR-V shader binary.
|
| |
|
size_t | m_numSSBOs |
| | Number of SSBO bindings in the shader.
|
| |
|
size_t | m_numStorageImages |
| | Number of output image bindings in the shader.
|
| |
|
size_t | m_numSampledImages |
| | Number of input image bindings in the shader.
|
| |
|
size_t | m_pushConstantSize |
| | Size of the push constants, in bytes.
|
| |
|
std::unique_ptr< vk::raii::ShaderModule > | m_shaderModule |
| | Handle to the shader module object.
|
| |
|
std::unique_ptr< vk::raii::Pipeline > | m_computePipeline |
| | Handle to the Vulkan compute pipeline.
|
| |
|
std::unique_ptr< vk::raii::PipelineLayout > | m_pipelineLayout |
| | Layout of the compute pipeline.
|
| |
|
std::unique_ptr< vk::raii::DescriptorSetLayout > | m_descriptorSetLayout |
| | Layout of our descriptor set.
|
| |
|
std::unique_ptr< vk::raii::DescriptorPool > | m_descriptorPool |
| | Pool for allocating m_descriptorSet from.
|
| |
|
std::unique_ptr< vk::raii::DescriptorSet > | m_descriptorSet |
| | The actual descriptor set storing our inputs and outputs.
|
| |
|
std::vector< vk::WriteDescriptorSet > | m_writeDescriptors |
| | Set of bindings to be written to m_descriptorSet.
|
| |
|
std::vector< vk::DescriptorBufferInfo > | m_bufferInfo |
| | Details about our SSBOs.
|
| |
|
std::vector< vk::DescriptorImageInfo > | m_storageImageInfo |
| | Details about our output images.
|
| |
|
std::vector< vk::DescriptorImageInfo > | m_sampledImageInfo |
| | Details about our input images.
|
| |
Encapsulates a Vulkan compute pipeline and all necessary resources to use it.
Supported shaders must have all image bindings numerically after all SSBO bindings.
A ComputePipeline is typically owned by a filter instance.
Prefers KHR_push_descriptor (and some APIs are only available if it is present), but basic functionality is available without it.
Adds a vkCmdDispatch operation to a command buffer to execute the compute shader.
If KHR_push_descriptor is not available, performs an updateDescriptorSets. This means only one Dispatch() of a given ComputePipeline can be present in a command buffer at a time.
If KHR_push_descriptor is available, performs a pushDescriptorSetKHR. In this case, arbitrarily many Dispatch() calls on the same ComputePipeline may be submitted to the same command buffer in sequence.
- Parameters
-
| cmdBuf | Command buffer to append the dispatch operation to |
| pushConstants | Constants to pass to the shader |
| x | X size of the dispatch, in thread blocks |
| y | Y size of the dispatch, in thread blocks |
| z | Z size of the dispatch, in thread blocks |
Similar to Dispatch() but does not bind descriptor sets.
This allows multiple consecutive invocations of the same shader (potentially with different dispatch sizes or push constant values) in the same command buffer, even without KHR_push_descriptor, as long as the same set of input and output descriptors are used by each invocation.
If KHR_push_descriptor is available, performs a vkPushDescriptorSetKHR. If not, descriptors are untouched.
- Parameters
-
| cmdBuf | Command buffer to append the dispatch operation to |
| pushConstants | Constants to pass to the shader |
| x | X size of the dispatch, in thread blocks |
| y | Y size of the dispatch, in thread blocks |
| z | Z size of the dispatch, in thread blocks |