mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user