StarlingGraphics / Starling-Extension-Graphics

flash.display.Graphics style extension for the Starling Flash GPU rendering framework
https://github.com/StarlingGraphics/Starling-Extension-Graphics/wiki
MIT License
285 stars 88 forks source link

Can't compile with ASC 2.0 preview 2 #5

Closed 13Flo closed 11 years ago

13Flo commented 12 years ago

Hi guys,

I'm trying to compile an AIR 3.4 app under FlashDevelop but as soon as I instanciate a Shape I get this error: as3[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert to starling.display.shaders.IShader.

Do you think it can be fixed?

Thank yo for your great work. It helps a lot!

Regards

jonathanrpace commented 12 years ago

Do you get the same error after compiling your code with the latest stable Flex SDK (4.6 I believe)?

13Flo commented 12 years ago

Yes, I compile with Flex SDK 4.6, AIR 3.4, ASC 2.0 preview 2, FlashDevelop

jonathanrpace commented 12 years ago

The version of the SDK you're using (the ASC 2.0 'preview') is still in beta, and I'd be interested in knowing if you get the same problem on an old 'stable' version of the SDK

What I mean by 'stable' is a version of the SDK not from labs.adobe.com. I.e http://sourceforge.net/adobe/flexsdk/wiki/Download%20Flex%204.6/

I'll see if I can reproduce your problem by compiling against the preview SDK as soon as I can - but you may be able to work around this problem in the meantime by simply using an older SDK.

randytroppmann commented 12 years ago

I can compile with the latest 4.7 Beta2 drop from labs.adobe.com.

jonathanrpace commented 12 years ago

I've also been able to successfully compile with the latest beta SDK.

@13Flo - Are you still experiencing problems? If so, could you provide me with a more detailed repro case?

13Flo commented 12 years ago

Hi Jonathan,

Sorry for the late reply.

Here's what I did:

The AS3 code: square = new Shape(); square.graphics.beginFill( 0xFF0000 ); square.graphics.drawRect( 0, 0, 10, 10 ); square.graphics.endFill(); addChild( square );

Runtime error: [Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert to starling.display.shaders.IShader.

I'll try to find some time to try with FlashBuilder but if you guys can compile with the 4.7 beta, I guess that might be the issue.

What do you think?

rivella50 commented 11 years ago

Same error here (with similar as3 code): I'm using Flash Builder 4.7 with stable Flex SDK 4.6 and AIR 3.5 overlay. Are there some news or solutions from your side ?

TypeError: Error #1034: Type Coercion failed: cannot convert to starling.display.shaders.IShader. at starling.display.materials::StandardMaterial()[/Users/valley/Development/flex/Starling-Extension-Graphics/extension/src/starling/display/materials/StandardMaterial.as:31] at starling.display.graphics::Graphic()[/Users/valley/Development/flex/Starling-Extension-Graphics/extension/src/starling/display/graphics/Graphic.as:46] at starling.display.graphics::Fill()[/Users/valley/Development/flex/Starling-Extension-Graphics/extension/src/starling/display/graphics/Fill.as:0] at starling.display::Graphics/beginFill()[/Users/valley/Development/flex/Starling-Extension-Graphics/extension/src/starling/display/Graphics.as:61]

jonathanrpace commented 11 years ago

Hey guys - afraid I'm still having no luck repro-ing this. I've got FB 4.7 beta running - and I've overlayed the AIR 3.5 SDK (boy - that was a pain - this came in handy http://forums.adobe.com/message/4734285)

All the extension examples are compiling and running fine with this setup.

Could you let me know if you're able to compile the examples ok?

If you're still having trouble, I'd be interested in getting a copy of the project folder - you can pm me at 'jonathanrpace at hotmail dot com'

randytroppmann commented 11 years ago

Jonathan,

I actually encountered at one point the same problem. Trying to think back on what caused it and how I worked around it: I was forced to used the source for Starling instead of the swc because of Feathers using the latest Starling codebase. I think this started the issue for the Starling Graphics Extension as described above. I think what I did to solve it was stop using the extension swc and use the src (overlaid it in the Starling source). So it could be something in the way your swc is compiled that causes issues in FB 4.7/AIR 3.5. Sorry I am a bit fuzzy in my recollections.

On 2012-11-18, at 9:21 AM, Jonathan Pace notifications@github.com wrote:

Hey guys - afraid I'm still having no luck repro-ing this. I've got FB 4.7 beta running - and I've overlayed the AIR 3.5 SDK (boy - that was a pain - this came in handy http://forums.adobe.com/message/4734285)

All the extension examples are compiling and running fine with this setup.

Could you let me know if you're able to compile the examples ok?

If you're still having trouble, I'd be interested in getting a copy of the project folder - you can pm me at 'jonathanrpace at hotmail dot com'

— Reply to this email directly or view it on GitHub.

rivella50 commented 11 years ago

Ok this is how i run it (and get the mentioned error above):

1) Downloaded Flex SDK 4.6 and AIR 3.5 in that bundle: http://www.swfgeek.net/2012/11/07/combined-version-of-the-flex-4-6-and-air-3-5-sdk-for-the-lazy-ones/

2) Using the very latest sources (not swc) of Starling and Starling-Extension-Graphics and name that separatedly as source path in Flash Builder 4.7 beta.

So everything seems to be up to date. When i try running e.g. the 02_Dynamic_Fill_Example project (either mobile or desktop) gives the same error.

asaia commented 11 years ago

I'm getting the same error message. Trying to compile using Flash Builder 4.7 beta using AIR SDK 3.4. Importing Starling and Starling Graphics Extension full source not swc. getting error: "TypeError: Error #1034: Type Coercion failed: cannot convert to starling.display.shaders.IShader."

Works fine in FlashDevelop using AIR SDK 3.2

asaia commented 11 years ago

After digging around a little I was actually able to get it working. I changed lines 31 and 32 of display.materials.StandardMaterial from this:

this.vertexShader = vertexShader || new StandardVertexShader(); this.fragmentShader = fragmentShader || new VertexColorFragmentShader();

to this:

this.vertexShader = vertexShader || IShader(new StandardVertexShader()); this.fragmentShader = fragmentShader || IShader(new VertexColorFragmentShader());

No idea why the latest AIR SDK in FlashBuilder couldn't implicitly cast these and an older SDK in flashdevelop could. Seems rather bizarre to me but this change is making it work with no problems now.

jonathanrpace commented 11 years ago

Very interesting . . . . and strange! My hunch is that the new ASC compiler is having a problem resolving dependencies that mxmlc didn't - maybe a circular dependency?

Hopefully this fix will work for most people in the meantime - I don't plan on merging it into the main branch ( I don't particularly want to introduce a potentially costly cast each time a material is created ).

Once the SDK is out of beta I'll give it another test - but for now I'm going to concentrate on other things.

Thanks Andy.

rivella50 commented 11 years ago

Works fine in my project now. Thank you Andy!

petetronic commented 11 years ago

Thanks guys, I believe this is the bug we've been tracking as #3331259 - the issue is that ASC 2 has to emit additional coerce instructions under certain circumstances to appease the runtime's verifier. Forcing these coercions with casts is a workaround, though we believe we have fixed this and will distribute it in ASC 2.0 Preview 4 due to appear on Adobe Labs very soon.

jonathanrpace commented 11 years ago

I can confirm this is now compiling and running correctly using release version of AIR 3.6 SDK