HolographicCameraRenderingParameters.CommitDirect3D11DepthBuffer 方法

定義

提供此畫面的深度緩衝區至全像顯示管線,讓畫面的深度防震相對於使用者的頭部動作。

public:
 virtual void CommitDirect3D11DepthBuffer(IDirect3DSurface ^ value) = CommitDirect3D11DepthBuffer;
void CommitDirect3D11DepthBuffer(IDirect3DSurface const& value);
public void CommitDirect3D11DepthBuffer(IDirect3DSurface value);
function commitDirect3D11DepthBuffer(value)
Public Sub CommitDirect3D11DepthBuffer (value As IDirect3DSurface)

參數

value
IDirect3DSurface

包含應用程式深度緩衝區的 Direct3D 11 表面。

Windows 需求

裝置系列
Windows 10 Creators Update (已於 10.0.15063.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v4.0 引進)

備註

如果應用程式提供框架的深度緩衝區,然後略過呼叫 SetFocusPoint,則會根據深度緩衝區推斷焦點和一般。 您的應用程式通常會藉由認可精確的深度緩衝區來達到最佳視覺品質,其圖元可以使用您附近的和遠方平面對應回公尺,然後再呼叫 SetFocusPoint。

此方法會使用您提供給 HolographicSpace 的 Direct3D 裝置。 如果您已在裝置上指定D3D11_CREATE_DEVICE_SINGLETHREADED旗標,請務必從單一 Direct3D 執行緒呼叫此方法,以避免未定義的行為。

下列程式碼範例示範如何將深度緩衝區資源從原生ID3D11Texture2D轉換為可傳遞至CommitDirect3D11DepthBuffer的 WinRT IDirect3DSurface介面。 ID3D11Texture2D必須使用系統讀取的D3D11_BIND_SHADER_RESOURCE來建立。

inline winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface CreateDepthTextureInteropObject(
        const Microsoft::WRL::ComPtr<ID3D11Texture2D> spTexture2D)
{
    // Direct3D interop APIs are used to provide the buffer to the WinRT API.
    Microsoft::WRL::ComPtr<IDXGIResource1> depthStencilResource;
    winrt::check_hresult(spTexture2D.As(&depthStencilResource));
    Microsoft::WRL::ComPtr<IDXGISurface2> depthDxgiSurface;
    winrt::check_hresult(depthStencilResource->CreateSubresourceSurface(0, &depthDxgiSurface));
    winrt::com_ptr<::IInspectable> inspectableSurface;
    winrt::check_hresult(
        CreateDirect3D11SurfaceFromDXGISurface(
            depthDxgiSurface.Get(),
            reinterpret_cast<IInspectable**>(winrt::put_abi(inspectableSurface))
        ));

    return inspectableSurface.as<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface>();
}

本範例中顯示的CreateDepthTextureInteropObject方法包含在Windows Mixed Reality 應用程式範本中。

適用於