Explorar o código

Don't transfer ownership of data buffer to worker

Popov72 %!s(int64=5) %!d(string=hai) anos
pai
achega
a24ad3919b
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      src/Misc/khronosTextureContainer2.ts

+ 3 - 2
src/Misc/khronosTextureContainer2.ts

@@ -137,7 +137,8 @@ export class KhronosTextureContainer2 {
                         worker.addEventListener("error", onError);
                         worker.addEventListener("message", onMessage);
 
-                        worker.postMessage({ action: "decode", data, caps: compressedTexturesCaps }, [data.buffer]);
+                        // note: we can't transfer the ownership of data.buffer because if using a fallback texture the data.buffer buffer will be used by the current thread
+                        worker.postMessage({ action: "decode", data, caps: compressedTexturesCaps }/*, [data.buffer]*/);
                     });
                 });
             });
@@ -157,8 +158,8 @@ export class KhronosTextureContainer2 {
                             buffers.push(mipmap.data.buffer);
                         }
                     }
-                    resolve();
                     this._createTexture(data, internalTexture);
+                    resolve();
                 }).catch((reason: any) => {
                     reject({ message: reason });
                 });