Skip to content

[Feature] Storage buffers #172

Open

Description

@vmarcella

Overview

Add storage buffer support for read-write GPU memory used by compute shaders.

Current State

No response

Scope

Goals:

  • Storage buffer creation with read/write usage
  • Binding to compute and render pipelines
  • CPU readback support
  • Dynamic resizing

Non-Goals:

  • Atomic operations
  • Indirect buffers

Proposed API

pub struct StorageBuffer {
  buffer: wgpu::Buffer,
  size: u64,
}

pub struct StorageBufferBuilder {
  size: u64,
  usage: StorageBufferUsage,
  initial_data: Option<Vec<u8>>,
}

#[derive(Clone, Copy)]
pub struct StorageBufferUsage {
  pub read: bool,
  pub write: bool,
  pub cpu_readable: bool,
}

impl StorageBufferBuilder {
  pub fn new(size: u64) -> Self;
  pub fn with_usage(self, usage: StorageBufferUsage) -> Self;
  pub fn with_data<T: bytemuck::Pod>(self, data: &[T]) -> Self;
  pub fn build(self, gpu: &Gpu) -> StorageBuffer;
}

impl StorageBuffer {
  pub fn write<T: bytemuck::Pod>(&self, gpu: &Gpu, data: &[T]);
  pub fn read<T: bytemuck::Pod>(&self, gpu: &Gpu) -> Vec<T>;
  pub fn size(&self) -> u64;
  pub fn as_binding(&self) -> BindingResource;
}

Acceptance Criteria

  • Storage buffer creates with specified size
  • Data writes from CPU
  • Data reads back to CPU
  • Binds to compute pipeline
  • Example with data processing

Affected Crates

lambda-rs, lambda-rs-platform

Notes

  • Read-back requires staging buffer and map_async
  • STORAGE usage flag required

Activity

  1. added
    enhancement
    lambda-rs
    lambda-rs-platform
    compute
    on Feb 5, 2026
  2. added theissue type on Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    computeenhancementlambda-rslambda-rs-platform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions