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?
Asked
Active
Viewed 936 times
1

Christoph
- 1,964
- 2
- 27
- 44
1 Answers
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
-
1OK, I did not know about this method. However, as I understand, this will give me the totally available memory not an estimate about how much is currently free, right? – Christoph Jan 03 '13 at 16:38
-
Right. It determines the totally available memory and not the currently free memory. – Vertexwahn Jan 04 '13 at 11:56
-
Do you know whether the latter is possible, too? – Christoph Jan 09 '13 at 13:05
-
No. I did some research about this myself, but I could not found any solution. – Vertexwahn Jan 09 '13 at 20:19