@sanox/sangine-core 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +2 -2
- package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.js +2 -0
- package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.wasm +0 -0
- package/dist/wasm/basis-decode/wasm_basis_decode.a8b7eebd.js +553 -0
- package/dist/wasm/basis-decode/wasm_basis_decode.d.ts +15 -3
- package/dist/wasm/basis-decode/wasm_basis_decode_bg.a8b7eebd.wasm +0 -0
- package/dist/wasm/basis-decode/wasm_basis_decode_bg.wasm.d.ts +7 -1
- package/dist/wasm/decode/{wasm_decode.b6df9f4e.js → wasm_decode.bf116aa6.js} +1 -1
- package/dist/wasm/decode/{wasm_decode_bg.b6df9f4e.wasm → wasm_decode_bg.bf116aa6.wasm} +0 -0
- package/dist/wasm/sangine/{sangine.48c42a65.js → sangine.ecedf539.js} +12 -12
- package/dist/wasm/sangine/{sangine_bg.48c42a65.wasm → sangine_bg.ecedf539.wasm} +0 -0
- package/dist/wasm/sbo-decode/{wasm_sbo_decode.db6e2054.js → wasm_sbo_decode.5c359661.js} +6 -39
- package/dist/wasm/sbo-decode/wasm_sbo_decode_bg.5c359661.wasm +0 -0
- package/dist/wasm-hashes/decode.d.ts +1 -1
- package/dist/wasm-hashes/sangine.d.ts +1 -1
- package/package.json +1 -1
- package/dist/wasm/basis-decode/wasm_basis_decode.6c648416.js +0 -283
- package/dist/wasm/basis-decode/wasm_basis_decode_bg.6c648416.wasm +0 -0
- package/dist/wasm/sbo-decode/wasm_sbo_decode_bg.db6e2054.wasm +0 -0
- package/dist/wasm-hashes/basis-decode.d.ts +0 -2
- package/dist/wasm-hashes/basis-decode.d.ts.map +0 -1
- package/dist/wasm-hashes/sbo-decode.d.ts +0 -2
- package/dist/wasm-hashes/sbo-decode.d.ts.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var f=(n,e,t)=>e in n?g(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>f(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y="sangine-assets-v2";let l=null;async function u(n,e,t){if(typeof caches>"u"){const a=await fetch(t);if(!a.ok)throw new Error(`fetch ${t} failed: ${a.status}`);return a.arrayBuffer()}l??(l=caches.open(y));const s=await l,o=`https://sangine-asset-cache/${n}/${e}`,r=await s.match(o);if(r)return r.arrayBuffer();const i=await fetch(t);if(!i.ok)throw new Error(`fetch ${t} failed: ${i.status}`);return s.put(o,i.clone()).catch(()=>{}),i.arrayBuffer()}const m="/static/sangine/wasm",_="
|
|
1
|
+
"use strict";var g=Object.defineProperty;var f=(n,e,t)=>e in n?g(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>f(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y="sangine-assets-v2";let l=null;async function u(n,e,t){if(typeof caches>"u"){const a=await fetch(t);if(!a.ok)throw new Error(`fetch ${t} failed: ${a.status}`);return a.arrayBuffer()}l??(l=caches.open(y));const s=await l,o=`https://sangine-asset-cache/${n}/${e}`,r=await s.match(o);if(r)return r.arrayBuffer();const i=await fetch(t);if(!i.ok)throw new Error(`fetch ${t} failed: ${i.status}`);return s.put(o,i.clone()).catch(()=>{}),i.arrayBuffer()}const m="/static/sangine/wasm",_="ecedf539";class b{constructor(e,t){d(this,"workers");d(this,"idle");d(this,"queue",[]);this.workers=Array.from({length:t},e),this.idle=[...this.workers]}run(e,t){return new Promise((s,o)=>{const r=this.idle.pop();r?this.dispatch(r,e,t,s,o):this.queue.push({request:e,transfer:t,resolve:s,reject:o})})}dispatch(e,t,s,o,r){const i=h=>{o(h.data),c(),this.release(e)},a=h=>{r(h),c(),this.release(e)},c=()=>{e.removeEventListener("message",i),e.removeEventListener("error",a)};e.addEventListener("message",i,{once:!0}),e.addEventListener("error",a,{once:!0}),e.postMessage(t,s??[])}release(e){const t=this.queue.shift();t?this.dispatch(e,t.request,t.transfer,t.resolve,t.reject):this.idle.push(e)}broadcast(e){for(const t of this.workers)t.postMessage(e)}terminate(){for(const e of this.workers)e.terminate()}}class R{constructor(e){d(this,"wasm",null);d(this,"callbackRegistry",{});d(this,"userActionRegistry",{});d(this,"assetsDownloadingRegistry",{});d(this,"windowCreatedPromiseRegistry",{});d(this,"windowCreatedPromiseResolveRegistry",{});d(this,"_inited",!1);d(this,"decodePool");d(this,"_readyPromise");d(this,"_resolveReady");d(this,"_rejectReady");this.config=e,this._readyPromise=new Promise((t,s)=>{this._resolveReady=t,this._rejectReady=s}),this.config=e}async init(){if(!(typeof window>"u")){if(this._inited)return this._readyPromise;try{const t=await import(new URL(`${m}/sangine/sangine.${_}.js`,window.location.origin).toString());await t.default(),this.wasm=t,this._inited=!0;const s=Math.min(this.config.numWorkers??(navigator.hardwareConcurrency||2)-1,2);this.decodePool=new b(()=>this.config.createDecodeWorker(),Math.max(s,1)),this.wasm.register_asset_decoder(this.decodeAsset.bind(this)),this.wasm.register_event_listener(this.handleSangineEvent.bind(this)),this._resolveReady()}catch(e){throw this._rejectReady(e),e}return this._readyPromise}}ready(){return this._readyPromise}get inited(){return this._inited}getWasm(){if(!this.wasm)throw new Error("RendererService not initialized");return this.wasm}handleActionChanged(e,t){this.userActionRegistry[e]=t;for(const s of this.callbackRegistry[e].actionChanged)s(t)}handleMeasurementCreated(e,t){for(const s of this.callbackRegistry[e].measurementCreated)s(t)}handleRouteUpdated(e,t){for(const s of this.callbackRegistry[e].routeUpdated)s(t)}handleAssetsDownloading(e,t){this.assetsDownloadingRegistry[e]=t;for(const s of this.callbackRegistry[e].assetsDownloading)s(t)}handleUserInteractionStarted(e){for(const t of this.callbackRegistry[e].userInteractionStarted)t()}handleSangineEvent(e,t){t==="ready"?this.windowCreatedPromiseResolveRegistry[e]():t==="userInteractionStarted"?this.handleUserInteractionStarted(e):"actionChanged"in t?this.handleActionChanged(e,t.actionChanged.action):"measurementCreated"in t?this.handleMeasurementCreated(e,t.measurementCreated.measurement):"routeUnderConstructionUpdated"in t?this.handleRouteUpdated(e,t.routeUnderConstructionUpdated.route):"assetsDownloading"in t&&this.handleAssetsDownloading(e,t.assetsDownloading.downloading)}createWindow(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");let o;const r=new Promise(a=>{o=a}),i=this.wasm.create_window(e,t,s);return this.windowCreatedPromiseResolveRegistry[i]=o,this.callbackRegistry[i]={actionChanged:[],routeUpdated:[],measurementCreated:[],assetsDownloading:[],userInteractionStarted:[]},this.userActionRegistry[i]="watching",this.windowCreatedPromiseRegistry[i]=r,i}getAssetsDownloading(e){return this.assetsDownloadingRegistry[e]||!1}readUserAction(e){return this.userActionRegistry[e]}windowReady(e){return this.windowCreatedPromiseRegistry[e]}registerCallback(e,t,s){this.callbackRegistry[e][t].push(s)}setWindowAction(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_window_action(e,t)}destroyWindow(e){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.destroy_window(e),delete this.callbackRegistry[e],delete this.userActionRegistry[e]}setRouteHighlight(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_highlight(e,t,s)}setRouteVisible(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_visible(e,t,s)}animateToRoute(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to_route(e,t)}setSunProperties(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_sun_properties(e,t)}setAmbientLighting(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_ambient_lighting(e,t)}setLightingMode(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_lighting_mode(e,t)}setNorthCorrection(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_north_correction(e,t)}setGpuMemoryBudgetMb(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_gpu_memory_budget_mb(e,t)}setRenderQuality(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_render_quality(e,t)}readCameraPos(e){if(!this.wasm)throw new Error("WASM not initialized");return this.wasm.read_camera_pos(e)}animateTo(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to(e,t)}setScale(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_window_scale(e,t)}async decodeAsset(e){if(!this.decodePool)throw new Error("Renderer not initialized");if("texture-file"in e){const{pk:r,url:i,encoding:a,format:c}=e["texture-file"],h=await u("texture",r,i);return a==="ktx2"?this.decodePool.run({kind:"texture-basis",bytes:h,format:c},[h]):this.decodePool.run({kind:"texture-image",bytes:h},[h])}const{pk:t,url:s}=e["model-part-mesh"],o=await u("mesh",t,s);return this.decodePool.run({kind:"model-sbo",bytes:o},[o])}destroy(){var e;(e=this.decodePool)==null||e.terminate()}}const p="bf116aa6",A=0;function M(n){let e=!1,t=null;async function s(){if(e)return;const r=await import(new URL(`${m}/decode/wasm_decode.${p}.js`,n.location.origin).href);await r.default(),await r.init_basis(),t=r,e=!0}n.onmessage=async o=>{const r=o.data;try{if(r.kind==="texture-basis"){await s();const i=new Uint8Array(r.bytes),a=t.transcode_basis(i,r.format);n.postMessage({success:!0,width:a.width,height:a.height,data:a.data.buffer,format:a.format},[a.data.buffer])}else if(r.kind==="texture-image"){const i=new Blob([r.bytes]),a=await createImageBitmap(i),c=new OffscreenCanvas(a.width,a.height),h=c.getContext("2d");if(h===null)throw new Error("Couldnt create canvas");h.drawImage(a,0,0);const w=h.getImageData(0,0,c.width,c.height);n.postMessage({success:!0,width:c.width,height:c.height,data:w.data.buffer,format:A},[w.data.buffer])}else if(r.kind==="model-sbo"){await s();const i=new Uint8Array(r.bytes),a=t.decode_sbo(i);n.postMessage({success:!0,data:a.buffer},[a.buffer])}else{const i=r;throw new Error(`unknown task kind: ${i.kind}`)}}catch(i){n.postMessage({success:!1,error:i.message})}}}exports.RendererService=R;exports.registerDecodeWorker=M;
|
package/dist/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ async function m(n, e, t) {
|
|
|
17
17
|
return s.put(o, i.clone()).catch(() => {
|
|
18
18
|
}), i.arrayBuffer();
|
|
19
19
|
}
|
|
20
|
-
const u = "/static/sangine/wasm", _ = "
|
|
20
|
+
const u = "/static/sangine/wasm", _ = "ecedf539";
|
|
21
21
|
class b {
|
|
22
22
|
constructor(e, t) {
|
|
23
23
|
d(this, "workers");
|
|
@@ -226,7 +226,7 @@ class M {
|
|
|
226
226
|
(e = this.decodePool) == null || e.terminate();
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
const R = "
|
|
229
|
+
const R = "bf116aa6", p = 0;
|
|
230
230
|
function E(n) {
|
|
231
231
|
let e = !1, t = null;
|
|
232
232
|
async function s() {
|
package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
async function Module(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url)}var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){}function initRuntime(){runtimeInitialized=true}function postRun(){}function abort(what){what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("basisu_transcoder.wasm")}return new URL("basisu_transcoder.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>true;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};{if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"]}var _bt_get_version,_bt_enable_debug_printf,_bt_init,_bt_alloc,_bt_free,_bt_basis_tex_format_is_xuastc_ldr,_bt_basis_tex_format_is_astc_ldr,_bt_basis_tex_format_get_block_width,_bt_basis_tex_format_get_block_height,_bt_basis_tex_format_is_hdr,_bt_basis_tex_format_is_ldr,_bt_basis_get_bytes_per_block_or_pixel,_bt_basis_transcoder_format_has_alpha,_bt_basis_transcoder_format_is_hdr,_bt_basis_transcoder_format_is_ldr,_bt_basis_transcoder_texture_format_is_astc,_bt_basis_transcoder_format_is_uncompressed,_bt_basis_get_uncompressed_bytes_per_pixel,_bt_basis_get_block_width,_bt_basis_get_block_height,_bt_basis_get_transcoder_texture_format_from_basis_tex_format,_bt_basis_is_format_supported,_bt_basis_compute_transcoded_image_size_in_bytes,_bt_ktx2_open,_bt_ktx2_close,_bt_ktx2_get_width,_bt_ktx2_get_height,_bt_ktx2_get_levels,_bt_ktx2_get_faces,_bt_ktx2_get_layers,_bt_ktx2_get_basis_tex_format,_bt_ktx2_is_etc1s,_bt_ktx2_is_uastc_ldr_4x4,_bt_ktx2_is_hdr,_bt_ktx2_is_hdr_4x4,_bt_ktx2_is_hdr_6x6,_bt_ktx2_is_ldr,_bt_ktx2_is_astc_ldr,_bt_ktx2_is_xuastc_ldr,_bt_ktx2_get_block_width,_bt_ktx2_get_block_height,_bt_ktx2_has_alpha,_bt_ktx2_get_dfd_color_model,_bt_ktx2_get_dfd_color_primaries,_bt_ktx2_get_dfd_transfer_func,_bt_ktx2_is_srgb,_bt_ktx2_get_dfd_flags,_bt_ktx2_get_dfd_total_samples,_bt_ktx2_get_dfd_channel_id0,_bt_ktx2_get_dfd_channel_id1,_bt_ktx2_is_video,_bt_ktx2_get_ldr_hdr_upconversion_nit_multiplier,_bt_ktx2_get_level_orig_width,_bt_ktx2_get_level_orig_height,_bt_ktx2_get_level_actual_width,_bt_ktx2_get_level_actual_height,_bt_ktx2_get_level_num_blocks_x,_bt_ktx2_get_level_num_blocks_y,_bt_ktx2_get_level_total_blocks,_bt_ktx2_get_level_alpha_flag,_bt_ktx2_get_level_iframe_flag,_bt_ktx2_start_transcoding,_bt_ktx2_create_transcode_state,_bt_ktx2_destroy_transcode_state,_bt_ktx2_transcode_image_level,__emscripten_timeout,memory,__indirect_function_table,wasmMemory;function assignWasmExports(wasmExports){_bt_get_version=Module["_bt_get_version"]=wasmExports["i"];_bt_enable_debug_printf=Module["_bt_enable_debug_printf"]=wasmExports["j"];_bt_init=Module["_bt_init"]=wasmExports["k"];_bt_alloc=Module["_bt_alloc"]=wasmExports["l"];_bt_free=Module["_bt_free"]=wasmExports["m"];_bt_basis_tex_format_is_xuastc_ldr=Module["_bt_basis_tex_format_is_xuastc_ldr"]=wasmExports["n"];_bt_basis_tex_format_is_astc_ldr=Module["_bt_basis_tex_format_is_astc_ldr"]=wasmExports["o"];_bt_basis_tex_format_get_block_width=Module["_bt_basis_tex_format_get_block_width"]=wasmExports["p"];_bt_basis_tex_format_get_block_height=Module["_bt_basis_tex_format_get_block_height"]=wasmExports["q"];_bt_basis_tex_format_is_hdr=Module["_bt_basis_tex_format_is_hdr"]=wasmExports["r"];_bt_basis_tex_format_is_ldr=Module["_bt_basis_tex_format_is_ldr"]=wasmExports["s"];_bt_basis_get_bytes_per_block_or_pixel=Module["_bt_basis_get_bytes_per_block_or_pixel"]=wasmExports["t"];_bt_basis_transcoder_format_has_alpha=Module["_bt_basis_transcoder_format_has_alpha"]=wasmExports["u"];_bt_basis_transcoder_format_is_hdr=Module["_bt_basis_transcoder_format_is_hdr"]=wasmExports["v"];_bt_basis_transcoder_format_is_ldr=Module["_bt_basis_transcoder_format_is_ldr"]=wasmExports["w"];_bt_basis_transcoder_texture_format_is_astc=Module["_bt_basis_transcoder_texture_format_is_astc"]=wasmExports["x"];_bt_basis_transcoder_format_is_uncompressed=Module["_bt_basis_transcoder_format_is_uncompressed"]=wasmExports["y"];_bt_basis_get_uncompressed_bytes_per_pixel=Module["_bt_basis_get_uncompressed_bytes_per_pixel"]=wasmExports["z"];_bt_basis_get_block_width=Module["_bt_basis_get_block_width"]=wasmExports["A"];_bt_basis_get_block_height=Module["_bt_basis_get_block_height"]=wasmExports["B"];_bt_basis_get_transcoder_texture_format_from_basis_tex_format=Module["_bt_basis_get_transcoder_texture_format_from_basis_tex_format"]=wasmExports["C"];_bt_basis_is_format_supported=Module["_bt_basis_is_format_supported"]=wasmExports["D"];_bt_basis_compute_transcoded_image_size_in_bytes=Module["_bt_basis_compute_transcoded_image_size_in_bytes"]=wasmExports["E"];_bt_ktx2_open=Module["_bt_ktx2_open"]=wasmExports["F"];_bt_ktx2_close=Module["_bt_ktx2_close"]=wasmExports["G"];_bt_ktx2_get_width=Module["_bt_ktx2_get_width"]=wasmExports["H"];_bt_ktx2_get_height=Module["_bt_ktx2_get_height"]=wasmExports["I"];_bt_ktx2_get_levels=Module["_bt_ktx2_get_levels"]=wasmExports["J"];_bt_ktx2_get_faces=Module["_bt_ktx2_get_faces"]=wasmExports["K"];_bt_ktx2_get_layers=Module["_bt_ktx2_get_layers"]=wasmExports["L"];_bt_ktx2_get_basis_tex_format=Module["_bt_ktx2_get_basis_tex_format"]=wasmExports["M"];_bt_ktx2_is_etc1s=Module["_bt_ktx2_is_etc1s"]=wasmExports["N"];_bt_ktx2_is_uastc_ldr_4x4=Module["_bt_ktx2_is_uastc_ldr_4x4"]=wasmExports["O"];_bt_ktx2_is_hdr=Module["_bt_ktx2_is_hdr"]=wasmExports["P"];_bt_ktx2_is_hdr_4x4=Module["_bt_ktx2_is_hdr_4x4"]=wasmExports["Q"];_bt_ktx2_is_hdr_6x6=Module["_bt_ktx2_is_hdr_6x6"]=wasmExports["R"];_bt_ktx2_is_ldr=Module["_bt_ktx2_is_ldr"]=wasmExports["S"];_bt_ktx2_is_astc_ldr=Module["_bt_ktx2_is_astc_ldr"]=wasmExports["T"];_bt_ktx2_is_xuastc_ldr=Module["_bt_ktx2_is_xuastc_ldr"]=wasmExports["U"];_bt_ktx2_get_block_width=Module["_bt_ktx2_get_block_width"]=wasmExports["V"];_bt_ktx2_get_block_height=Module["_bt_ktx2_get_block_height"]=wasmExports["W"];_bt_ktx2_has_alpha=Module["_bt_ktx2_has_alpha"]=wasmExports["X"];_bt_ktx2_get_dfd_color_model=Module["_bt_ktx2_get_dfd_color_model"]=wasmExports["Y"];_bt_ktx2_get_dfd_color_primaries=Module["_bt_ktx2_get_dfd_color_primaries"]=wasmExports["Z"];_bt_ktx2_get_dfd_transfer_func=Module["_bt_ktx2_get_dfd_transfer_func"]=wasmExports["_"];_bt_ktx2_is_srgb=Module["_bt_ktx2_is_srgb"]=wasmExports["$"];_bt_ktx2_get_dfd_flags=Module["_bt_ktx2_get_dfd_flags"]=wasmExports["aa"];_bt_ktx2_get_dfd_total_samples=Module["_bt_ktx2_get_dfd_total_samples"]=wasmExports["ba"];_bt_ktx2_get_dfd_channel_id0=Module["_bt_ktx2_get_dfd_channel_id0"]=wasmExports["ca"];_bt_ktx2_get_dfd_channel_id1=Module["_bt_ktx2_get_dfd_channel_id1"]=wasmExports["da"];_bt_ktx2_is_video=Module["_bt_ktx2_is_video"]=wasmExports["ea"];_bt_ktx2_get_ldr_hdr_upconversion_nit_multiplier=Module["_bt_ktx2_get_ldr_hdr_upconversion_nit_multiplier"]=wasmExports["fa"];_bt_ktx2_get_level_orig_width=Module["_bt_ktx2_get_level_orig_width"]=wasmExports["ga"];_bt_ktx2_get_level_orig_height=Module["_bt_ktx2_get_level_orig_height"]=wasmExports["ha"];_bt_ktx2_get_level_actual_width=Module["_bt_ktx2_get_level_actual_width"]=wasmExports["ia"];_bt_ktx2_get_level_actual_height=Module["_bt_ktx2_get_level_actual_height"]=wasmExports["ja"];_bt_ktx2_get_level_num_blocks_x=Module["_bt_ktx2_get_level_num_blocks_x"]=wasmExports["ka"];_bt_ktx2_get_level_num_blocks_y=Module["_bt_ktx2_get_level_num_blocks_y"]=wasmExports["la"];_bt_ktx2_get_level_total_blocks=Module["_bt_ktx2_get_level_total_blocks"]=wasmExports["ma"];_bt_ktx2_get_level_alpha_flag=Module["_bt_ktx2_get_level_alpha_flag"]=wasmExports["na"];_bt_ktx2_get_level_iframe_flag=Module["_bt_ktx2_get_level_iframe_flag"]=wasmExports["oa"];_bt_ktx2_start_transcoding=Module["_bt_ktx2_start_transcoding"]=wasmExports["pa"];_bt_ktx2_create_transcode_state=Module["_bt_ktx2_create_transcode_state"]=wasmExports["qa"];_bt_ktx2_destroy_transcode_state=Module["_bt_ktx2_destroy_transcode_state"]=wasmExports["ra"];_bt_ktx2_transcode_image_level=Module["_bt_ktx2_transcode_image_level"]=wasmExports["sa"];__emscripten_timeout=wasmExports["ta"];memory=wasmMemory=wasmExports["h"];__indirect_function_table=wasmExports["__indirect_function_table"]}var wasmImports={a:___assert_fail,e:__abort_js,c:__emscripten_runtime_keepalive_clear,d:__setitimer_js,f:_emscripten_resize_heap,g:_fd_write,b:_proc_exit};function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);postRun()}{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
2
|
+
;return moduleRtn}export default Module;
|
package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.wasm
ADDED
|
Binary file
|
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
/* @ts-self-types="./wasm_basis_decode.d.ts" */
|
|
2
|
+
import * as import1 from "./snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.js"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Initialize the embedded basisu transcoder WASM.
|
|
7
|
+
* Must be awaited once after the outer WASM module's `default()` init.
|
|
8
|
+
* @returns {Promise<any>}
|
|
9
|
+
*/
|
|
10
|
+
export function init_basis() {
|
|
11
|
+
const ret = wasm.init_basis();
|
|
12
|
+
return ret;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Transcode a KTX2/basis file to a GPU-compressed (or RGBA32) format.
|
|
17
|
+
*
|
|
18
|
+
* `format`: 0=RGBA32, 1=ETC2_RGBA8, 2=ASTC_4×4, 3=BC7
|
|
19
|
+
*
|
|
20
|
+
* Returns `{ data: Uint8Array, width: u32, height: u32, format: u32 }`.
|
|
21
|
+
* @param {Uint8Array} data
|
|
22
|
+
* @param {number} format
|
|
23
|
+
* @returns {object}
|
|
24
|
+
*/
|
|
25
|
+
export function transcode_basis(data, format) {
|
|
26
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
27
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28
|
+
const ret = wasm.transcode_basis(ptr0, len0, format);
|
|
29
|
+
if (ret[2]) {
|
|
30
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
31
|
+
}
|
|
32
|
+
return takeFromExternrefTable0(ret[0]);
|
|
33
|
+
}
|
|
34
|
+
function __wbg_get_imports() {
|
|
35
|
+
const import0 = {
|
|
36
|
+
__proto__: null,
|
|
37
|
+
__wbg_HEAPU8_153c54682533edcc: function(arg0) {
|
|
38
|
+
const ret = arg0.HEAPU8;
|
|
39
|
+
return ret;
|
|
40
|
+
},
|
|
41
|
+
__wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
|
|
42
|
+
const ret = debugString(arg1);
|
|
43
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
44
|
+
const len1 = WASM_VECTOR_LEN;
|
|
45
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
46
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
47
|
+
},
|
|
48
|
+
__wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
|
|
49
|
+
const ret = typeof(arg0) === 'function';
|
|
50
|
+
return ret;
|
|
51
|
+
},
|
|
52
|
+
__wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
|
|
53
|
+
const ret = arg0 === undefined;
|
|
54
|
+
return ret;
|
|
55
|
+
},
|
|
56
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
|
57
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
58
|
+
},
|
|
59
|
+
__wbg__bt_alloc_996c13d90dbf94e7: function(arg0, arg1) {
|
|
60
|
+
const ret = arg0._bt_alloc(BigInt.asUintN(64, arg1));
|
|
61
|
+
return ret;
|
|
62
|
+
},
|
|
63
|
+
__wbg__bt_basis_compute_transcoded_image_size_in_bytes_b7f2fe186a6e8349: function(arg0, arg1, arg2, arg3) {
|
|
64
|
+
const ret = arg0._bt_basis_compute_transcoded_image_size_in_bytes(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
|
|
65
|
+
return ret;
|
|
66
|
+
},
|
|
67
|
+
__wbg__bt_basis_get_bytes_per_block_or_pixel_55cb380affe87d99: function(arg0, arg1) {
|
|
68
|
+
const ret = arg0._bt_basis_get_bytes_per_block_or_pixel(arg1 >>> 0);
|
|
69
|
+
return ret;
|
|
70
|
+
},
|
|
71
|
+
__wbg__bt_free_4a75f61f6d796adf: function(arg0, arg1) {
|
|
72
|
+
arg0._bt_free(BigInt.asUintN(64, arg1));
|
|
73
|
+
},
|
|
74
|
+
__wbg__bt_init_bf4d6cc29d0f4ba7: function(arg0) {
|
|
75
|
+
arg0._bt_init();
|
|
76
|
+
},
|
|
77
|
+
__wbg__bt_ktx2_close_5f0389f38446b6d9: function(arg0, arg1) {
|
|
78
|
+
arg0._bt_ktx2_close(BigInt.asUintN(64, arg1));
|
|
79
|
+
},
|
|
80
|
+
__wbg__bt_ktx2_get_height_9e89d57dd5609461: function(arg0, arg1) {
|
|
81
|
+
const ret = arg0._bt_ktx2_get_height(BigInt.asUintN(64, arg1));
|
|
82
|
+
return ret;
|
|
83
|
+
},
|
|
84
|
+
__wbg__bt_ktx2_get_width_95780eb40045edd9: function(arg0, arg1) {
|
|
85
|
+
const ret = arg0._bt_ktx2_get_width(BigInt.asUintN(64, arg1));
|
|
86
|
+
return ret;
|
|
87
|
+
},
|
|
88
|
+
__wbg__bt_ktx2_open_4921a842ef17b5bd: function(arg0, arg1, arg2) {
|
|
89
|
+
const ret = arg0._bt_ktx2_open(BigInt.asUintN(64, arg1), arg2 >>> 0);
|
|
90
|
+
return ret;
|
|
91
|
+
},
|
|
92
|
+
__wbg__bt_ktx2_start_transcoding_1299f54a65ef35ca: function(arg0, arg1) {
|
|
93
|
+
const ret = arg0._bt_ktx2_start_transcoding(BigInt.asUintN(64, arg1));
|
|
94
|
+
return ret;
|
|
95
|
+
},
|
|
96
|
+
__wbg__bt_ktx2_transcode_image_level_5b2d35b01da6e6cc: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) {
|
|
97
|
+
const ret = arg0._bt_ktx2_transcode_image_level(BigInt.asUintN(64, arg1), arg2 >>> 0, arg3 >>> 0, arg4 >>> 0, BigInt.asUintN(64, arg5), arg6 >>> 0, arg7 >>> 0, arg8 >>> 0, arg9 >>> 0, arg10 >>> 0, arg11, arg12, BigInt.asUintN(64, arg13));
|
|
98
|
+
return ret;
|
|
99
|
+
},
|
|
100
|
+
__wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
|
|
101
|
+
arg0._wbg_cb_unref();
|
|
102
|
+
},
|
|
103
|
+
__wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
|
|
104
|
+
const ret = arg0.call(arg1, arg2);
|
|
105
|
+
return ret;
|
|
106
|
+
}, arguments); },
|
|
107
|
+
__wbg_length_9f1775224cf1d815: function(arg0) {
|
|
108
|
+
const ret = arg0.length;
|
|
109
|
+
return ret;
|
|
110
|
+
},
|
|
111
|
+
__wbg_new_aa8d0fa9762c29bd: function() {
|
|
112
|
+
const ret = new Object();
|
|
113
|
+
return ret;
|
|
114
|
+
},
|
|
115
|
+
__wbg_new_from_slice_b5ea43e23f6008c0: function(arg0, arg1) {
|
|
116
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
117
|
+
return ret;
|
|
118
|
+
},
|
|
119
|
+
__wbg_new_typed_323f37fd55ab048d: function(arg0, arg1) {
|
|
120
|
+
try {
|
|
121
|
+
var state0 = {a: arg0, b: arg1};
|
|
122
|
+
var cb0 = (arg0, arg1) => {
|
|
123
|
+
const a = state0.a;
|
|
124
|
+
state0.a = 0;
|
|
125
|
+
try {
|
|
126
|
+
return wasm_bindgen__convert__closures_____invoke__h16cb8cb7feea2290(a, state0.b, arg0, arg1);
|
|
127
|
+
} finally {
|
|
128
|
+
state0.a = a;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const ret = new Promise(cb0);
|
|
132
|
+
return ret;
|
|
133
|
+
} finally {
|
|
134
|
+
state0.a = 0;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
__wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
|
|
138
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
139
|
+
},
|
|
140
|
+
__wbg_queueMicrotask_5d15a957e6aa920e: function(arg0) {
|
|
141
|
+
queueMicrotask(arg0);
|
|
142
|
+
},
|
|
143
|
+
__wbg_queueMicrotask_f8819e5ffc402f36: function(arg0) {
|
|
144
|
+
const ret = arg0.queueMicrotask;
|
|
145
|
+
return ret;
|
|
146
|
+
},
|
|
147
|
+
__wbg_resolve_e6c466bc1052f16c: function(arg0) {
|
|
148
|
+
const ret = Promise.resolve(arg0);
|
|
149
|
+
return ret;
|
|
150
|
+
},
|
|
151
|
+
__wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
|
|
152
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
153
|
+
return ret;
|
|
154
|
+
}, arguments); },
|
|
155
|
+
__wbg_set_d8f1efe557b9e7e1: function(arg0, arg1, arg2) {
|
|
156
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
157
|
+
},
|
|
158
|
+
__wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
|
|
159
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
160
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
161
|
+
},
|
|
162
|
+
__wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
|
|
163
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
164
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
165
|
+
},
|
|
166
|
+
__wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
|
|
167
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
168
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
169
|
+
},
|
|
170
|
+
__wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
|
|
171
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
172
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
173
|
+
},
|
|
174
|
+
__wbg_subarray_f8ca46a25b1f5e0d: function(arg0, arg1, arg2) {
|
|
175
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
176
|
+
return ret;
|
|
177
|
+
},
|
|
178
|
+
__wbg_then_792e0c862b060889: function(arg0, arg1, arg2) {
|
|
179
|
+
const ret = arg0.then(arg1, arg2);
|
|
180
|
+
return ret;
|
|
181
|
+
},
|
|
182
|
+
__wbg_then_8e16ee11f05e4827: function(arg0, arg1) {
|
|
183
|
+
const ret = arg0.then(arg1);
|
|
184
|
+
return ret;
|
|
185
|
+
},
|
|
186
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
187
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 32, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
188
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1a884335adcc7c22);
|
|
189
|
+
return ret;
|
|
190
|
+
},
|
|
191
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
192
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 42, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
193
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfcaf9f68983c0e6f);
|
|
194
|
+
return ret;
|
|
195
|
+
},
|
|
196
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
197
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
198
|
+
const ret = arg0;
|
|
199
|
+
return ret;
|
|
200
|
+
},
|
|
201
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
202
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
203
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
204
|
+
return ret;
|
|
205
|
+
},
|
|
206
|
+
__wbindgen_init_externref_table: function() {
|
|
207
|
+
const table = wasm.__wbindgen_externrefs;
|
|
208
|
+
const offset = table.grow(4);
|
|
209
|
+
table.set(0, undefined);
|
|
210
|
+
table.set(offset + 0, undefined);
|
|
211
|
+
table.set(offset + 1, null);
|
|
212
|
+
table.set(offset + 2, true);
|
|
213
|
+
table.set(offset + 3, false);
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
__proto__: null,
|
|
218
|
+
"./wasm_basis_decode_bg.js": import0,
|
|
219
|
+
"./snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.js": import1,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function wasm_bindgen__convert__closures_____invoke__h1a884335adcc7c22(arg0, arg1, arg2) {
|
|
224
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h1a884335adcc7c22(arg0, arg1, arg2);
|
|
225
|
+
if (ret[1]) {
|
|
226
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function wasm_bindgen__convert__closures_____invoke__hfcaf9f68983c0e6f(arg0, arg1, arg2) {
|
|
231
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfcaf9f68983c0e6f(arg0, arg1, arg2);
|
|
232
|
+
if (ret[1]) {
|
|
233
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function wasm_bindgen__convert__closures_____invoke__h16cb8cb7feea2290(arg0, arg1, arg2, arg3) {
|
|
238
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h16cb8cb7feea2290(arg0, arg1, arg2, arg3);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function addToExternrefTable0(obj) {
|
|
242
|
+
const idx = wasm.__externref_table_alloc();
|
|
243
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
244
|
+
return idx;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
248
|
+
? { register: () => {}, unregister: () => {} }
|
|
249
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
250
|
+
|
|
251
|
+
function debugString(val) {
|
|
252
|
+
// primitive types
|
|
253
|
+
const type = typeof val;
|
|
254
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
255
|
+
return `${val}`;
|
|
256
|
+
}
|
|
257
|
+
if (type == 'string') {
|
|
258
|
+
return `"${val}"`;
|
|
259
|
+
}
|
|
260
|
+
if (type == 'symbol') {
|
|
261
|
+
const description = val.description;
|
|
262
|
+
if (description == null) {
|
|
263
|
+
return 'Symbol';
|
|
264
|
+
} else {
|
|
265
|
+
return `Symbol(${description})`;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (type == 'function') {
|
|
269
|
+
const name = val.name;
|
|
270
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
271
|
+
return `Function(${name})`;
|
|
272
|
+
} else {
|
|
273
|
+
return 'Function';
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// objects
|
|
277
|
+
if (Array.isArray(val)) {
|
|
278
|
+
const length = val.length;
|
|
279
|
+
let debug = '[';
|
|
280
|
+
if (length > 0) {
|
|
281
|
+
debug += debugString(val[0]);
|
|
282
|
+
}
|
|
283
|
+
for(let i = 1; i < length; i++) {
|
|
284
|
+
debug += ', ' + debugString(val[i]);
|
|
285
|
+
}
|
|
286
|
+
debug += ']';
|
|
287
|
+
return debug;
|
|
288
|
+
}
|
|
289
|
+
// Test for built-in
|
|
290
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
291
|
+
let className;
|
|
292
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
293
|
+
className = builtInMatches[1];
|
|
294
|
+
} else {
|
|
295
|
+
// Failed to match the standard '[object ClassName]'
|
|
296
|
+
return toString.call(val);
|
|
297
|
+
}
|
|
298
|
+
if (className == 'Object') {
|
|
299
|
+
// we're a user defined class or Object
|
|
300
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
301
|
+
// easier than looping through ownProperties of `val`.
|
|
302
|
+
try {
|
|
303
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
304
|
+
} catch (_) {
|
|
305
|
+
return 'Object';
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// errors
|
|
309
|
+
if (val instanceof Error) {
|
|
310
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
311
|
+
}
|
|
312
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
313
|
+
return className;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
317
|
+
ptr = ptr >>> 0;
|
|
318
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
let cachedDataViewMemory0 = null;
|
|
322
|
+
function getDataViewMemory0() {
|
|
323
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
324
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
325
|
+
}
|
|
326
|
+
return cachedDataViewMemory0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function getStringFromWasm0(ptr, len) {
|
|
330
|
+
ptr = ptr >>> 0;
|
|
331
|
+
return decodeText(ptr, len);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
let cachedUint8ArrayMemory0 = null;
|
|
335
|
+
function getUint8ArrayMemory0() {
|
|
336
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
337
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
338
|
+
}
|
|
339
|
+
return cachedUint8ArrayMemory0;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function handleError(f, args) {
|
|
343
|
+
try {
|
|
344
|
+
return f.apply(this, args);
|
|
345
|
+
} catch (e) {
|
|
346
|
+
const idx = addToExternrefTable0(e);
|
|
347
|
+
wasm.__wbindgen_exn_store(idx);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function isLikeNone(x) {
|
|
352
|
+
return x === undefined || x === null;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
356
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
357
|
+
const real = (...args) => {
|
|
358
|
+
|
|
359
|
+
// First up with a closure we increment the internal reference
|
|
360
|
+
// count. This ensures that the Rust closure environment won't
|
|
361
|
+
// be deallocated while we're invoking it.
|
|
362
|
+
state.cnt++;
|
|
363
|
+
const a = state.a;
|
|
364
|
+
state.a = 0;
|
|
365
|
+
try {
|
|
366
|
+
return f(a, state.b, ...args);
|
|
367
|
+
} finally {
|
|
368
|
+
state.a = a;
|
|
369
|
+
real._wbg_cb_unref();
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
real._wbg_cb_unref = () => {
|
|
373
|
+
if (--state.cnt === 0) {
|
|
374
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
375
|
+
state.a = 0;
|
|
376
|
+
CLOSURE_DTORS.unregister(state);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
380
|
+
return real;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
384
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
385
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
386
|
+
WASM_VECTOR_LEN = arg.length;
|
|
387
|
+
return ptr;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
391
|
+
if (realloc === undefined) {
|
|
392
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
393
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
394
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
395
|
+
WASM_VECTOR_LEN = buf.length;
|
|
396
|
+
return ptr;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
let len = arg.length;
|
|
400
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
401
|
+
|
|
402
|
+
const mem = getUint8ArrayMemory0();
|
|
403
|
+
|
|
404
|
+
let offset = 0;
|
|
405
|
+
|
|
406
|
+
for (; offset < len; offset++) {
|
|
407
|
+
const code = arg.charCodeAt(offset);
|
|
408
|
+
if (code > 0x7F) break;
|
|
409
|
+
mem[ptr + offset] = code;
|
|
410
|
+
}
|
|
411
|
+
if (offset !== len) {
|
|
412
|
+
if (offset !== 0) {
|
|
413
|
+
arg = arg.slice(offset);
|
|
414
|
+
}
|
|
415
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
416
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
417
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
418
|
+
|
|
419
|
+
offset += ret.written;
|
|
420
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
WASM_VECTOR_LEN = offset;
|
|
424
|
+
return ptr;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function takeFromExternrefTable0(idx) {
|
|
428
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
429
|
+
wasm.__externref_table_dealloc(idx);
|
|
430
|
+
return value;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
434
|
+
cachedTextDecoder.decode();
|
|
435
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
436
|
+
let numBytesDecoded = 0;
|
|
437
|
+
function decodeText(ptr, len) {
|
|
438
|
+
numBytesDecoded += len;
|
|
439
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
440
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
441
|
+
cachedTextDecoder.decode();
|
|
442
|
+
numBytesDecoded = len;
|
|
443
|
+
}
|
|
444
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const cachedTextEncoder = new TextEncoder();
|
|
448
|
+
|
|
449
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
450
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
451
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
452
|
+
view.set(buf);
|
|
453
|
+
return {
|
|
454
|
+
read: arg.length,
|
|
455
|
+
written: buf.length
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
let WASM_VECTOR_LEN = 0;
|
|
461
|
+
|
|
462
|
+
let wasmModule, wasm;
|
|
463
|
+
function __wbg_finalize_init(instance, module) {
|
|
464
|
+
wasm = instance.exports;
|
|
465
|
+
wasmModule = module;
|
|
466
|
+
cachedDataViewMemory0 = null;
|
|
467
|
+
cachedUint8ArrayMemory0 = null;
|
|
468
|
+
wasm.__wbindgen_start();
|
|
469
|
+
return wasm;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
async function __wbg_load(module, imports) {
|
|
473
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
474
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
475
|
+
try {
|
|
476
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
477
|
+
} catch (e) {
|
|
478
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
479
|
+
|
|
480
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
481
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
482
|
+
|
|
483
|
+
} else { throw e; }
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const bytes = await module.arrayBuffer();
|
|
488
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
489
|
+
} else {
|
|
490
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
491
|
+
|
|
492
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
493
|
+
return { instance, module };
|
|
494
|
+
} else {
|
|
495
|
+
return instance;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function expectedResponseType(type) {
|
|
500
|
+
switch (type) {
|
|
501
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
502
|
+
}
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function initSync(module) {
|
|
508
|
+
if (wasm !== undefined) return wasm;
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
if (module !== undefined) {
|
|
512
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
513
|
+
({module} = module)
|
|
514
|
+
} else {
|
|
515
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const imports = __wbg_get_imports();
|
|
520
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
521
|
+
module = new WebAssembly.Module(module);
|
|
522
|
+
}
|
|
523
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
524
|
+
return __wbg_finalize_init(instance, module);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
async function __wbg_init(module_or_path) {
|
|
528
|
+
if (wasm !== undefined) return wasm;
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
if (module_or_path !== undefined) {
|
|
532
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
533
|
+
({module_or_path} = module_or_path)
|
|
534
|
+
} else {
|
|
535
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (module_or_path === undefined) {
|
|
540
|
+
module_or_path = new URL('wasm_basis_decode_bg.a8b7eebd.wasm', import.meta.url);
|
|
541
|
+
}
|
|
542
|
+
const imports = __wbg_get_imports();
|
|
543
|
+
|
|
544
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
545
|
+
module_or_path = fetch(module_or_path);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
549
|
+
|
|
550
|
+
return __wbg_finalize_init(instance, module);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export { initSync, __wbg_init as default };
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Initialize the embedded basisu transcoder WASM.
|
|
6
|
+
* Must be awaited once after the outer WASM module's `default()` init.
|
|
7
|
+
*/
|
|
8
|
+
export function init_basis(): Promise<any>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Transcode a KTX2/basis file to a GPU-compressed (or RGBA32) format.
|
|
6
12
|
*
|
|
7
13
|
* `format`: 0=RGBA32, 1=ETC2_RGBA8, 2=ASTC_4×4, 3=BC7
|
|
8
14
|
*
|
|
9
|
-
* Returns
|
|
15
|
+
* Returns `{ data: Uint8Array, width: u32, height: u32, format: u32 }`.
|
|
10
16
|
*/
|
|
11
17
|
export function transcode_basis(data: Uint8Array, format: number): object;
|
|
12
18
|
|
|
@@ -15,10 +21,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
15
21
|
export interface InitOutput {
|
|
16
22
|
readonly memory: WebAssembly.Memory;
|
|
17
23
|
readonly transcode_basis: (a: number, b: number, c: number) => [number, number, number];
|
|
24
|
+
readonly init_basis: () => any;
|
|
25
|
+
readonly wasm_bindgen__convert__closures_____invoke__h1a884335adcc7c22: (a: number, b: number, c: any) => [number, number];
|
|
26
|
+
readonly wasm_bindgen__convert__closures_____invoke__hfcaf9f68983c0e6f: (a: number, b: number, c: any) => [number, number];
|
|
27
|
+
readonly wasm_bindgen__convert__closures_____invoke__h16cb8cb7feea2290: (a: number, b: number, c: any, d: any) => void;
|
|
28
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
29
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
18
30
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
19
31
|
readonly __externref_table_alloc: () => number;
|
|
20
32
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
21
|
-
readonly
|
|
33
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
22
34
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
23
35
|
readonly __wbindgen_start: () => void;
|
|
24
36
|
}
|
|
Binary file
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const transcode_basis: (a: number, b: number, c: number) => [number, number, number];
|
|
5
|
+
export const init_basis: () => any;
|
|
6
|
+
export const wasm_bindgen__convert__closures_____invoke__h1a884335adcc7c22: (a: number, b: number, c: any) => [number, number];
|
|
7
|
+
export const wasm_bindgen__convert__closures_____invoke__hfcaf9f68983c0e6f: (a: number, b: number, c: any) => [number, number];
|
|
8
|
+
export const wasm_bindgen__convert__closures_____invoke__h16cb8cb7feea2290: (a: number, b: number, c: any, d: any) => void;
|
|
9
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
10
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
5
11
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
6
12
|
export const __externref_table_alloc: () => number;
|
|
7
13
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
8
|
-
export const
|
|
14
|
+
export const __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
9
15
|
export const __externref_table_dealloc: (a: number) => void;
|
|
10
16
|
export const __wbindgen_start: () => void;
|
|
@@ -551,7 +551,7 @@ async function __wbg_init(module_or_path) {
|
|
|
551
551
|
}
|
|
552
552
|
|
|
553
553
|
if (module_or_path === undefined) {
|
|
554
|
-
module_or_path = new URL('wasm_decode_bg.
|
|
554
|
+
module_or_path = new URL('wasm_decode_bg.bf116aa6.wasm', import.meta.url);
|
|
555
555
|
}
|
|
556
556
|
const imports = __wbg_get_imports();
|
|
557
557
|
|
|
Binary file
|
|
@@ -2705,57 +2705,57 @@ function __wbg_get_imports() {
|
|
|
2705
2705
|
arg0.writeTexture(arg1, arg2, arg3, arg4);
|
|
2706
2706
|
}, arguments); },
|
|
2707
2707
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2708
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2708
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2709
2709
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b);
|
|
2710
2710
|
return ret;
|
|
2711
2711
|
},
|
|
2712
2712
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2713
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2713
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3910, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2714
2714
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd8590da73942d3e0);
|
|
2715
2715
|
return ret;
|
|
2716
2716
|
},
|
|
2717
2717
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2718
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx:
|
|
2718
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 3833, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2719
2719
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6ff3e7511bd758a3);
|
|
2720
2720
|
return ret;
|
|
2721
2721
|
},
|
|
2722
2722
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
2723
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx:
|
|
2723
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2724
2724
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_3);
|
|
2725
2725
|
return ret;
|
|
2726
2726
|
},
|
|
2727
2727
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
2728
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
2728
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2729
2729
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_4);
|
|
2730
2730
|
return ret;
|
|
2731
2731
|
},
|
|
2732
2732
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
2733
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx:
|
|
2733
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2734
2734
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_5);
|
|
2735
2735
|
return ret;
|
|
2736
2736
|
},
|
|
2737
2737
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
2738
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx:
|
|
2738
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2739
2739
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_6);
|
|
2740
2740
|
return ret;
|
|
2741
2741
|
},
|
|
2742
2742
|
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
2743
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx:
|
|
2743
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2744
2744
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_7);
|
|
2745
2745
|
return ret;
|
|
2746
2746
|
},
|
|
2747
2747
|
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
2748
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx:
|
|
2748
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2749
2749
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_8);
|
|
2750
2750
|
return ret;
|
|
2751
2751
|
},
|
|
2752
2752
|
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
|
|
2753
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx:
|
|
2753
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx: 3826, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2754
2754
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00cde4323839146b_9);
|
|
2755
2755
|
return ret;
|
|
2756
2756
|
},
|
|
2757
2757
|
__wbindgen_cast_000000000000000b: function(arg0, arg1) {
|
|
2758
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2758
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3831, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2759
2759
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hdb7f99c0126c5c28);
|
|
2760
2760
|
return ret;
|
|
2761
2761
|
},
|
|
@@ -3324,7 +3324,7 @@ async function __wbg_init(module_or_path) {
|
|
|
3324
3324
|
}
|
|
3325
3325
|
|
|
3326
3326
|
if (module_or_path === undefined) {
|
|
3327
|
-
module_or_path = new URL('sangine_bg.
|
|
3327
|
+
module_or_path = new URL('sangine_bg.ecedf539.wasm', import.meta.url);
|
|
3328
3328
|
}
|
|
3329
3329
|
const imports = __wbg_get_imports();
|
|
3330
3330
|
|
|
Binary file
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* @ts-self-types="./wasm_sbo_decode.d.ts" */
|
|
2
2
|
|
|
3
|
-
//#region exports
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @param {Uint8Array} data
|
|
7
5
|
* @returns {Uint8Array}
|
|
@@ -15,26 +13,21 @@ export function decode_sbo(data) {
|
|
|
15
13
|
}
|
|
16
14
|
return takeFromExternrefTable0(ret[0]);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
|
|
21
|
-
//#region wasm imports
|
|
22
|
-
|
|
23
16
|
function __wbg_get_imports() {
|
|
24
17
|
const import0 = {
|
|
25
18
|
__proto__: null,
|
|
26
|
-
|
|
19
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
|
27
20
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
28
21
|
},
|
|
29
|
-
|
|
22
|
+
__wbg_new_from_slice_b5ea43e23f6008c0: function(arg0, arg1) {
|
|
30
23
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
31
24
|
return ret;
|
|
32
|
-
},
|
|
33
|
-
__wbindgen_cast_0000000000000001: function(
|
|
25
|
+
},
|
|
26
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
34
27
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
35
28
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
36
29
|
return ret;
|
|
37
|
-
},
|
|
30
|
+
},
|
|
38
31
|
__wbindgen_init_externref_table: function() {
|
|
39
32
|
const table = wasm.__wbindgen_externrefs;
|
|
40
33
|
const offset = table.grow(4);
|
|
@@ -51,10 +44,6 @@ function __wbg_get_imports() {
|
|
|
51
44
|
};
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
|
|
57
|
-
//#region intrinsics
|
|
58
47
|
function getArrayU8FromWasm0(ptr, len) {
|
|
59
48
|
ptr = ptr >>> 0;
|
|
60
49
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -73,22 +62,6 @@ function getUint8ArrayMemory0() {
|
|
|
73
62
|
return cachedUint8ArrayMemory0;
|
|
74
63
|
}
|
|
75
64
|
|
|
76
|
-
function logError(f, args) {
|
|
77
|
-
try {
|
|
78
|
-
return f.apply(this, args);
|
|
79
|
-
} catch (e) {
|
|
80
|
-
let error = (function () {
|
|
81
|
-
try {
|
|
82
|
-
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
|
|
83
|
-
} catch(_) {
|
|
84
|
-
return "<failed to stringify thrown value>";
|
|
85
|
-
}
|
|
86
|
-
}());
|
|
87
|
-
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
|
|
88
|
-
throw e;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
65
|
function passArray8ToWasm0(arg, malloc) {
|
|
93
66
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
94
67
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -118,10 +91,6 @@ function decodeText(ptr, len) {
|
|
|
118
91
|
|
|
119
92
|
let WASM_VECTOR_LEN = 0;
|
|
120
93
|
|
|
121
|
-
|
|
122
|
-
//#endregion
|
|
123
|
-
|
|
124
|
-
//#region wasm loading
|
|
125
94
|
let wasmModule, wasm;
|
|
126
95
|
function __wbg_finalize_init(instance, module) {
|
|
127
96
|
wasm = instance.exports;
|
|
@@ -199,7 +168,7 @@ async function __wbg_init(module_or_path) {
|
|
|
199
168
|
}
|
|
200
169
|
|
|
201
170
|
if (module_or_path === undefined) {
|
|
202
|
-
module_or_path = new URL('wasm_sbo_decode_bg.
|
|
171
|
+
module_or_path = new URL('wasm_sbo_decode_bg.5c359661.wasm', import.meta.url);
|
|
203
172
|
}
|
|
204
173
|
const imports = __wbg_get_imports();
|
|
205
174
|
|
|
@@ -213,5 +182,3 @@ async function __wbg_init(module_or_path) {
|
|
|
213
182
|
}
|
|
214
183
|
|
|
215
184
|
export { initSync, __wbg_init as default };
|
|
216
|
-
//#endregion
|
|
217
|
-
export { wasm as __wasm }
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DECODE_HASH = "
|
|
1
|
+
export declare const DECODE_HASH = "bf116aa6";
|
|
2
2
|
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SANGINE_HASH = "
|
|
1
|
+
export declare const SANGINE_HASH = "ecedf539";
|
|
2
2
|
//# sourceMappingURL=sangine.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
/* @ts-self-types="./wasm_basis_decode.d.ts" */
|
|
2
|
-
|
|
3
|
-
//#region exports
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Transcode a .basis file to a GPU-compressed (or RGBA32) format.
|
|
7
|
-
*
|
|
8
|
-
* `format`: 0=RGBA32, 1=ETC2_RGBA8, 2=ASTC_4×4, 3=BC7
|
|
9
|
-
*
|
|
10
|
-
* Returns a JS object `{ data: Uint8Array, width: u32, height: u32, format: u32 }`.
|
|
11
|
-
* @param {Uint8Array} data
|
|
12
|
-
* @param {number} format
|
|
13
|
-
* @returns {object}
|
|
14
|
-
*/
|
|
15
|
-
export function transcode_basis(data, format) {
|
|
16
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
17
|
-
const len0 = WASM_VECTOR_LEN;
|
|
18
|
-
_assertNum(format);
|
|
19
|
-
const ret = wasm.transcode_basis(ptr0, len0, format);
|
|
20
|
-
if (ret[2]) {
|
|
21
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
22
|
-
}
|
|
23
|
-
return takeFromExternrefTable0(ret[0]);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
|
|
28
|
-
//#region wasm imports
|
|
29
|
-
import * as import1 from "env"
|
|
30
|
-
import * as import2 from "env"
|
|
31
|
-
import * as import3 from "env"
|
|
32
|
-
import * as import4 from "env"
|
|
33
|
-
import * as import5 from "env"
|
|
34
|
-
import * as import6 from "env"
|
|
35
|
-
import * as import7 from "env"
|
|
36
|
-
import * as import8 from "env"
|
|
37
|
-
import * as import9 from "env"
|
|
38
|
-
import * as import10 from "env"
|
|
39
|
-
|
|
40
|
-
function __wbg_get_imports() {
|
|
41
|
-
const import0 = {
|
|
42
|
-
__proto__: null,
|
|
43
|
-
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
44
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
45
|
-
},
|
|
46
|
-
__wbg_new_361308b2356cecd0: function() { return logError(function () {
|
|
47
|
-
const ret = new Object();
|
|
48
|
-
return ret;
|
|
49
|
-
}, arguments); },
|
|
50
|
-
__wbg_new_from_slice_a3d2629dc1826784: function() { return logError(function (arg0, arg1) {
|
|
51
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
52
|
-
return ret;
|
|
53
|
-
}, arguments); },
|
|
54
|
-
__wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
|
|
55
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
56
|
-
_assertBoolean(ret);
|
|
57
|
-
return ret;
|
|
58
|
-
}, arguments); },
|
|
59
|
-
__wbindgen_cast_0000000000000001: function() { return logError(function (arg0) {
|
|
60
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
61
|
-
const ret = arg0;
|
|
62
|
-
return ret;
|
|
63
|
-
}, arguments); },
|
|
64
|
-
__wbindgen_cast_0000000000000002: function() { return logError(function (arg0, arg1) {
|
|
65
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
66
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
67
|
-
return ret;
|
|
68
|
-
}, arguments); },
|
|
69
|
-
__wbindgen_init_externref_table: function() {
|
|
70
|
-
const table = wasm.__wbindgen_externrefs;
|
|
71
|
-
const offset = table.grow(4);
|
|
72
|
-
table.set(0, undefined);
|
|
73
|
-
table.set(offset + 0, undefined);
|
|
74
|
-
table.set(offset + 1, null);
|
|
75
|
-
table.set(offset + 2, true);
|
|
76
|
-
table.set(offset + 3, false);
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
__proto__: null,
|
|
81
|
-
"./wasm_basis_decode_bg.js": import0,
|
|
82
|
-
"env": import1,
|
|
83
|
-
"env": import2,
|
|
84
|
-
"env": import3,
|
|
85
|
-
"env": import4,
|
|
86
|
-
"env": import5,
|
|
87
|
-
"env": import6,
|
|
88
|
-
"env": import7,
|
|
89
|
-
"env": import8,
|
|
90
|
-
"env": import9,
|
|
91
|
-
"env": import10,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
|
|
98
|
-
//#region intrinsics
|
|
99
|
-
function addToExternrefTable0(obj) {
|
|
100
|
-
const idx = wasm.__externref_table_alloc();
|
|
101
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
102
|
-
return idx;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function _assertBoolean(n) {
|
|
106
|
-
if (typeof(n) !== 'boolean') {
|
|
107
|
-
throw new Error(`expected a boolean argument, found ${typeof(n)}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function _assertNum(n) {
|
|
112
|
-
if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
116
|
-
ptr = ptr >>> 0;
|
|
117
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function getStringFromWasm0(ptr, len) {
|
|
121
|
-
ptr = ptr >>> 0;
|
|
122
|
-
return decodeText(ptr, len);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
let cachedUint8ArrayMemory0 = null;
|
|
126
|
-
function getUint8ArrayMemory0() {
|
|
127
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
128
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
129
|
-
}
|
|
130
|
-
return cachedUint8ArrayMemory0;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function handleError(f, args) {
|
|
134
|
-
try {
|
|
135
|
-
return f.apply(this, args);
|
|
136
|
-
} catch (e) {
|
|
137
|
-
const idx = addToExternrefTable0(e);
|
|
138
|
-
wasm.__wbindgen_exn_store(idx);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function logError(f, args) {
|
|
143
|
-
try {
|
|
144
|
-
return f.apply(this, args);
|
|
145
|
-
} catch (e) {
|
|
146
|
-
let error = (function () {
|
|
147
|
-
try {
|
|
148
|
-
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
|
|
149
|
-
} catch(_) {
|
|
150
|
-
return "<failed to stringify thrown value>";
|
|
151
|
-
}
|
|
152
|
-
}());
|
|
153
|
-
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
|
|
154
|
-
throw e;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
159
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
160
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
161
|
-
WASM_VECTOR_LEN = arg.length;
|
|
162
|
-
return ptr;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function takeFromExternrefTable0(idx) {
|
|
166
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
167
|
-
wasm.__externref_table_dealloc(idx);
|
|
168
|
-
return value;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
172
|
-
cachedTextDecoder.decode();
|
|
173
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
174
|
-
let numBytesDecoded = 0;
|
|
175
|
-
function decodeText(ptr, len) {
|
|
176
|
-
numBytesDecoded += len;
|
|
177
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
178
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
179
|
-
cachedTextDecoder.decode();
|
|
180
|
-
numBytesDecoded = len;
|
|
181
|
-
}
|
|
182
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
let WASM_VECTOR_LEN = 0;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//#endregion
|
|
189
|
-
|
|
190
|
-
//#region wasm loading
|
|
191
|
-
let wasmModule, wasm;
|
|
192
|
-
function __wbg_finalize_init(instance, module) {
|
|
193
|
-
wasm = instance.exports;
|
|
194
|
-
wasmModule = module;
|
|
195
|
-
cachedUint8ArrayMemory0 = null;
|
|
196
|
-
wasm.__wbindgen_start();
|
|
197
|
-
return wasm;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
async function __wbg_load(module, imports) {
|
|
201
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
202
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
203
|
-
try {
|
|
204
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
205
|
-
} catch (e) {
|
|
206
|
-
const validResponse = module.ok && expectedResponseType(module.type);
|
|
207
|
-
|
|
208
|
-
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
209
|
-
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
210
|
-
|
|
211
|
-
} else { throw e; }
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const bytes = await module.arrayBuffer();
|
|
216
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
217
|
-
} else {
|
|
218
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
219
|
-
|
|
220
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
221
|
-
return { instance, module };
|
|
222
|
-
} else {
|
|
223
|
-
return instance;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function expectedResponseType(type) {
|
|
228
|
-
switch (type) {
|
|
229
|
-
case 'basic': case 'cors': case 'default': return true;
|
|
230
|
-
}
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function initSync(module) {
|
|
236
|
-
if (wasm !== undefined) return wasm;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (module !== undefined) {
|
|
240
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
241
|
-
({module} = module)
|
|
242
|
-
} else {
|
|
243
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const imports = __wbg_get_imports();
|
|
248
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
249
|
-
module = new WebAssembly.Module(module);
|
|
250
|
-
}
|
|
251
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
252
|
-
return __wbg_finalize_init(instance, module);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async function __wbg_init(module_or_path) {
|
|
256
|
-
if (wasm !== undefined) return wasm;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (module_or_path !== undefined) {
|
|
260
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
261
|
-
({module_or_path} = module_or_path)
|
|
262
|
-
} else {
|
|
263
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (module_or_path === undefined) {
|
|
268
|
-
module_or_path = new URL('wasm_basis_decode_bg.6c648416.wasm', import.meta.url);
|
|
269
|
-
}
|
|
270
|
-
const imports = __wbg_get_imports();
|
|
271
|
-
|
|
272
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
273
|
-
module_or_path = fetch(module_or_path);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
277
|
-
|
|
278
|
-
return __wbg_finalize_init(instance, module);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export { initSync, __wbg_init as default };
|
|
282
|
-
//#endregion
|
|
283
|
-
export { wasm as __wasm }
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"basis-decode.d.ts","sourceRoot":"","sources":["../../src/wasm-hashes/basis-decode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sbo-decode.d.ts","sourceRoot":"","sources":["../../src/wasm-hashes/sbo-decode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,aAAa,CAAA"}
|