Share via


Metodo ID3D11On12Device::ReleaseWrappedResources (d3d11on12.h)

Rilascia le risorse D3D11 di cui è stato eseguito il wrapping per D3D 11on12.

Sintassi

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

Parametri

[in] ppResources

Tipo: ID3D11Resource*

Specifica un puntatore a un set di risorse D3D11, definito da ID3D11Resource.

NumResources

Tipo: UINT

Conteggio del numero di risorse.

Valore restituito

nessuno

Osservazioni

Chiamare questo metodo prima di chiamare Flush per inserire barriere di risorse allo stato "out" appropriato e contrassegnare che devono quindi essere nello stato "in". Se non viene specificato alcun elenco di risorse, viene eseguita la transizione di tutte le risorse di cui è stato eseguito il wrapping. Queste risorse verranno contrassegnate come "non acquisite" nel rilevamento dei rischi finché non viene chiamato ID3D11On12Device::AcquireWrappedResources .

Le risorse mutex con chiave non possono essere fornite a questo metodo; usare invece IDXGIKeyedMutex::ReleaseSync .

Esempio

Eseguire il rendering del testo su D3D12 usando D2D tramite il dispositivo 11On12.

// 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();
}

Fare riferimento al codice di esempio nel riferimento D3D12.

Requisiti

   
Piattaforma di destinazione Windows
Intestazione d3d11on12.h
Libreria D3D11.lib
DLL D3D11.dll

Vedi anche

ID3D11On12Device