Skip to content

Commit

Permalink
Deploying to gh-pages from @ 277d506 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Feb 1, 2024
1 parent dc0fcd5 commit 5bd6e39
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change List

### 1.4.0

* Support `atomic`

### 1.3.0

* Add `makeBindGroupLayoutDescriptors`
Expand Down
4 changes: 3 additions & 1 deletion dist/1.x/webgpu-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/1.x/webgpu-utils.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/1.x/webgpu-utils.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/1.x/webgpu-utils.min.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/1.x/webgpu-utils.module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/1.x/webgpu-utils.module.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- this file is auto-generated from README.md. Do not edited directly -->
<!--
@license webgpu-utils 1.3.0 Copyright (c) 2023, Gregg Tavares All Rights Reserved.
@license webgpu-utils 1.4.0 Copyright (c) 2023, Gregg Tavares All Rights Reserved.
Available via the MIT license.
see: http://github.com/greggman/webgpu-utils for details
-->
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgpu-utils",
"version": "1.3.0",
"version": "1.4.0",
"description": "webgpu utilities",
"main": "dist/1.x/webgpu-utils.module.js",
"module": "dist/1.x/webgpu-utils.module.js",
Expand Down
3 changes: 3 additions & 0 deletions src/buffer-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ const b: { readonly [K: string]: TypeDef } = {
const typeInfo: { readonly [K: string]: TypeDef } = {
...b,

'atomic<i32>': b.i32,
'atomic<u32>': b.u32,

'vec2<i32>': b.vec2i,
'vec2<u32>': b.vec2u,
'vec2<f32>': b.vec2f,
Expand Down
43 changes: 43 additions & 0 deletions test/tests/buffer-views-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,49 @@ describe('buffer-views-tests', () => {
test(defs.storages.vsStorage);
});

it('handles atomics', () => {
const shader = `
struct AB {
a: atomic<u32>,
b: array<atomic<u32>, 4>,
};
@group(0) @binding(0) var<storage, read_write> s1: atomic<u32>;
@group(0) @binding(1) var<storage, read_write> s2: array<atomic<u32>, 4>;
@group(0) @binding(2) var<storage, read_write> s3: AB;
@group(0) @binding(0) var<storage, read_write> s4: atomic<i32>;
`;
const defs = makeShaderDataDefinitions(shader);
{
const {views, arrayBuffer} = makeStructuredView(defs.storages.s1);
assertEqual(arrayBuffer.byteLength, 4);
assertEqual(views.length, 1);
assertTruthy(views instanceof Uint32Array);
}
{
const {views, arrayBuffer} = makeStructuredView(defs.storages.s2);
assertEqual(arrayBuffer.byteLength, 16);
assertEqual(views.length, 4);
assertTruthy(views instanceof Uint32Array);
}
{
const {views, arrayBuffer} = makeStructuredView(defs.storages.s3);
assertEqual(arrayBuffer.byteLength, 20);
assertEqual(views.a.length, 1);
assertEqual(views.a.byteOffset, 0);
assertEqual(views.b.length, 4);
assertEqual(views.b.byteOffset, 4);
assertTruthy(views.a instanceof Uint32Array);
assertTruthy(views.b instanceof Uint32Array);
}
{
const {views, arrayBuffer} = makeStructuredView(defs.storages.s4);
assertEqual(arrayBuffer.byteLength, 4);
assertEqual(views.length, 1);
assertTruthy(views instanceof Int32Array);
}
});

it('handles arrays of structs', () => {
const shader = `
struct VertexDesc {
Expand Down

0 comments on commit 5bd6e39

Please sign in to comment.