Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.85k stars 819 forks source link

Feature: Support uploadFromBitmapDataAsync() introduced in AIR 23 #898

Closed harry248 closed 7 years ago

harry248 commented 8 years ago

Please see https://github.com/BowlerHatLLC/feathers/issues/1447, where I mistakenly thought this would have to be added to feathers.

PrimaryFeather commented 8 years ago

Yes, that's definitely coming! Thanks for creating the issue.

b005t3r commented 8 years ago

Are you going to add it to 1.8 as well? I could use a faster texture upload :)

PrimaryFeather commented 8 years ago

I can look into that, too! Shouldn't be much different than in 2.x.

PrimaryFeather commented 8 years ago

I just started implementing this feature, but it seems it's not ready for prime-time yet. These are the problems I encountered:

I forwarded these issues to Adobe so that they can hopefully look into it. I'll keep you updated!

PrimaryFeather commented 8 years ago

Just a heads-up — Adobe told me:

For now this feature has been backed out of AIR 23 release as we iron out few issues and bake it further for release. It will appear back in a future beta.

So don't panic if the methods disappear for a while in the beta versions.

As for the other mentioned points, some of them are known issues, and they are looking into it. They will also enhance the documentation about mipmap upload. (Hint: the TEXTURE_LOADED event is fired only once, so we can start all uploads simultaneously.)

subdan commented 7 years ago

Hello, Daniel. As you already know Adobe released AIR SDK 24 Beta. Do you plan to check if they fixed the bugs you found?

PrimaryFeather commented 7 years ago

I'm currently on a vacation, but I'll test this as soon as I'm back home! I've already got a local branch with this feature; as soon as this works, I can merge that with the master branch. :smile:

PrimaryFeather commented 7 years ago

That should do the trick!

There are new async parameters in the Texture.fromBitmap and Texture.fromBitmapData methods, behaving just as the one from Texture.fromAtfData. The AssetManager makes use of that, too, so you'll benefit automatically if you're using that class.

Starling will check if the feature is available. If it isn't, it will simply load the textures synchronously, but still execute the callback. So this should be extremely easy to use — as soon as Adobe adds Desktop or Flash support, those platforms will profit from this, too.

Please try it out and let me know if that works for you! Two notes:

harry248 commented 7 years ago

Great, thanks!

subdan commented 7 years ago

Hi, Daniel. I noticed that «scaffold_mobile» project doesn't work with AIR SDK 24 and the latest version (master) of Starling. When the textures loaded, nothing happens.

screenshot_1

PrimaryFeather commented 7 years ago

Do you get any error message? I just tried on OS X; it does work there (in the emulator). Could be some problem with the Windows implementation of this feature.

subdan commented 7 years ago

There aren't any error messages. Also, all my projects doesn't work with the latest version of Starling and AIR 24. Loaded textures doesn't display.

PrimaryFeather commented 7 years ago

Did you try just the simulator or also the actual devices?

subdan commented 7 years ago

No, I didn't. I tried to run the app only in adl emulator.

PrimaryFeather commented 7 years ago

Please try that too! It worked for me on both iOS and Android. However, it also worked on the simulator in my tests (but, as I said, I only tried macOS).

subdan commented 7 years ago

Ok. I'll try it tonight.

subdan commented 7 years ago

Hello, Daniel. It works on both iOS and Android but doesn't work on Windows. I tried adt emulator, captive package and air installator. I see white screen and nothing happens. All applications that built with Starling and AIR 24 doesn't work on Windows.

See what I found: https://bugbase.adobe.com/index.cfm?event=bug&id=4198176 I've the same issue.

PrimaryFeather commented 7 years ago

Thanks for trying it out! Hm ... does seem like a bug in the Windows implementation then, which is a real bummer.

The thing is, I'm actually using a try/catch to find out if the feature is available. So I had hoped that even such a problem would simply be ignored. Could you try to set a breakpoint here and step ahead? Where do you end up? (If that breakpoint is not hit, check the same method in the ConcretePotTexture class.)

Thanks a lot in advance!

PrimaryFeather commented 7 years ago

... wait a minute, you say it's not only in ADT, but also in a packaged app, right? I'll check if this happens on my Windows test computer, too.

subdan commented 7 years ago

I've added three breakpoints on lines 83, 85 and 95. They were reached in that order: 83→85→95. So, sAsyncSupported = true.

Yes, right, also in a packaged app.

I have Intel HD Graphics 2500. Have you read the thread on the bugbase? Alexandr Mostovoy has the same issue with Intel HD Graphics 3000.

PrimaryFeather commented 7 years ago

I'll check out if there's something I can do against that — otherwise, I'll try to point Adobe at the seriousness of the issue. I'll keep you posted!

PrimaryFeather commented 7 years ago

I just managed to try it out on Windows, and it works correctly in my case; sAsyncSupported ends up being false because I get an exception when trying to call the method (which is what's supposed to happen).

I've got an intel graphics chip, too, on a cheap 2-year-old netbook. Unfortunately, Windows doesn't tell me exactly which version, though.

It's puzzling why you wouldn't end up with error 3708 - Feature not available on this platform as well. This feature is supposed to be available only on mobile, so it shouldn't be a problem for ADB to report this missing support right away; I don't see how this could be a driver problem.

What about other Windows developers reading this — has anyone else seen this error? We'd be happy about any input, guys!

subdan commented 7 years ago

I tried to run on Windows machine with AMD Radeon HD 6750M. Works well.

PrimaryFeather commented 7 years ago

Thanks for the update! Maybe you can post this problem in the Adobe AIR community forum! Perhaps someone from Adobe can help out — my hands are tied, unfortunately, because I can't see what's happening inside Stage3D, either.

subdan commented 7 years ago

Done. Bug Id: AIR-4198227

PrimaryFeather commented 7 years ago

Thanks a lot! I just voted for the bug.

marpies commented 7 years ago

Hi @PrimaryFeather,

Looks like there's still a problem in AIR 24 with the async upload on Android. I've created a bug report with sample project. The async upload fails after some time, and the following messages pop up in the logcat (the GPU mem states 0.0 though):

W Adreno-GSL: <gsl_ldd_control:466>: ioctl fd 19 code 0xc0080913 (IOCTL_KGSL_DRAWCTXT_CREATE) failed: errno 28 No space left on device
W Adreno-GSL: <gsl_ldd_control:466>: ioctl fd 19 code 0x40040921 (IOCTL_KGSL_SHAREDMEM_FREE) failed: errno 22 Invalid argument
E Adreno-EGL: <eglCreateClientApiContext:2303>: Unable to create GL context
W Adreno-EGL: <qeglDrvAPI_eglCreateContext:2539>: EGL_BAD_ALLOC

No issue with sync upload. Could you forward this over to the AIR dev team to make sure they are aware of this issue?

Thanks!

PrimaryFeather commented 7 years ago

Hi @marpies, Adobe is already looking into it, and they can reproduce the problem! Which is great news. :smile:

In fact, I created another bug report today (discovered by Josh), that's probably connected. See Issue #940.