2

I am trying to find the best way to resize a graphics interface. I tried just re-initializing the device without deleting my buffers of shapes I made, but I ended up mem-leaking heavly.

I did not find anything useful on this subject.

Do I need to delete everything [buffers, devices, adapters] & restart the graphics interface from scratch? Or is there an efficient way of doing it?

This is for a DX 10/11 interface.

Edit: It is a lot of code to show, but I simply:

   cleanup(); // Pointers related to the device
   initDevice(hWnd); // Create new device with updated size
   draw(stuff); // I never deleted my constant/index/vertex buffers

To be specific, I did not delete these:

    ID3D11Buffer* constantBuffer;
    ID3D11Buffer* vertexBuffer;
    ID3D11Buffer* indexBuffer;
    ID3D11VertexShader* vertexShader;
    ID3D11PixelShader* pixelShader;
    ID3D11InputLayout* vertexLayout;

I was hoping to save performance by not recreating the graphics every moment the user is resizing.

4

1 回答 1

8

有一篇docs.microsoft.com 文章解释了您需要做什么。你读过吗?

于 2012-10-10T07:38:08.887 回答