This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,9 @@
/**
* Copies from one buffer to another.
* This is an optimised function that will use `Float64Array` window.
* This means it can copy twice as fast!
* @param sourceBuffer - the array buffer to copy from
* @param destinationBuffer - the array buffer to copy to
* @private
*/
export declare function fastCopy(sourceBuffer: ArrayBuffer, destinationBuffer: ArrayBuffer): void;

View File

@@ -0,0 +1,18 @@
'use strict';
"use strict";
function fastCopy(sourceBuffer, destinationBuffer) {
const lengthDouble = sourceBuffer.byteLength / 8 | 0;
const sourceFloat64View = new Float64Array(sourceBuffer, 0, lengthDouble);
const destinationFloat64View = new Float64Array(destinationBuffer, 0, lengthDouble);
destinationFloat64View.set(sourceFloat64View);
const remainingBytes = sourceBuffer.byteLength - lengthDouble * 8;
if (remainingBytes > 0) {
const sourceUint8View = new Uint8Array(sourceBuffer, lengthDouble * 8, remainingBytes);
const destinationUint8View = new Uint8Array(destinationBuffer, lengthDouble * 8, remainingBytes);
destinationUint8View.set(sourceUint8View);
}
}
exports.fastCopy = fastCopy;
//# sourceMappingURL=fastCopy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fastCopy.js","sources":["../../../../../../src/rendering/renderers/shared/buffer/utils/fastCopy.ts"],"sourcesContent":["/**\n * Copies from one buffer to another.\n * This is an optimised function that will use `Float64Array` window.\n * This means it can copy twice as fast!\n * @param sourceBuffer - the array buffer to copy from\n * @param destinationBuffer - the array buffer to copy to\n * @private\n */\nexport function fastCopy(sourceBuffer: ArrayBuffer, destinationBuffer: ArrayBuffer): void\n{\n const lengthDouble = (sourceBuffer.byteLength / 8) | 0;\n\n const sourceFloat64View = new Float64Array(sourceBuffer, 0, lengthDouble);\n const destinationFloat64View = new Float64Array(destinationBuffer, 0, lengthDouble);\n\n // Use set for faster copying\n destinationFloat64View.set(sourceFloat64View);\n\n // copying over the remaining bytes\n const remainingBytes = sourceBuffer.byteLength - (lengthDouble * 8);\n\n if (remainingBytes > 0)\n {\n const sourceUint8View = new Uint8Array(sourceBuffer, lengthDouble * 8, remainingBytes);\n const destinationUint8View = new Uint8Array(destinationBuffer, lengthDouble * 8, remainingBytes);\n\n // Direct copy for remaining bytes\n destinationUint8View.set(sourceUint8View);\n }\n}\n"],"names":[],"mappings":";;;AAQgB,SAAA,QAAA,CAAS,cAA2B,iBACpD,EAAA;AACI,EAAM,MAAA,YAAA,GAAgB,YAAa,CAAA,UAAA,GAAa,CAAK,GAAA,CAAA,CAAA;AAErD,EAAA,MAAM,iBAAoB,GAAA,IAAI,YAAa,CAAA,YAAA,EAAc,GAAG,YAAY,CAAA,CAAA;AACxE,EAAA,MAAM,sBAAyB,GAAA,IAAI,YAAa,CAAA,iBAAA,EAAmB,GAAG,YAAY,CAAA,CAAA;AAGlF,EAAA,sBAAA,CAAuB,IAAI,iBAAiB,CAAA,CAAA;AAG5C,EAAM,MAAA,cAAA,GAAiB,YAAa,CAAA,UAAA,GAAc,YAAe,GAAA,CAAA,CAAA;AAEjE,EAAA,IAAI,iBAAiB,CACrB,EAAA;AACI,IAAA,MAAM,kBAAkB,IAAI,UAAA,CAAW,YAAc,EAAA,YAAA,GAAe,GAAG,cAAc,CAAA,CAAA;AACrF,IAAA,MAAM,uBAAuB,IAAI,UAAA,CAAW,iBAAmB,EAAA,YAAA,GAAe,GAAG,cAAc,CAAA,CAAA;AAG/F,IAAA,oBAAA,CAAqB,IAAI,eAAe,CAAA,CAAA;AAAA,GAC5C;AACJ;;;;"}

