@@ -232,6 +232,57 @@ improvement allowing systems to be added to schedules without having to call
232
232
[ Sparsey ] : https://github.com/LechintanTudor/sparsey
233
233
[ @LechintanTudor ] : https://github.com/LechintanTudor
234
234
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
+
235
286
## Popular Workgroup Issues in Github
236
287
237
288
<!-- Up to 10 links to interesting issues -->
0 commit comments