|
@@ -123,8 +123,12 @@ export class KhronosTextureContainer2 {
|
|
if (!message.data.success) {
|
|
if (!message.data.success) {
|
|
reject({ message: message.data.msg });
|
|
reject({ message: message.data.msg });
|
|
} else {
|
|
} else {
|
|
- this._createTexture(message.data.decodedData, internalTexture);
|
|
|
|
- resolve();
|
|
|
|
|
|
+ try {
|
|
|
|
+ this._createTexture(message.data.decodedData, internalTexture);
|
|
|
|
+ resolve();
|
|
|
|
+ } catch (err) {
|
|
|
|
+ reject({ message: err });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
onComplete();
|
|
onComplete();
|
|
}
|
|
}
|
|
@@ -187,6 +191,10 @@ export class KhronosTextureContainer2 {
|
|
internalTexture.format = data.transcodedFormat;
|
|
internalTexture.format = data.transcodedFormat;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (data.errors) {
|
|
|
|
+ throw new Error("KTX2 container - could not transcode the data. " + data.errors);
|
|
|
|
+ }
|
|
|
|
+
|
|
for (let t = 0; t < data.mipmaps.length; ++t) {
|
|
for (let t = 0; t < data.mipmaps.length; ++t) {
|
|
let mipmap = data.mipmaps[t];
|
|
let mipmap = data.mipmaps[t];
|
|
|
|
|
|
@@ -253,7 +261,7 @@ export function workerFunc(): void {
|
|
const buffers = [];
|
|
const buffers = [];
|
|
for (let mip = 0; mip < data.mipmaps.length; ++mip) {
|
|
for (let mip = 0; mip < data.mipmaps.length; ++mip) {
|
|
const mipmap = data.mipmaps[mip];
|
|
const mipmap = data.mipmaps[mip];
|
|
- if (mipmap) {
|
|
|
|
|
|
+ if (mipmap && mipmap.data) {
|
|
buffers.push(mipmap.data.buffer);
|
|
buffers.push(mipmap.data.buffer);
|
|
}
|
|
}
|
|
}
|
|
}
|