Gamua / Starling-Framework

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

(Version 1.7) using ATF textures context loss results in an Error #3700 #799

Closed Klug76 closed 8 years ago

Klug76 commented 8 years ago

In the version 1.7 using ATF-textures, any context loss results in the following error:

[Starling] Display Driver: DirectX9 (Baseline Constrained)
[Fault] exception, information=Error: Error #3700: A texture sampler binds an incomplete texture. Make sure to upload(). All miplevels are required when mipmapping is enabled.

Stack:

flash.display3D::Context3D/drawTriangles
starling.display::QuadBatch/renderCustom at ...\starling_sandbox\src\starling\display\QuadBatch.as:255
starling.core::RenderSupport/finishQuadBatch at ...\starling_sandbox\src\starling\core\RenderSupport.as:597
starling.core::RenderSupport/batchQuad at ...\starling_sandbox\src\starling\core\RenderSupport.as:560
starling.display::Image/render at ...\starling_sandbox\src\starling\display\Image.as:184
starling.display::DisplayObjectContainer/render at ...\starling_sandbox\src\starling\display\DisplayObjectContainer.as:367
starling.display::Sprite/render at ...\starling_sandbox\src\starling\display\Sprite.as:213
starling.display::DisplayObjectContainer/render at ...\starling_sandbox\src\starling\display\DisplayObjectContainer.as:367
starling.display::DisplayObjectContainer/render at ...\starling_sandbox\src\starling\display\DisplayObjectContainer.as:367
starling.display::Sprite/render at ...\starling_sandbox\src\starling\display\Sprite.as:213
starling.display::DisplayObjectContainer/render at ...\starling_sandbox\src\starling\display\DisplayObjectContainer.as:367
starling.core::Starling/render at ...\starling_sandbox\src\starling\core\Starling.as:532
starling.core::Starling/nextFrame at ...\starling_sandbox\src\starling\core\Starling.as:481
starling.core::Starling/onEnterFrame at ...\starling_sandbox\src\starling\core\Starling.as:702

The issue #798 blocks check the version 2.0..

PrimaryFeather commented 8 years ago

Actually, this is a known issue — albeit not documented anywhere. :bowtie:

This only happens when starling.enableErrorChecking (or the equivalent property on the context) is set to true. I think this problem was introduced with an AIR / Flash Player update a while ago. Factually, I think it's correct to throw that error, because the ATF texture might really be incomplete at this stage. However, it's almost impossible to recover from a lost context gracefully without being in such a state for a short while. At least I didn't find any way to work around that.

However, any real-life application should always have enableErrorChecking disabled for performance reasons, so this won't happen on the market. And for testing context-loss situations, the best practice is to simply deactivate it, as well.

Could you try if this is indeed the case? Please also check if this fixes #798 as well, because the new Starling version should handle context loss just as well as previous versions.

Klug76 commented 8 years ago

Yes that's right. I think it should be put in the FAQ or 2.0 Migration Guide (is there such a document?).

PrimaryFeather commented 8 years ago

You're right, this definitely needs to be better documented! As a first step, I added that information to the API docs of that method. → http://doc.starling-framework.org/v2.0/starling/core/Starling.html#enableErrorChecking

(That's for 2.0, I'll do 1.x separately.)

PrimaryFeather commented 8 years ago

A while ago, I integrated this into the 1.8 docs, as well. → http://doc.starling-framework.org/v1.8/starling/core/Starling.html#enableErrorChecking