IDirect3DDevice 인터페이스

정의

IDXGIDevice를 나타내며 IDXGIDevice 참조를 교환해야 하는 Windows 런타임 구성 요소 간에 상호 운용하는 데 사용할 수 있습니다.

public interface class IDirect3DDevice : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(2742428843, 36191, 18000, 157, 62, 158, 174, 61, 155, 198, 112)]
struct IDirect3DDevice : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(2742428843, 36191, 18000, 157, 62, 158, 174, 61, 155, 198, 112)]
public interface IDirect3DDevice : System.IDisposable
Public Interface IDirect3DDevice
Implements IDisposable
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

// Create a new Windows Console Application (C++/WinRT) project, and
// replace the contents of `pch.h` and `main.cpp` source code files with the code below.
// Be aware that the code below omits the details of obtaining a WinRT Direct3DDevice in
// the first segment of code, and obtaining a native DirectX device in the second segment.
// The code shows only how to perform the conversion between the two.

// pch.h
#pragma once
#include <d3d11_4.h>
#include <Windows.Graphics.DirectX.Direct3D11.interop.h>
#include <unknwn.h>

#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Graphics.DirectX.Direct3D11.h>

// main.cpp
#include "pch.h"
int main()
{
    winrt::init_apartment();

    // To get the native DirectX device that is wrapped by a Direct3DDevice.

    winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice d3dDevice /* = ... */;
    winrt::com_ptr<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess> dxgiInterfaceAccess{
        d3dDevice.as<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess>()
    };
    winrt::com_ptr<::IDXGIDevice> nativeDevice;
    winrt::check_hresult(dxgiInterfaceAccess->GetInterface(
        __uuidof(nativeDevice),
        nativeDevice.put_void()));

    // To create a new Direct3DDevice object wrapping a native DirectX device.

    winrt::com_ptr<::IDXGIDevice> nativeDevice2 /* = ... */;
    winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice d3dDevice2{ nullptr };
    winrt::check_hresult(::CreateDirect3D11DeviceFromDXGIDevice(
        nativeDevice2.get(),
        reinterpret_cast<::IInspectable**>(winrt::put_abi(d3dDevice2))));
}
// First include the necessary headers and namespaces.
#include <Windows.Graphics.DirectX.Direct3D11.interop.h>
#include <dxgi.h>

using namespace Windows::Graphics::DirectX::Direct3D11;
using namespace Microsoft::WRL;

// To get the native DirectX device that is wrapped by a Direct3DDevice.

IDirect3DDevice^ d3dDevice = ...;  
ComPtr<IDXGIDevice> nativeDevice;

HRESULT hr = GetDXGIInterface(d3dDevice, nativeDevice.GetAddressOf());

// To create a new Direct3DDevice object wrapping a native DirectX device.

ComPtr<IDXGIDevice> nativeDevice = ...;
IDirect3DDevice^ winRTDevice = CreateDirect3DDevice(nativeDevice.Get());

설명

C++/WinRT를 사용하는 경우 IDirect3DDeviceIDXGIDevice 간에 앞뒤로 이동하려면 IDirect3DdxgiInterfaceAccess::GetInterfaceCreateDirect3D11DeviceFromDXGIDevice 함수를 사용합니다. DirectX 및 Direct2D와의 컴퍼지션 네이티브 상호 운용에서 다른 코드 예제를 볼 수 있습니다.

C++/CX를 사용하는 경우 IDirect3DDeviceIDXGIDevice 간에 앞뒤로 이동하려면 CreateDirect3DDeviceGetDXGIInterface(IDirect3DDevice^, DXGI_TYPE**) 함수를 사용합니다.

메서드

Dispose()

관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 애플리케이션 정의 작업을 수행합니다.

Trim()

앱을 대신하여 그래픽 디바이스에서 할당한 모든 그래픽 메모리를 트리밍합니다.

적용 대상

추가 정보