Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential fix for memory leak when resizing a display when using the D3D12 backend #827

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

FelixK15
Copy link
Contributor

@FelixK15 FelixK15 commented Nov 27, 2023

Changed how render targets are acquired/created in the d3d12 backend to fix #810

I'm pretty sure the source of the memory leak was a double created render target in the original code.
First the render target was created using CreateCommittedResource() and then, at the end of render_target_init(), the render_target->impl.renderTarget ptr was overwritten by either

render_target->impl.renderTarget = swapChainRenderTargets[framebuffer_index];

or

swapChain->GetBuffer(framebuffer_index, IID_PPV_ARGS(&render_target->impl.renderTarget));

This fix was only added after a visual inspection and has only been validated with the Input test. More thorough testing is definitely needed to validate correctness.

@RobDangerous
Copy link
Member

Indeed, renderTarget was assigned twice. Super thanks!

@RobDangerous RobDangerous merged commit 64a03df into Kode:main Dec 6, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Direct3D12] Memory leak on window resize
2 participants