1

I am looking for a possibility to get an estimation of the free texture memory in Direct3D, like it was possible using IDirect3DDevice9::GetAvailableTextureMem, but did not find anything so far. Any suggestions?

Christoph
  • 1,964
  • 2
  • 27
  • 44

1 Answers1

0

you can use this code snippet:

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;
}
Vertexwahn
  • 7,709
  • 6
  • 64
  • 90