Skip to content

Commit

Permalink
Deploying to gh-pages from @ e6e72bb 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 31, 2023
1 parent 487bfa0 commit 6dc49c4
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 17 deletions.
1 change: 1 addition & 0 deletions dist/1.x/buffer-views.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export declare function setStructuredValues(varDef: VariableDefinition, data: an
* ```
* @param varDef A variable definition provided by @link {makeShaderDataDefinitions}
* @returns the size, align, and unalignedSize in bytes of the unsized array element in this type definition.
* If there is no unsized array, size = 0.
*/
export declare function getSizeAndAlignmentOfUnsizedArrayElement(varDef: VariableDefinition | StructDefinition): {
size: number;
Expand Down
13 changes: 10 additions & 3 deletions 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.

13 changes: 10 additions & 3 deletions 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.

3 changes: 2 additions & 1 deletion docs/functions/getSizeAndAlignmentOfUnsizedArrayElement.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ <h5><span class="tsd-kind-parameter">varDef</span>: <a href="../types/StructDefi
<div class="tsd-comment tsd-typography"><p>A variable definition provided by</p>
</div>
<div class="tsd-comment tsd-typography"></div></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">align</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">size</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h4><p>the size, align, and unalignedSize in bytes of the unsized array element in this type definition.</p>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">align</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">size</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h4><p>the size, align, and unalignedSize in bytes of the unsized array element in this type definition.
If there is no unsized array, size = 0.</p>

<ul class="tsd-parameters">
<li class="tsd-parameter">
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 1.2.0 Copyright (c) 2023, Gregg Tavares All Rights Reserved.
@license webgpu-utils 1.2.1 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.2.0",
"version": "1.2.1",
"description": "webgpu utilities",
"main": "dist/1.x/webgpu-utils.module.js",
"module": "dist/1.x/webgpu-utils.module.js",
Expand Down
11 changes: 9 additions & 2 deletions src/buffer-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,16 @@ function getSizeAndAlignmentOfUnsizedArrayElementOfTypeDef(typeDef: TypeDefiniti
const fields = asStructDef.fields;
if (fields) {
const lastField = Object.values(fields).pop()!;
return getSizeAndAlignmentOfUnsizedArrayElementOfTypeDef(lastField.type);
if (lastField.type.size === 0) {
return getSizeAndAlignmentOfUnsizedArrayElementOfTypeDef(lastField.type);
}
}

throw new Error('no unsigned array element');
return {
size: 0,
unalignedSize: 0,
align: 1,
};
}

/**
Expand Down Expand Up @@ -625,6 +631,7 @@ function getSizeAndAlignmentOfUnsizedArrayElementOfTypeDef(typeDef: TypeDefiniti
* ```
* @param varDef A variable definition provided by @link {makeShaderDataDefinitions}
* @returns the size, align, and unalignedSize in bytes of the unsized array element in this type definition.
* If there is no unsized array, size = 0.
*/
export function getSizeAndAlignmentOfUnsizedArrayElement(varDef: VariableDefinition | StructDefinition): {size: number, align: number} {
const asVarDef = varDef as VariableDefinition;
Expand Down

0 comments on commit 6dc49c4

Please sign in to comment.