我正在while循环中创建一个3d纹理,仅用于实验。虽然我最后没有忘记释放它,但是在300次循环后导致OUT_OF_MEMORY错误。
我的代码是:
int cntr = 0;
while(1)
{
ID3D11Texture3D* pTex3D = NULL;
D3D11_TEXTURE3D_DESC desc;
desc.Width = 256;
desc.Height = 256;
desc.Depth = 20;
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
desc.Usage = D3D11_USAGE_DEFAULT ;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS ;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
HRESULT hr = g_pd3dDevice->CreateTexture3D(&desc, NULL, &pTex3D);
SAFE_RELEASE( pTex3D );
Sleep(10);
if( hr != S_OK )
printf("");
cntr++;
}
请在这里帮助我。感谢