Copy link to clipboard
Copied
We're using BaseLine extended profile, which works fine on iPad, iPhone, Desktop and Android Nexus 10.
However when trying to initialize Starling on a Nexus 7, I get the error:
"Context3D is not available! Possible reasons: wrongRenderMode or missing device support"
Digging into Starling, this means Stage3D is throwing "Error #3702: Context3D not available."
Reverting back to BASELINE profile, and the app runs just fine.
Copy link to clipboard
Copied
Hi Shawn,
The BASELINE_EXTENDED profile is not supported on all devices. It is supported only on devices which have the GL_MAX_TEXTURE_SIZE >=4096, as the only extra support in the baseline extended profile as of now, is support for 4096x4096 textures. If the underlying chipset doesn't support the same, call to requestContext3D will return error 3702.
On Nexus 7, the maximum supported texture size is 2048. (http://gfxbench.com/device.jsp?benchmark=gfx27&D=Google+Nexus+7&testgroup=gl)
When using the BASELINE_EXTENDED profile, it is recommended that you try requesting context3D for Baseline Extended profile, if it returns error, you add a fallback to request for BASELINE profile.
Hope this helps.
Neha
Copy link to clipboard
Copied
Ah ok. Interesting approach.
I would expect the failure to only occur if I try and upload a texture that is too large for the current GPU.
For Nexus 7 our AS3 scripts would detect that it's low-resolution, and upload the 2048 textures.
Seems like this is a rather complicated thing now, involving multiple try/catch(){} blocks...
https://github.com/PrimaryFeather/Starling-Framework/issues/337#issuecomment-18523186
Extremely in-elegant solution. Did no-one think to implement a stage3d.isSupported() function?
Instead of 60 lines of cludge, we could just say:
if(stage3D.isSupported(Context3DProfile.BASELINE_EXTENDED)){ profile = Context3DProfile.BASELINE_EXTENDED; } else { profile = Context3DProfile.BASELINE; } starling = new Starling(..., profile);
Copy link to clipboard
Copied
Here's about the smallest snippet I could come up with to check EXTENDED support:
var stage3D:Stage3D = stage.stage3Ds[0]; stage3D.addEventListener(flash.events.Event.CONTEXT3D_CREATE, onExtendedComplete); stage3D.addEventListener(ErrorEvent.ERROR, function(){}); //Try and request extended profile. try { stage3D.requestContext3D("auto", Context3DProfile.BASELINE_EXTENDED); } catch (e:Error) { onExtendedComplete(false); } function onExtendedComplete(success:Boolean = true):void { stage3D.removeEventListener(flash.events.Event.CONTEXT3D_CREATE, onExtendedComplete); if(success){ startStarling(Context3DProfile.BASELINE_EXTENDED); } else { startStarling(Context3DProfile.BASELINE); } }
Copy link to clipboard
Copied
Apparently, on iPad 1, this script might not even work, as you need wait some unspecified amount of time before requesting the context again.
Yeesh...
Copy link to clipboard
Copied
I can't seem to edit the post above.
But here's the working script for anyone who wants to "simply" check whether they should pass EXTENDED or not. From testing, iPad 1 is said to require roughly a 100ms delay, I've set to 200 just to be conservative. From my personal testing, 1ms was enough (Nexus 7, Nexus 10 and iPad 2)
var delay:int = 200; var stage3D:Stage3D = Main.stage.stage3Ds[0]; stage3D.addEventListener(flash.events.Event.CONTEXT3D_CREATE, onExtendedComplete); stage3D.addEventListener(ErrorEvent.ERROR, onExtendedComplete); try { //Try and request EXTENDED profile. stage3D.requestContext3D("auto", Context3DProfile.BASELINE_EXTENDED); } catch (e:Error) { onExtendedComplete(); } function onExtendedComplete(event:* = null):void { var success:Boolean = (event && !(event is ErrorEvent)); stage3D.removeEventListener(flash.events.Event.CONTEXT3D_CREATE, onExtendedComplete); stage3D.removeEventListener(ErrorEvent.ERROR, onExtendedComplete); if(stage3D.context3D){ stage3D.context3D.dispose(false); } setTimeout(function(){ var profile:String = success? Context3DProfile.BASELINE_EXTENDED : Context3DProfile.BASELINE; startStarling(profile); //Call your normal startUp routine. }, delay); }