[][src]Crate nobs_vkpipes_macro


Proc-Macro crate for nobs-vkpipes

This crate defines the actual proc macros for the pipeline and shader stage code generation


This is a simple example that sets up a compute pipeline.

All the magic happens in vk::pipes::pipeline! macro! We define the pipeline with several comma separated fields, paths are always specified relative to the compilied crate's cargo.toml:

See pipeline and shader for complete list of supported options.

This example deliberately fails to compile
extern crate nobs_vulkanism as vk;

// declare the module that will contain our pipeline
mod make_sequence {
    dset_name[0] = "Dset",
    stage = {
      ty = "comp",
      glsl = "
#version 450
#extension GL_ARB_separate_shader_objects : enable

const uint GROUP_SIZE = 512;

layout(binding = 0) uniform ub {
  uint num_elems;
  uint i_first;
  uint i_step;

layout(binding = 1) buffer b_out {
  uint bout[];

layout(local_size_x = GROUP_SIZE) in;
void main() {
  // copy input values for group in shared memory
  uint gid = gl_GlobalInvocationID.x;

  if (gid < num_elems) {
    bout[gid] = i_first + gid * i_step;

  // The code generation will not create types for e.g. the uniform buffer
  // If we want this, we need to do it our selves
  pub struct ub {
    pub num_elems: u32,
    pub i_first: u32,
    pub i_step: u32,



Generates code for a pipeline


Generates code for a shader stage