View File

@@ -0,0 +1,16 @@
"use strict";
function fastCopy(sourceBuffer, destinationBuffer) {
const lengthDouble = sourceBuffer.byteLength / 8 | 0;
const sourceFloat64View = new Float64Array(sourceBuffer, 0, lengthDouble);
const destinationFloat64View = new Float64Array(destinationBuffer, 0, lengthDouble);
destinationFloat64View.set(sourceFloat64View);
const remainingBytes = sourceBuffer.byteLength - lengthDouble * 8;
if (remainingBytes > 0) {
const sourceUint8View = new Uint8Array(sourceBuffer, lengthDouble * 8, remainingBytes);
const destinationUint8View = new Uint8Array(destinationBuffer, lengthDouble * 8, remainingBytes);
destinationUint8View.set(sourceUint8View);
}
}
export { fastCopy };
//# sourceMappingURL=fastCopy.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fastCopy.mjs","sources":["../../../../../../src/rendering/renderers/shared/buffer/utils/fastCopy.ts"],"sourcesContent":["/**\n * Copies from one buffer to another.\n * This is an optimised function that will use `Float64Array` window.\n * This means it can copy twice as fast!\n * @param sourceBuffer - the array buffer to copy from\n * @param destinationBuffer - the array buffer to copy to\n * @private\n */\nexport function fastCopy(sourceBuffer: ArrayBuffer, destinationBuffer: ArrayBuffer): void\n{\n const lengthDouble = (sourceBuffer.byteLength / 8) | 0;\n\n const sourceFloat64View = new Float64Array(sourceBuffer, 0, lengthDouble);\n const destinationFloat64View = new Float64Array(destinationBuffer, 0, lengthDouble);\n\n // Use set for faster copying\n destinationFloat64View.set(sourceFloat64View);\n\n // copying over the remaining bytes\n const remainingBytes = sourceBuffer.byteLength - (lengthDouble * 8);\n\n if (remainingBytes > 0)\n {\n const sourceUint8View = new Uint8Array(sourceBuffer, lengthDouble * 8, remainingBytes);\n const destinationUint8View = new Uint8Array(destinationBuffer, lengthDouble * 8, remainingBytes);\n\n // Direct copy for remaining bytes\n destinationUint8View.set(sourceUint8View);\n }\n}\n"],"names":[],"mappings":";AAQgB,SAAA,QAAA,CAAS,cAA2B,iBACpD,EAAA;AACI,EAAM,MAAA,YAAA,GAAgB,YAAa,CAAA,UAAA,GAAa,CAAK,GAAA,CAAA,CAAA;AAErD,EAAA,MAAM,iBAAoB,GAAA,IAAI,YAAa,CAAA,YAAA,EAAc,GAAG,YAAY,CAAA,CAAA;AACxE,EAAA,MAAM,sBAAyB,GAAA,IAAI,YAAa,CAAA,iBAAA,EAAmB,GAAG,YAAY,CAAA,CAAA;AAGlF,EAAA,sBAAA,CAAuB,IAAI,iBAAiB,CAAA,CAAA;AAG5C,EAAM,MAAA,cAAA,GAAiB,YAAa,CAAA,UAAA,GAAc,YAAe,GAAA,CAAA,CAAA;AAEjE,EAAA,IAAI,iBAAiB,CACrB,EAAA;AACI,IAAA,MAAM,kBAAkB,IAAI,UAAA,CAAW,YAAc,EAAA,YAAA,GAAe,GAAG,cAAc,CAAA,CAAA;AACrF,IAAA,MAAM,uBAAuB,IAAI,UAAA,CAAW,iBAAmB,EAAA,YAAA,GAAe,GAAG,cAAc,CAAA,CAAA;AAG/F,IAAA,oBAAA,CAAqB,IAAI,eAAe,CAAA,CAAA;AAAA,GAC5C;AACJ;;;;"}