From e58648d592f834b4b6f93b25684eae619aa77ae9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 21 Oct 2025 12:59:31 -0700
Subject: [PATCH] Removed call to ID3D11DeviceContext1_DiscardView() (thanks
@pipiwoaini!)
This is unnecessary and can cause issues after a resize or device removal.
Fixes https://github.com/libsdl-org/SDL/issues/14283
---
src/render/direct3d11/SDL_render_d3d11.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c
index 71467dc0906e7..dd46fcf0b33d0 100644
--- a/src/render/direct3d11/SDL_render_d3d11.c
+++ b/src/render/direct3d11/SDL_render_d3d11.c
@@ -2790,12 +2790,6 @@ static bool D3D11_RenderPresent(SDL_Renderer *renderer)
*/
result = IDXGISwapChain1_Present1(data->swapChain, data->syncInterval, data->presentFlags, ¶meters);
- /* Discard the contents of the render target.
- * This is a valid operation only when the existing contents will be entirely
- * overwritten. If dirty or scroll rects are used, this call should be removed.
- */
- ID3D11DeviceContext1_DiscardView(data->d3dContext, (ID3D11View *)data->mainRenderTargetView);
-
// When the present flips, it unbinds the current view, so bind it again on the next draw call
data->currentRenderTargetView = NULL;