Skip to content

WPFDXInterop with DirectX 12 (it throws exception on m_d3dDevice11on12->OpenSharedResource call #34

@MartynSloss

Description

@MartynSloss

## I can use DirectX 12 to write to a D3D11Image on a number of Windows 10 machines using a D3D11On12CreateDevice dx11 device.

{
..
IUnknown pUnk = (IUnknown)pResource;
IDXGIResource * pDXGIResource;
ID3D11Resource * pDx11Resource;
HANDLE sharedHandle;
ID3D11Resource * tempResource11;
ID3D11Texture2D * pOutputResource;
D3D11_RENDER_TARGET_VIEW_DESC rtDesc;
rtDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
rtDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtDesc.Texture2D.MipSlice = 0;

pUnk->QueryInterface(__uuidof(IDXGIResource), (void**)&pDXGIResource);
pUnk->QueryInterface(__uuidof(ID3D11Resource), (void**)&pDx11Resource);
pDXGIResource->GetSharedHandle(&sharedHandle)))return hr;
m_d3dDevice11on12->OpenSharedResource(sharedHandle, __uuidof(ID3D11Resource), (void**)(&tempResource11));
tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)(&pOutputResource));
m_d3dDevice11on12->CreateRenderTargetView(pOutputResource, &rtDesc, &m_pRenderTargetView1);

pDXGIResource->Release();
tempResource11->Release();
...
}

## However as soon as I enable debugging

ComPtr debugController;
D3D12GetDebugInterface(IID_PPV_ARGS(debugController.GetAddressOf());
debugController->EnableDebugLayer();

I get the following error (exception thrown)

D3D12 ERROR: ID3D12CompatibilityDevice::ReflectSharedProperties: Resource provided was not shared by D3D11, or with a D3D11 desc. [ MISCELLANEOUS ERROR #916: REFLECTSHAREDPROPERTIES_INVALIDOBJECT]

Anyone have any idea what I am doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions