Last updated: 2026-09-07

Vulkan Runtime

Vulkan Pipeline

All API Sections

Load SPIR-V compute shaders into Vulkan pipelines.

Dispatch helpers use this module to build descriptor layouts, pipeline layouts, and compute pipelines from the compiled shader binaries.

5 exports 1 methods src/vulkan/pipeline.zig

5 exports shown

struct

Pipeline

#
pub const Pipeline = struct

A compute pipeline wrapping a SPIR-V shader module.

src/vulkan/pipeline.zig:12

Methods

1

method

Pipeline.deinit

#
pub fn deinit(self: *Pipeline) void

Destroy the shader module, descriptor layout, pipeline layout, and pipeline.

Parameters
self
Pipeline object to tear down in place.

src/vulkan/pipeline.zig:28

struct

SpecConst

#
pub const SpecConst = struct

Specialization constant entry for compute pipelines.

src/vulkan/pipeline.zig:38

struct

PipelineOptions

#
pub const PipelineOptions = struct

Optional compute-pipeline knobs for subgroup-sensitive shaders.

src/vulkan/pipeline.zig:46

function

createFromSpirv

#
pub fn createFromSpirv( instance: *const Instance, spirv_path: []const u8, binding_count: u32, push_constant_size: u32, spec_constants: []const SpecConst, allocator: std.mem.Allocator, ) !Pipeline

Create a compute pipeline from a SPIR-V file.

Parameters

instance
Active Vulkan instance and logical device.
spirv_path
Filesystem path to the compiled SPIR-V module.
binding_count
Number of storage-buffer bindings expected by the shader.
push_constant_size
Size of the push-constant block in bytes.
spec_constants
Specialization constants applied at pipeline creation time.
allocator
Allocator used for shader bytes and temporary Vulkan structs.

Returns

A fully created compute pipeline and its associated layouts.

src/vulkan/pipeline.zig:63

function

createFromSpirvWithOptions

#
pub fn createFromSpirvWithOptions( instance: *const Instance, spirv_path: []const u8, binding_count: u32, push_constant_size: u32, spec_constants: []const SpecConst, options: PipelineOptions, allocator: std.mem.Allocator, ) !Pipeline

Create a compute pipeline from a SPIR-V file with optional subgroup and push-descriptor controls.

Reads the SPIR-V binary from disk, creates a shader module, builds a descriptor set layout (optionally flagged for push-descriptor recording), a pipeline layout with push constants, and a compute pipeline with specialization constants applied. Subgroup-size and full-subgroup requirements are silently dropped when the device does not support them.

Parameters

instance
Active Vulkan instance providing the logical device and capability info.
spirv_path
Filesystem path to the compiled SPIR-V module.
binding_count
Number of storage-buffer descriptor bindings declared by the shader.
push_constant_size
Size of the push-constant block in bytes; pass 0 for none.
spec_constants
Specialization constants applied at pipeline creation time.
options
Optional subgroup and push-descriptor knobs; use `.{}` for defaults.
allocator
Allocator used for shader bytes and temporary Vulkan structs; freed before return.

Returns

A fully created `Pipeline` with all Vulkan objects owned by the caller.

src/vulkan/pipeline.zig:95