Skip to content

Commit

Permalink
Deploying to gh-pages from @ 5d0f20b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 4, 2023
1 parent ad54ee4 commit 36bc2d5
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 23 deletions.
8 changes: 4 additions & 4 deletions dist/0.x/attribute-utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export type ArrayUnion = number | number[] | TypedArray | FullArraySpec;
* Each array can be 1 of 4 things. A native JavaScript array, a TypedArray, a number, a {@link FullArraySpec}
*
* If it's a native array then, if the name of the array is `indices` the data will be converted
* to a `Uint32Array`, otherwise a `Float32Array. Use a TypedArray or a FullArraySpec to choose a different type.
* The FullArraySpec type is only used if it's not already a TypedArray
* to a `Uint32Array`, otherwise a `Float32Array`. Use a TypedArray or a {@link FullArraySpec} to choose a different type.
* The {@link FullArraySpec} `type` is only used if it's not already a TypedArray
*
* If it's a native array or a TypedArray or if `numComponents` in a {@link FullArraySpec} is not
* specified it will be guess. If the name contains 'coord', 'texture' or 'uv' then numComponents will be 2.
* specified it will be guessed. If the name contains 'coord', 'texture' or 'uv' then numComponents will be 2.
* If the name contains 'color' or 'colour' then numComponents will be 4. Otherwise it's 3.
*
* For attribute formats, guesses are made based on type at number of components. The guess is
* For attribute formats, guesses are made based on type and number of components. The guess is
* based on this table where (d) is the default for that type if `normalize` is not specified
*
* | Type | .. | normalize |
Expand Down
6 changes: 5 additions & 1 deletion dist/0.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/0.x/webgpu-utils.js.map

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/0.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/0.x/webgpu-utils.module.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/types/Arrays.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ <h1>Type alias Arrays</h1></div>
<a href="../functions/createBufferLayoutsFromArrays.html" class="tsd-kind-function">createBufferLayoutsFromArrays</a> and <a href="../functions/createBuffersAndAttributesFromArrays.html" class="tsd-kind-function">createBuffersAndAttributesFromArrays</a></p>
<p>Each array can be 1 of 4 things. A native JavaScript array, a TypedArray, a number, a <a href="FullArraySpec.html" class="tsd-kind-type-alias">FullArraySpec</a></p>
<p>If it&#39;s a native array then, if the name of the array is <code>indices</code> the data will be converted
to a <code>Uint32Array</code>, otherwise a `Float32Array. Use a TypedArray or a FullArraySpec to choose a different type.
The FullArraySpec type is only used if it&#39;s not already a TypedArray</p>
<p>If it&#39;s a native array or a TypedArray or if <code>numComponents</code> in a {@link FullArraySpec} is not
specified it will be guess. If the name contains &#39;coord&#39;, &#39;texture&#39; or &#39;uv&#39; then numComponents will be 2.
to a <code>Uint32Array</code>, otherwise a <code>Float32Array</code>. Use a TypedArray or a <a href="FullArraySpec.html" class="tsd-kind-type-alias">FullArraySpec</a> to choose a different type.
The <a href="FullArraySpec.html" class="tsd-kind-type-alias">FullArraySpec</a> <code>type</code> is only used if it&#39;s not already a TypedArray</p>
<p>If it&#39;s a native array or a TypedArray or if <code>numComponents</code> in a <a href="FullArraySpec.html" class="tsd-kind-type-alias">FullArraySpec</a> is not
specified it will be guessed. If the name contains &#39;coord&#39;, &#39;texture&#39; or &#39;uv&#39; then numComponents will be 2.
If the name contains &#39;color&#39; or &#39;colour&#39; then numComponents will be 4. Otherwise it&#39;s 3.</p>
<p>For attribute formats, guesses are made based on type at number of components. The guess is
<p>For attribute formats, guesses are made based on type and number of components. The guess is
based on this table where (d) is the default for that type if <code>normalize</code> is not specified</p>
<table>
<thead>
Expand Down
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 0.14.2 Copyright (c) 2023, Gregg Tavares All Rights Reserved.
@license webgpu-utils 0.14.3 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": "0.14.2",
"version": "0.14.3",
"description": "webgpu utilities",
"main": "dist/0.x/webgpu-utils.module.js",
"module": "dist/0.x/webgpu-utils.module.js",
Expand Down
8 changes: 4 additions & 4 deletions src/attribute-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export type ArrayUnion = number | number[] | TypedArray | FullArraySpec;
* Each array can be 1 of 4 things. A native JavaScript array, a TypedArray, a number, a {@link FullArraySpec}
*
* If it's a native array then, if the name of the array is `indices` the data will be converted
* to a `Uint32Array`, otherwise a `Float32Array. Use a TypedArray or a FullArraySpec to choose a different type.
* The FullArraySpec type is only used if it's not already a TypedArray
* to a `Uint32Array`, otherwise a `Float32Array`. Use a TypedArray or a {@link FullArraySpec} to choose a different type.
* The {@link FullArraySpec} `type` is only used if it's not already a TypedArray
*
* If it's a native array or a TypedArray or if `numComponents` in a {@link FullArraySpec} is not
* specified it will be guess. If the name contains 'coord', 'texture' or 'uv' then numComponents will be 2.
* specified it will be guessed. If the name contains 'coord', 'texture' or 'uv' then numComponents will be 2.
* If the name contains 'color' or 'colour' then numComponents will be 4. Otherwise it's 3.
*
* For attribute formats, guesses are made based on type at number of components. The guess is
* For attribute formats, guesses are made based on type and number of components. The guess is
* based on this table where (d) is the default for that type if `normalize` is not specified
*
* | Type | .. | normalize |
Expand Down
5 changes: 5 additions & 0 deletions src/buffer-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ const b: Record<string, TypeDef> = {
mat3x4h: { numElements: 12, align: 8, size: 24, pad: [3, 1], type: 'u16', View: Uint16Array },
mat4x4f: { numElements: 16, align: 16, size: 64, type: 'f32', View: Float32Array },
mat4x4h: { numElements: 16, align: 8, size: 32, type: 'u16', View: Uint16Array },

// Note: At least as of WGSL V1 you can not create a bool for uniform or storage.
// You can only create one in an internal struct. But, this code generates
// views of structs and it needs to not fail if the struct has a bool
bool: { numElements: 0, align: 1, size: 0, type: 'bool', View: Uint32Array },
};

const typeInfo: Record<string, TypeDef> = {
Expand Down
35 changes: 35 additions & 0 deletions test/tests/buffer-views-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,4 +897,39 @@ describe('buffer-views-tests', () => {

});

// Note: At least as of WGSL V1 you can not create a bool for uniform or storage.
// You can only create one in an internal struct. But, this code generates
// views of structs and it needs to not fail if the struct has a bool
it('generates handles bool', () => {
const shader = `
struct Test {
a: u32,
b: bool,
c: u32,
};
`;
const defs = makeShaderDataDefinitions(shader).structs;
const {views, arrayBuffer} = makeStructuredView(defs.Test);
assertEqual(arrayBuffer.byteLength, 8);
assertEqual(views.a.byteOffset, 0);
assertEqual(views.c.byteOffset, 4);
});

/* wgsl_reflect returns bad data for this case. See comment above though.
it('generates handles bool array', () => {
const shader = `
struct Test {
a: u32,
b: array<bool, 3>,
c: u32,
};
`;
const defs = makeShaderDataDefinitions(shader).structs;
const {views, arrayBuffer} = makeStructuredView(defs.Test);
assertEqual(arrayBuffer.byteLength, 8);
assertEqual(views.a.byteOffset, 0);
assertEqual(views.c.byteOffset, 4);
});
*/

});
1 change: 1 addition & 0 deletions test/tests/data-definition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('data-definition-tests', () => {
foo: u32,
bar: f32,
moo: vec3f,
brp: bool, // bool is not valid in WGSL 1 for storage/uniforms but can appear internally
mrp: i32,
};
@group(4) @binding(1) var<uniform> uni1: VSUniforms;
Expand Down

0 comments on commit 36bc2d5

Please sign in to comment.