我正在寻找估计Direct3D中的自由纹理内存的可能性,就像使用IDirect3DDevice9::GetAvailableTextureMem
一样,但到目前为止还没有找到任何东西。有什么建议吗?
答案 0 :(得分: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;
}