-1

Microsoft Docs doesn't give the example, I try to obtained from ID3D12Device, But Failed: https://paste.ubuntu.com/p/7c5tKm9YZH/

DGAF
  • 71
  • 7

1 Answers1

4

You obtain the ID3D12VideoDevice interface from your ID3D12Device instance.

HRESULT hr = pD3D12Device->QueryInterface(IID_PPV_ARGS((void**)&pD3D12VideoDevice));
if (FAILED(hr))
{
    // Driver or Windows doesn't support DirectX 12 Video.
}

or if you are using the Microsoft::WRL::ComPtr smart-pointer:

using Microsoft::WRL::ComPtr;


ComPtr<ID3D12Device> pDevice;

// Create the Direct3D 12 device using D3D12CreateDevice


ComPtr<ID3D12DeviceVideo> pVideoDevice;
HRESULT hr = pDevice->As(&pVideoDevice);
if (FAILED(hr))
{
    // Driver or Windows doesn't support DirectX 12 Video.
}

For details on creating as ID3D12Device, see this blog post.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81