1

我在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++;
}

请在这里帮助我。谢谢

4

0 回答 0