-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
2,887 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[package] | ||
name = "agpu" | ||
version = "0.1.0" | ||
edition = "2018" | ||
resolver = "2" | ||
description = "Abstract GPU Project" | ||
homepage = "https://github.com/lyricwulf/agpu" | ||
repository = "https://github.com/lyricwulf/agpu" | ||
keywords = ["gpu", "graphics", "compute"] | ||
license = "MIT" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
wgpu = { version = "0.11", features = ["spirv"] } | ||
futures = "0.3" | ||
bytemuck = "1.7" | ||
num-traits = "0.2" | ||
raw-window-handle = "0.3" | ||
tracing = "0.1" | ||
|
||
[dependencies.winit] | ||
version = "0.25" | ||
optional = true | ||
|
||
[dependencies.egui] | ||
optional = true | ||
version = "0.15" | ||
features = ["convert_bytemuck"] | ||
|
||
[dependencies.egui-winit] | ||
version = "0.15" | ||
optional = true | ||
|
||
[features] | ||
profiler = [] | ||
default = ["profiler", "egui", "winit", "egui-winit"] | ||
|
||
[dev-dependencies] | ||
# Used in example | ||
tracing-subscriber = "0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<div> | ||
<h3 align="center"> agpu </h1> | ||
<p align="center"> Abstract GPU Project </p> | ||
</div> | ||
|
||
`agpu` is an abstraction library to the [wgpu](https://github.com/gfx-rs/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: | ||
```rust | ||
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`](https://doc.rust-lang.org/std/ops/trait.Deref.html) is **abused**([?](https://rust-unofficial.github.io/patterns/anti_patterns/deref.html)) 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`](https://github.com/rust-windowing/winit) for windowing (WIP) | ||
- [`egui`](https://github.com/emilk/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. | ||
|
Oops, something went wrong.