1

我正在寻找一种可能性来估计 Direct3D 中的可用纹理内存,就像可以使用 一样IDirect3DDevice9::GetAvailableTextureMem,但到目前为止没有找到任何东西。有什么建议么?

4

1 回答 1

0

您可以使用此代码段:

int getAviableVideoMemoryInBytes(ID3D11Device* pd3dDevice)
{
    assert(pd3dDevice);

    IDXGIDevice * pDXGIDevice = nullptr;
    HRESULT hr = pd3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void **)&pDXGIDevice);

    if( FAILED(hr) )
    {
        std::cout << "Failed to query interface IDXGIDevice" << std::endl;
    }

    IDXGIAdapter * pDXGIAdapter = nullptr;
    pDXGIDevice->GetAdapter(&pDXGIAdapter);

    DXGI_ADAPTER_DESC adapterDesc;
    pDXGIAdapter->GetDesc(&adapterDesc);

    pDXGIDevice->Release();

    return adapterDesc.DedicatedVideoMemory;
}
于 2012-12-21T02:50:08.847 回答