agpu

Crates.ioagpu
lib.rsagpu
version0.1.2
sourcesrc
created_at2021-11-16 23:10:08.992358
updated_at2022-03-08 04:37:50.411835
descriptionAbstract GPU Project
homepagehttps://github.com/lyricwulf/agpu
repositoryhttps://github.com/lyricwulf/agpu
max_upload_size
id483036
size273,927
LyricWulf (lyricwulf)

documentation

README

Logo

Abstract GPU Project

The easiest and most ergonomic GPU library
Explore examples ยป


agpu is an abstraction library to the wgpu library, with the goal of providing a GPU framework for both small applications and large engines alike, with minimal boilerplate and maximum readability.

Quick Start

To get started with a program that renders to the screen:

fn main() -> Result<(), agpu::BoxError> {
    let program = agpu::GpuProgram::builder().build()?;

    let example_pipeline = program.gpu.create_pipeline().build();

    program.run_draw(move |mut frame| {
        frame
            .render_pass("Example render pass")
            .with_pipeline(&example_pipeline)
            .begin()
            .draw_triangle();
    })
}

More examples are available in the examples folder.

Goals

  • The easiest GPU library
  • No loss of API functionality for underlying libraries
  • Zero (ideal) runtime cost

Non-goals

  • Managed rendering engine
  • Adhering strictly to WebGPU standard

State

agpu is in a very early stage of development. It strives to be as stable as the underlying wgpu library, but some features will be incomplete or missing.

The current goal is to replicate all wgpu examples using minimal code.

Style

Builder-style API is used:

  • Avoids boilerplate and struct hell
  • Allows user to opt-in to functionality
  • Using sensible defaults, default constructors are one-liners

Deref is abused(?) to add redundant/convenience functions to wgpu types. This is currently preferred to utility traits that add functions to the underlying types to avoid needing to include various traits that are not used directly.

Integrations

Some integrations are provided as default features to this crate:

  • winit for windowing (WIP)
  • egui for GUI (WIP)

You can (not yet!) disable them by opting out of default features, as well as create your own integration using this library.


License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 164

cargo fmt