NDEVR
API Documentation
VulkanComputePipeline.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2026, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: VulkanCompute
28File: VulkanComputePipeline
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include "VulkanComputeDevice.h"
35#include "../../VulkanGraphics/Headers/VulkanShader.h"
36#include <NDEVR/Buffer.h>
37#include <NDEVR/Pointer.h>
38
39namespace NDEVR
40{
47 class VULKAN_COMPUTE_API VulkanComputePipeline
48 {
49 public:
50 VulkanComputePipeline(const ConstPointer<VulkanComputeDevice>& compute_device);
51 ~VulkanComputePipeline();
52
55 void addStorageBuffer(uint04 binding);
56
60
64 void create(const VulkanShader& shader);
65
70 void bindBuffer(uint04 binding, VkBuffer vk_buffer, VkDeviceSize size);
71
76 void pushConstants(VkCommandBuffer cmd, const void* data, uint04 size) const;
77
83 void dispatch(VkCommandBuffer cmd, uint04 gx, uint04 gy, uint04 gz) const;
84
86 static void computeBarrier(VkCommandBuffer cmd);
87
89 void cleanup();
90
91 private:
92 ConstPointer<VulkanComputeDevice> m_compute_device;
93
95 uint04 m_push_constant_size = 0;
96
97 VkDescriptorSetLayout m_descriptor_set_layout = VK_NULL_HANDLE;
98 VkDescriptorPool m_descriptor_pool = VK_NULL_HANDLE;
99 VkDescriptorSet m_descriptor_set = VK_NULL_HANDLE;
100 VkPipelineLayout m_pipeline_layout = VK_NULL_HANDLE;
101 VkPipeline m_pipeline = VK_NULL_HANDLE;
102 };
103}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition Pointer.hpp:276
void addStorageBuffer(uint04 binding)
Declare an SSBO binding in the descriptor set layout.
void addPushConstantRange(uint04 size)
Declare a push constant range accessible from the compute stage.
void bindBuffer(uint04 binding, VkBuffer vk_buffer, VkDeviceSize size)
Update a descriptor set binding to point to the given buffer.
void pushConstants(VkCommandBuffer cmd, const void *data, uint04 size) const
Record push constants into a command buffer.
static void computeBarrier(VkCommandBuffer cmd)
Insert a compute-to-compute memory barrier (SSBO write → read).
void dispatch(VkCommandBuffer cmd, uint04 gx, uint04 gy, uint04 gz) const
Record a pipeline bind + dispatch into a command buffer.
void create(const VulkanShader &shader)
Create the descriptor set layout, pipeline layout, descriptor pool, descriptor set,...
void cleanup()
Free all Vulkan resources.
A shader program used to render data in Vulkan.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...