Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AngleWin32EglDisplay.WrapDirect3D11Texture is crashing #5455

Closed
Tape-Worm opened this issue Feb 9, 2021 · 2 comments
Closed

AngleWin32EglDisplay.WrapDirect3D11Texture is crashing #5455

Tape-Worm opened this issue Feb 9, 2021 · 2 comments
Labels

Comments

@Tape-Worm
Copy link

In my efforts for providing an interop layer between my graphics API and Avalonia I had need to use the AngleWin32EglDisplay.WrapDirect3D11Texture method.

Unfortunately, it appears to be failing. When I call it, I get this:
image

This is how I'm calling it:

IntPtr _d3dRtSharedHandle;
EglSurface _glSurface;

var platform = AvaloniaLocator.Current.GetService<IPlatformOpenGlInterface>();

_platform = (EglPlatformOpenGlInterface)platform;

_d3dRtSharedHandle = _target.Texture.GetSharedHandle(); // The shared handle IS working, I've confirmed this.

_glSurface = _angleDisplay.WrapDirect3D11Texture(_platform, _d3dRtSharedHandle);

I was able to work around it by calling AngleWin32EglDisplay.EglInterface.CreatePbufferFromClientBuffer (which the Wrap method seems to do as well, just has different parameters than what I've got here):

_angleDisplay.EglInterface.CreatePbufferFromClientBuffer(_angleDisplay.Handle, EglConsts.EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, _d3dRtSharedHandle, _angleDisplay.Config, new[]
            {
                    EglConsts.EGL_WIDTH, _target.Width,
                    EglConsts.EGL_HEIGHT, _target.Height,
                    EglConsts.EGL_TEXTURE_TARGET, EglConsts.EGL_TEXTURE_2D,
                    EglConsts.EGL_TEXTURE_FORMAT, EglConsts.EGL_TEXTURE_RGBA,
                    EglConsts.EGL_NONE
            })
@Tape-Worm Tape-Worm added the bug label Feb 9, 2021
@kekekeks
Copy link
Member

kekekeks commented Feb 9, 2021

WrapDirect3D11Texture wraps a texture not a DXGI handle. It expects ID3D11Texture2D pointer.

See ANGLE EGL extensions docs here for more details: https://github.com/google/angle/tree/master/extensions

@Tape-Worm
Copy link
Author

Ah, well, that explains that. My bad.

Might as well mark this as invalid and close it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants