Use ktx2 texture without workers

I am trying to use a ktx2 texture without using web workers (I need to run it on a scope where is not possible to use them). For doing it I am setting:

BABYLON.KhronosTextureContainer2.DefaultNumWorkers = 0;

But then I am getting an error (on version 4.2.0) or a warning (version 5.0.0-alpha.42) saying “KTX2DECODER is not defined”

I created a simple playground to show the issue Babylon.js Playground

I am missing something? or is there something else I need to configure in order to use the ktx2 without workers?

Thank you

The playground doesn’t load the ktx loader (@Deltakosh - want to add that to the playground?)

However, even when including it there seems to be an issue - ktx2 without workers | Babylon.js Playground (babylonjs.com). @Evgeni_Popov , i noticed you did some work with the ktx loader, do you have an idea what’s happening there?

Yes!

1 Like

The playground is loading on demand, we should not change this part :slight_smile: https://playground.babylonjs.com/#EIJH8L#36

The issue might be with the file itself, @Evgeni_Popov will have a look on Monday :slight_smile:

1 Like

Scratch my previous answer, It is a bug when not using worker where we are not loading the lib dynamically :slight_smile:

I will try to make a fix soon.

Nightly will be up in one hour with the fix in :slight_smile:

For reference and review from @Evgeni_Popov on Tuesday :slight_smile: https://github.com/BabylonJS/Babylon.js/pull/11003/commits/dfd62b41356864117d3ae1d69866d9472721d6b7

Thanks @sebavan.

I had assumed that in the case of using ktx2 without worker threads, the user would load the required modules themselves.

np now it handles the three cases :wink:

2 Likes

Thanks a lot!!