Closed MobWiMetro closed 5 years ago
I double checked the link you are referring to and I see OpenGL ES calls in the snippets.
Step 2 walks you through how to create a shared surface and interop with gl textures. Look for calls like eglCreatePbufferFromClientBuffer( ), glGenTextures, etc. I am not sure we have an official shipping/compilable sample that demonstrates this interop, but these steps attempt to guide you.
Which parts of the interop are not clear?
It mentions there is a sample burned text that uses the Win2D and ANGLE, but I found it doesn't use ANGLE.
The guiding steps in the link is ok, but I need to create a id3ddevice to create the texture. I know ANGLE will creat a device too. Won't there be any issues to create two devices?
发自我的 iPhone
在 2016年5月16日,下午11:27,Cooper Partin notifications@github.com 写道:
I double checked the link you are referring to and I see OpenGL ES calls in the snippets.
Step 2 walks you through how to create a shared surface and interop with gl textures. Look for calls like eglCreatePbufferFromClientBuffer( ), glGenTextures, etc. I am not sure we have an official shipping/compilable sample that demonstrates this interop, but these steps attempt to guide you.
Which parts of the interop are not clear?
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub
No, there won't be any issues- creating multiple D3D devices and sharing data between them is fully supported in D3D11. This is what the 'D3D11_RESOURCE_MISC_SHARED' flag is for. :-)
The code in the Wiki article you linked to works by creating one D3D device for Win2D and one within ANGLE. It then creates a D3D texture for Win2D with the D3D11_RESOURCE_MISC_SHARED flag, and passes the texture into ANGLE (via some OpenGL ES extension methods) to create a GL texture wrapping the same resource in GPU memory. You can think of this as shared memory between Win2D and ANGLE- if Win2D draws onto the texture then ANGLE's texture will automatically update, and vice-versa.
From your description in the first post though, using XAML may be a better approach for you. You could put a SwapChainPanel as your background and use ANGLE to draw into it (see our XAML templates for example code). You could then place other XAML content on top and use other graphics libraries to draw into them (e.g. Win2D).
I prefer to use D3D to draw those virtual controls for code reuse. Is it ok to render to the same
SwapChainPanel using D3D meanwhile rendering to it using ANGLE?
�������� iPhone
�� 2016��5��18��������1:00��Austin Kinross notifications@github.com ������
SwapChainPanel
Yes, although you won't be able to render directly onto the same SwapChainPanel with ANGLE and another D3D device. Instead, you'll need to:
Should I set the context using eglmakeCurrent and do the swap using eglSwapBuffers after drawing? Is it all normal procedure to do the EGL part?
It there's a sample, that'd better.
Yes, you should continue to use EGL as normal.
This technique is just a way of creating a GL texture wrapping another D3D device's texture. After you've created that GL texture, you should treat it in the same way you would treat any other GL texture, and continue to make standard GL/EGL API calls.
I'm afraid we don't have a sample available to share. There is some code in this test that may be useful for you though: https://github.com/MSOpenTech/angle/blob/f139cb11b0049bbb5b8c7989ff476d7f37856c21/src/tests/egl_tests/EGLPresentPathD3D11Test.cpp.
The strange part is eglCreatePbufferFromClientBuffer works well on x64 but returns null on ARM. Is there any difference in implementation between x64 and ARM?
What ARM hardware are you running on? Is it a phone that originally shipped with Windows Phone 8.0 or 8.1 on it?
Are you able to try compiling ANGLE yourself with the following lines of code commented out? I suspect this will fix your issue:
// Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
{
mSupportsShareHandles = false;
return false;
}
https://github.com/Microsoft/angle/blob/ms-master/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
It's Lumia 822 running on Windows 10 Mobile.
I commented out that code and rebuilt the library, though still failed.
在 2016年6月28日,上午12:25,Austin Kinross notifications@github.com 写道:
What ARM hardware are you running on? Is it a phone that originally shipped with Windows Phone 8.0 or 8.1 on it?
Are you able to try compiling ANGLE yourself with the following lines of code commented out? I suspect this will fix your issue:
// Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains. if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3) { mSupportsShareHandles = false; return false; }
https://github.com/Microsoft/angle/blob/ms-master/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Does it mean phone with feature level 9_3 can't use shared handle?
发自我的 iPhone
在 2016年6月28日,上午5:02,mobwi@outlook.com 写道:
It's Lumia 822 running on Windows 10 Mobile.
发自我的 iPhone
在 2016年6月28日,上午12:25,Austin Kinross notifications@github.com 写道:
What ARM hardware are you running on? Is it a phone that originally shipped with Windows Phone 8.0 or 8.1 on it?
Are you able to try compiling ANGLE yourself with the following lines of code commented out? I suspect this will fix your issue:
// Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains. if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3) { mSupportsShareHandles = false; return false; }
https://github.com/Microsoft/angle/blob/ms-master/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Does interop only supports EGL_TEXTURE_RGBA?
eglCreatePbufferFromClientBuffer only supports EGL_TEXTURE_RGBA and EGL_TEXTURE_RGB.
See ValidateCreatePbufferFromClientBuffer() in validationEGL.cpp:
case EGL_TEXTURE_FORMAT:
switch (value)
{
case EGL_NO_TEXTURE:
case EGL_TEXTURE_RGB:
case EGL_TEXTURE_RGBA:
break;
default:
return Error(EGL_BAD_ATTRIBUTE);
}
break;
What does that mean? I tried with both but failed.
Most phones doesn't support 10_0, which means shared handle can't be used on most phones.
在 2016年7月1日,上午2:17,Austin Kinross notifications@github.com 写道:
eglCreatePbufferFromClientBuffer only supports EGL_TEXTURE_RGBA and EGL_TEXTURE_RGB.
See ValidateCreatePbufferFromClientBuffer() in validationEGL.cpp:
case EGL_TEXTURE_FORMAT: switch (value) { case EGL_NO_TEXTURE: case EGL_TEXTURE_RGB: case EGL_TEXTURE_RGBA: break; default: return Error(EGL_BAD_ATTRIBUTE); } break; — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
@MobWiMetro I am trying to achieve the same thing and I get null for calls to eglCreatePbufferFromClientBuffer
no matter what.
Did you manage to find a fix?
Hi, any working example of this? im following all the suggestions and topics and nothing shows on my screen, I can post my code here if its permitted or host on github. But all I am doing is following the sample code from interop wiki page and some basic egl initialization.
Hi everyone, apologies for the delayed reply here.
If you are still having trouble then please consider contacting the master ANGLE repository's mailing list: https://groups.google.com/forum/#!forum/angleproject
Thanks Austin
I know it's mentioned here https://github.com/MSOpenTech/angle/wiki/Interop-with-other-DirectX-code#demo. But ANGLE doesn't exist in the code at all.
I want to draw several virtual control images on a background that's drawn by ANGLE OpenGL ES. I prefer to use Direct3D for some code reuse or Direct2D/Win2D if Direct3D is not available. Is there any sample I can reference?