Camera input and mirror effect now also work in WebGPU. Added the "once" parameter, which renders a single frame. Fixed bugs in gpu-buffer.

This commit is contained in:
Rezmason
2022-08-11 00:08:05 -07:00
parent fc6821f4db
commit 3da3db61f1
10 changed files with 241 additions and 20 deletions

View File

@@ -88,7 +88,7 @@ const getTypeData = (type, attributes, otherStructLayouts) => {
const mult = parseInt(fixedSize ?? "0");
const align = elementTypeData.align;
let stride = elementTypeData.byteOffset;
let stride = elementTypeData.size;
if (attributes.stride != null) {
stride = parseInt(attributes.stride);
}
@@ -214,7 +214,7 @@ const writeField = (allLayouts, field, value, views, byteOffset, warnMissingFiel
} else {
const view = views[field.baseType];
const array = value[Symbol.iterator] == null ? [Number(value)] : value;
view.set(array, (byteOffset + field.byteOffset) / 4);
view.set(array, (byteOffset + (field.byteOffset ?? 0)) / 4);
}
};
@@ -227,7 +227,7 @@ const makeGenerator = (layout, structLayouts) => {
if (destination == null) {
let size = layout.size;
const lastField = layout.fields[layout.fields.length - 1];
if (lastField.isArray && lastField.identifier in object) {
if (lastField.isArray && lastField.identifier in object && !lastField.isFixedSize) {
size += lastField.stride * object[lastField.identifier].length;
}
destination = new ArrayBuffer(size);