简体   繁体   中英

Resizing DirectX Window Efficiently

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.

There is an msdn article which explains what you need to do. Have you read that?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM