Skip to content

[Feature] Compute pipeline creation #171

@vmarcella

Description

@vmarcella

Overview

Add support for compute pipelines to enable GPU compute operations for
particle simulation, culling, and general-purpose computation.

Current State

No response

Scope

Goals:

  • Compute shader loading and compilation
  • Compute pipeline builder
  • Workgroup size configuration
  • Pipeline caching

Non-Goals:

  • Storage buffers
  • Dispatch commands
  • Async compute queues

Proposed API

// crates/lambda-rs/src/render/compute.rs
pub struct ComputePipeline {
  pipeline: wgpu::ComputePipeline,
  workgroup_size: [u32; 3],
}

pub struct ComputePipelineBuilder {
  shader: Option<ShaderModule>,
  entry_point: String,
  bind_group_layouts: Vec<BindGroupLayout>,
}

impl ComputePipelineBuilder {
  pub fn new() -> Self;
  pub fn with_shader(self, shader: &ShaderModule) -> Self;
  pub fn with_entry_point(self, name: &str) -> Self;
  pub fn with_bind_group_layout(self, layout: &BindGroupLayout) -> Self;
  pub fn build(self, gpu: &Gpu) -> Result<ComputePipeline, Error>;
}

impl ComputePipeline {
  pub fn workgroup_size(&self) -> [u32; 3];
}

Acceptance Criteria

  • Compute shaders compile successfully
  • Pipeline creation with custom bind groups
  • Workgroup size accessible
  • Error handling for invalid shaders
  • Example with simple compute shader

Affected Crates

lambda-rs, lambda-rs-platform

Notes

  • Entry point typically "main" for compute
  • Workgroup size declared in shader, queried from reflection

Metadata

Metadata

Assignees

No one assigned

    Labels

    computeAll things compute relatedenhancementNew feature or requestlambda-rsIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions