Skip to content

N31: Encase #962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/news/031/encase.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions content/news/031/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,57 @@ If needed, a section can be split into subsections with a "------" delimiter.

## Library Updates

### [Encase]

![Encase Logo](./encase.svg)

[Encase] ([docs.rs], [crates.io]) by [@teoxoy] is a new library
that provides a mechanism to lay out data into GPU buffers
according to [WGSL's memory layout] rules.

Features

- supports all WGSL [host-shareable types] + wrapper types
(`&T`, `&mut T`, `Box<T>`, ...)
- extensible by design; most traits can be easily implemented
for user defined types via macros (see [design])
- built in support for data types from a multitude of crates
(enabled via [features])
- covers a wide area of use cases (see [examples])

Example

```rust
use encase::{WgslType, UniformBuffer};

#[derive(WgslType)]
struct AffineTransform2D {
matrix: glam::Mat2,
translate: glam::Vec2
}

let transform = AffineTransform2D {
matrix: glam::Mat2::IDENTITY,
translate: glam::Vec2::ZERO,
};

let mut buffer = UniformBuffer::new(Vec::new());
buffer.write(&transform).unwrap();
let byte_buffer = buffer.into_inner();

// write byte_buffer to GPU
```

[Encase]: https://github.com/teoxoy/encase
[docs.rs]: https://docs.rs/encase/latest/encase
[crates.io]: https://crates.io/crates/encase
[@teoxoy]: https://github.com/teoxoy
[WGSL's memory layout]: https://gpuweb.github.io/gpuweb/wgsl/#memory-layouts
[host-shareable types]: https://gpuweb.github.io/gpuweb/wgsl/#host-shareable-types
[design]: https://docs.rs/encase/latest/encase/#design
[features]: https://docs.rs/crate/encase/latest/features
[examples]: https://docs.rs/encase/latest/encase/#examples

## Popular Workgroup Issues in Github

<!-- Up to 10 links to interesting issues -->
Expand Down