Discussion : Cocos2D-X/ANGLE for WinRT/WP8 ?

Hello,

I have recently found out than ANGLE (Almost Native Graphics Layer Engine), supports DirectX 11.
ANGLE is developed by Google as a WebGL provider for Chrome. It is a Khronos-compliant OpenGL ES 2.0 implementation built on the top of DirectX 9 or DirectX 11.

I think integrating it would be a smarter approach to bring Cocos2D-X to WinRT platforms, since it would save a lot of time abstracting/replacing all the OpenGL calls spread across the code.
However, this is not a 100% out of the box solution for the port, because of the following limitations :

  1. Feature level in ANGLE is 10 I think, while WP8 requires to target Feature 9.1. I think this should be not too much complicated to change however, and should still provide features to comply with OpenGL ES 2.0 specs.

  2. ANGLE is making use of D3DCOMPILE for runtime compilation of shaders (dynamically translating GLSL shaders to HLSL). So we would have to make static shaders and compile them at compile-time instead. I have seen this is what is done on Cocos2D-X wp8_v2 branch, so it should be okay.

  3. ANGLE needs to be modified to take care of C++/CX implementation to target WinRT runtime.

While this might look a big job, I think it would be a smart, clean and efficient way to merge WP8 ports into master/develop branch.

I am looking for core developers (and other developers too !) feedback on it.

Has anybody interest in exploring this ?

That sounds cool. I think I remember seeing a post from someone stating that cocos2d-x 3.0 will decouple the rendering from OpenGL, allowing easier support for things like DirectX. It might be worth getting in contact with some of the project owners directly and asking whether something like this would help? If that “decoupling” feature is still the aim then it’s worth starting the conversation at least…

Ben

ANGLE is good option, since it have support for GLES 2.0 and shaders [1], but there will be problems with ANGLE on winphone since it does not support runtime shaders compilation [2], and this feature used in ANGLE. Also note that Google cannot help with porting since they don’t think that windows phone is an operating system (and I personally agree with them). AFAIK current windows phone branch developed by Microsoft OpenSource center, so you can contact with port developers and discuss if ANGLE porting possible.

[1] http://stackoverflow.com/questions/13483179/can-i-use-opengl-es-in-a-windows-phone-8-app
[2] http://marmalade.cloud.answerhub.com/questions/458/use-opengl-es-on-windows-phone-8-is-it-20-.html

`Sergey

Thank you for your answer.

Regarding lack of runtime compile of shaders, I think we can find some workaround to it.
The windows phone branch itself of cocos2d-x compiles shaders statically.

What’s the easiest way to get contact with core Cocos2D-x developers on this matter ?
I can try to pitch the idea to Microsoft OpenSource center through my contacts.

Also, regardless of Windows Phone, since ANGLE provides both DX9 and DX11 backend, it could provide an interesting alternative on Win32 regular “desktop” platforms for people with crappy OpenGL drivers.

`Ben

Thanks, but regarding the high number of hardcoded GL code is Cocos2D-X, decoupling logic/rendering and abstracting the rendering pipeline is getting a HUGE job. I think it would be smarter to rely on GL->DX wrapper.