atteneder / KtxUnity

Load KTX and Basis Universal textures at runtime
Apache License 2.0
223 stars 42 forks source link

Windows: Unknown Architecture & EntryPointNotFound #21

Closed DerrickBarra closed 4 years ago

DerrickBarra commented 4 years ago

@atteneder I know you're working on making a new version of the Windows binaries, but I figure this bug report might be useful for anyone just joining us and wondering what's going on.

On Windows (Editor and build), the ktx_unity.dll binary needs to be updated, as importing the plugin and attempting to use KtxUnity currently leads users to the following bugs.

In the meantime, you can remove the x86_64 folder and use KtxUnity on Android, iOS, WebGL, and Mac builds. I've personally only tested Android and WebGL via the last beta release, but I can confirm they work.

hybridherbst commented 4 years ago

Can confirm this is an issue with the latest release and was working previously.

image

atteneder commented 4 years ago

Hi,

Thanks for reporting!

@DerrickBarra In your log there's two errors. The first one indicates that the DLL is not loading. I have released a new version (0.8.1) in the meantime, so your problem should be fixed by updating. I recommend switching to installing via the OpenUPM scoped registry via the Installer Package. If you've installed it via GIT URL, perform a pull (and make sure GIT LFS is working!)

@hybridherbst Are you using 0.8.1/0.8.2 ? If yes, I'm confused. Yesterday I tested it (from OpenUPM) and it worked for Editor / IL2CPP Standalone and UWP. I presume don't use a 32-bit version of Windows ^^

I have an update ready to release (using KTX-Software 4.0.0 beta 5 and fixing alpha issues with UASTC mode), but I'm tending to wait with updating the binaries until we have this figured out.

DerrickBarra commented 4 years ago

@atteneder I updated my KtxUnity test repo to 0.8.1 via OpenUPM (which I never had used previously, it's pretty neat). But my KtxUnity test in the editor on my Windows 10 PC still gets the same EntryPointNotFound error.

I was able to successfully get Unity WebGL and Android builds to work with 0.8.1, so that's good!

hybridherbst commented 4 years ago

I tested again with latest master and the issue persists.

Here's the code:

using System.Collections;
using System.Collections.Generic;
using KtxUnity;
using UnityEngine;

public class LoadBasisFile : MonoBehaviour
{
    public string absPath;

    public Texture2D texture;

    [ContextMenu("Load Now")]
    void LoadNow()
    {
        var basis = new BasisUniversalTexture();
        basis.onTextureLoaded += (tex, orientation) => texture = tex;
        basis.LoadFromUrl(absPath, this);
    }
}

And it outputs

EntryPointNotFoundException: ktx_basisu_basis_init
KtxUnity.BasisUniversal.InitInternal () (at Library/PackageCache/com.atteneder.ktx@fd95bdc773/Runtime/Scripts/BasisUniversal.cs:41)
KtxUnity.BasisUniversal.GetTranscoderInstance () (at Library/PackageCache/com.atteneder.ktx@fd95bdc773/Runtime/Scripts/BasisUniversal.cs:47)
KtxUnity.BasisUniversalTexture+<LoadBytesRoutine>d__1.MoveNext () (at Library/PackageCache/com.atteneder.ktx@fd95bdc773/Runtime/Scripts/BasisUniversalTexture.cs:32)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <ee47be73f7ef409ca5e5ce4b121745b7>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
KtxUnity.<LoadFile>d__8:MoveNext() (at Library/PackageCache/com.atteneder.ktx@fd95bdc773/Runtime/Scripts/TextureBase.cs:94)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
DerrickBarra commented 4 years ago

@atteneder Anything else you'd like us to try for this bug? Our team can still use KtxUnity, but we'll just have to load regular .jpgs/.pngs in the Unity Editor in the mean time.

atteneder commented 4 years ago

@atteneder Anything else you'd like us to try for this bug? Our team can still use KtxUnity, but we'll just have to load regular .jpgs/.pngs in the Unity Editor in the mean time.

Hmm, this is mysterious to me (classical works on my machine :/ )

Something must be different between our setups...maybe it's because I have Visual Studio installed :man_shrugging:

Anyhow, what you can do is provide detailed info about what Windows/Unity/KtxUnity version you use.

I'll try to install Unity and test it on gf's laptop in the meantime.

atteneder commented 4 years ago

I can reproduce! That´s great. Gonna find a solution tomorrow.

DerrickBarra commented 4 years ago

Awesome! Tell your GF thanks for helping us random internet people by sacrificing her laptop.

atteneder commented 4 years ago

Should be solved in 0.9.0 (re-open if not) GF appreciates the gratitude :)