Skip to content

Commit d60fef0

Browse files
teoxoyAngelOnFira
andauthored
N31: Encase (#962)
* N31: Encase * add logo * add logo file * fix logo img embed Co-authored-by: Forest Anderson <forestkzanderson@gmail.com>
1 parent 5fb139a commit d60fef0

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

content/news/031/encase.svg

Lines changed: 1 addition & 0 deletions
Loading

content/news/031/index.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,57 @@ improvement allowing systems to be added to schedules without having to call
232232
[Sparsey]: https://github.com/LechintanTudor/sparsey
233233
[@LechintanTudor]: https://github.com/LechintanTudor
234234

235+
### [Encase]
236+
237+
![Encase Logo](./encase.svg)
238+
239+
[Encase] ([docs.rs], [crates.io]) by [@teoxoy] is a new library
240+
that provides a mechanism to lay out data into GPU buffers
241+
according to [WGSL's memory layout] rules.
242+
243+
Features
244+
245+
- supports all WGSL [host-shareable types] + wrapper types
246+
(`&T`, `&mut T`, `Box<T>`, ...)
247+
- extensible by design; most traits can be easily implemented
248+
for user defined types via macros (see [design])
249+
- built in support for data types from a multitude of crates
250+
(enabled via [features])
251+
- covers a wide area of use cases (see [examples])
252+
253+
Example
254+
255+
```rust
256+
use encase::{WgslType, UniformBuffer};
257+
258+
#[derive(WgslType)]
259+
struct AffineTransform2D {
260+
matrix: glam::Mat2,
261+
translate: glam::Vec2
262+
}
263+
264+
let transform = AffineTransform2D {
265+
matrix: glam::Mat2::IDENTITY,
266+
translate: glam::Vec2::ZERO,
267+
};
268+
269+
let mut buffer = UniformBuffer::new(Vec::new());
270+
buffer.write(&transform).unwrap();
271+
let byte_buffer = buffer.into_inner();
272+
273+
// write byte_buffer to GPU
274+
```
275+
276+
[Encase]: https://github.com/teoxoy/encase
277+
[docs.rs]: https://docs.rs/encase/latest/encase
278+
[crates.io]: https://crates.io/crates/encase
279+
[@teoxoy]: https://github.com/teoxoy
280+
[WGSL's memory layout]: https://gpuweb.github.io/gpuweb/wgsl/#memory-layouts
281+
[host-shareable types]: https://gpuweb.github.io/gpuweb/wgsl/#host-shareable-types
282+
[design]: https://docs.rs/encase/latest/encase/#design
283+
[features]: https://docs.rs/crate/encase/latest/features
284+
[examples]: https://docs.rs/encase/latest/encase/#examples
285+
235286
## Popular Workgroup Issues in Github
236287

237288
<!-- Up to 10 links to interesting issues -->

0 commit comments

Comments
 (0)