microsoft / angle

ANGLE: OpenGL ES to DirectX translation
Other
615 stars 166 forks source link

Sharing non RGB(A) textures. #114

Closed nimeshamin closed 7 years ago

nimeshamin commented 7 years ago

Is it possible to map an NV12 texture from D3D to GLES? I'm currently getting a failure from eglCreatePbufferFromClientBuffer of EGL_NO_SURFACE. Perhaps there are parameter checks that are blocking it?

Or is it recommended to convert all shared resources to RGBA first?

austinkinross commented 7 years ago

ANGLE has an extension that allows you to pass in a NV12 D3D texture:

https://github.com/Microsoft/angle/blob/ms-master/extensions/EGL_ANGLE_stream_producer_d3d_texture_nv12.txt

You may wish to look at the 'StreamProducerTextureNV12End2End' test in this file for example usage:

https://github.com/Microsoft/angle/blob/ms-master/src/tests/egl_tests/EGLStreamTest.cpp

I haven't tried using this extension myself, but I believe Chromium (Google Chrome) uses it successfully.

Hope this helps! Austin

nimeshamin commented 7 years ago

Looks like things work until attempting to actually post the texture. Is there a way to get verbose failure information?

austinkinross commented 7 years ago

If you've build ANGLE from source yourself, then you can put a breakpoint on Context::handleError in src/libANGLE/Context.cpp to catch GL errors. It looks like the equivalent place for EGL errors was moved recently in an upstream commit, but I think you'd want to put a breakpoint on Thread::getError() in src/libANGLE/thread.cpp

If you haven't built ANGLE yourself, then you may want to try using the GL_KHR_debug extension. Example usage can be seen here.

nimeshamin commented 7 years ago

Ahh, I was still using a separate Dx11Device from when I was using the SharedHandles route. By querying the device instead of creating a separate one resolves the failure to post.

Thanks for the help!