Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 768
Nyaarium Avatar asked May 19 '26 04:05

Nyaarium


1 Answers

There is a learn.microsoft.com article which explains what you need to do. Have you read that?

like image 140
jcoder Avatar answered May 20 '26 17:05

jcoder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!