[][src]Crate geyser

This crate aims to make the use of vulkano quicker and easier when working on a smaller project.

Example

use geyser::Cryo;
 
// Instantiate vulkano
let cryo = Cryo::new();
 
// Create compute pipeline
let pipeline = compute_pipeline!(
    inst, 
    src: "
#version 450
 
layout(set = 0, binding = 0) buffer Data {
    uint data[];
} buf;
 
void main() {
    uint idx = gl_GlobalInvocationID.x;
 
    buf.data[idx] = idx * 12;
}
");
 
// Create buffer
let buf = cryo.buffer_from_data(vec![0; 69]).expect("Failed to create buffer");
 
// Create descriptor set
let set = descriptor_set!([buf], pipeline);
 
// Dispatch
cryo.dispatch([69, 1, 1], pipeline.clone(), set.clone());
 
// Display the results
buf.read().expect("Failed to read from buffer")
    .iter().enumerate().for_each(|(i, x)| println!("Index: {} equals: {}", i, *x));

Re-exports

pub extern crate vulkano;
pub extern crate vulkano_shaders;

Macros

compute_pipeline

Creates an Arc<ComputePipeline>. It takes the code for the shader as literate sting and a Cryo.

descriptor_set

Creates an Arc<PersistantDescriptorSet> from list of buffer and a pipeline

shader

Creates a module containing a shader.

Structs

Cryo

This is a struct that holds an Arc<Instance>, Arc<Device> and an Arc<Queue>. This serves the purpose of making it easier to create everything needed for your GPU calculations. Note that you should try to never call Cryo::new more than once!

Pipeline

Contains an Arc<ComputePipeline>. This is used for sending jobs to the GPU.