共用方式為


ID3D11On12Device::ReleaseWrappedResources 方法 (d3d11on12.h)

釋放已針對 D3D 11on12 包裝的 D3D11 資源。

語法

void ReleaseWrappedResources(
  [in] ID3D11Resource * const *ppResources,
       UINT           NumResources
);

參數

[in] ppResources

類型: ID3D11Resource*

指定由 ID3D11Resource 定義的一組 D3D11資源的指標。

NumResources

類型: UINT

資源數目的計數。

傳回值

備註

在呼叫 Flush 之前呼叫這個方法,將資源屏障插入適當的「out」狀態,並標示它們應該處於「in」狀態。 如果未提供任何資源清單,則會轉換所有包裝的資源。 在呼叫 ID3D11On12Device::AcquireWrappedResources 之前,這些資源會在危險追蹤中標示為「未取得」。

無法將索引鍵的 Mutex 資源提供給此方法;請改用 IDXGIKeyedMutex::ReleaseSync

範例

透過 11On12 裝置使用 D2D 透過 D3D12 轉譯文字。

// Render text over D3D12 using D2D via the 11On12 device.
void D3D1211on12::RenderUI()
{
    D2D1_SIZE_F rtSize = m_d2dRenderTargets[m_frameIndex]->GetSize();
    D2D1_RECT_F textRect = D2D1::RectF(0, 0, rtSize.width, rtSize.height);
    static const WCHAR text[] = L"11On12";

    // Acquire our wrapped render target resource for the current back buffer.
    m_d3d11On12Device->AcquireWrappedResources(m_wrappedBackBuffers[m_frameIndex].GetAddressOf(), 1);

    // Render text directly to the back buffer.
    m_d2dDeviceContext->SetTarget(m_d2dRenderTargets[m_frameIndex].Get());
    m_d2dDeviceContext->BeginDraw();
    m_d2dDeviceContext->SetTransform(D2D1::Matrix3x2F::Identity());
    m_d2dDeviceContext->DrawTextW(
        text,
        _countof(text) - 1,
        m_textFormat.Get(),
        &textRect,
        m_textBrush.Get()
        );
    ThrowIfFailed(m_d2dDeviceContext->EndDraw());

    // Release our wrapped render target resource. Releasing 
    // transitions the back buffer resource to the state specified
    // as the OutState when the wrapped resource was created.
    m_d3d11On12Device->ReleaseWrappedResources(m_wrappedBackBuffers[m_frameIndex].GetAddressOf(), 1);

    // Flush to submit the 11 command list to the shared command queue.
    m_d3d11DeviceContext->Flush();
}

請參閱 D3D12 參考中的範例程式碼

需求

   
目標平台 Windows
標頭 d3d11on12.h
程式庫 D3D11.lib
Dll D3D11.dll

另請參閱

ID3D11On12Device