Skip to content

Commit 1f7da32

Browse files
committed
Fixed two samples that crashed when minimizing the window
1 parent 1704d88 commit 1f7da32

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Samples/Desktop/D3D12HDR/src/D3D12HDR.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,15 @@ void D3D12HDR::OnWindowMoved(int xPos, int yPos)
750750

751751
void D3D12HDR::OnSizeChanged(UINT width, UINT height, bool minimized)
752752
{
753-
// Update the width, height, and aspect ratio member variables.
754-
UpdateForSizeChange(width, height);
753+
// Don't tear down or resize any resources if the window is just temporarily minimized
754+
if (!minimized)
755+
{
756+
// Update the width, height, and aspect ratio member variables.
757+
UpdateForSizeChange(width, height);
755758

756-
// Update the size of swapchain buffers.
757-
UpdateSwapChainBuffer(width, height, GetBackBufferFormat());
759+
// Update the size of swapchain buffers.
760+
UpdateSwapChainBuffer(width, height, GetBackBufferFormat());
761+
}
758762

759763
m_windowVisible = !minimized;
760764
}

Samples/Desktop/D3D12SM6WaveIntrinsics/src/D3D12SM6WaveIntrinsics.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,10 @@ void D3D12SM6WaveIntrinsics::OnKeyDown(UINT8 key)
809809

810810
void D3D12SM6WaveIntrinsics::OnSizeChanged(UINT width, UINT height, bool minimized)
811811
{
812-
UNREFERENCED_PARAMETER(minimized);
812+
// Don't tear down or resize any resources if the window is just temporarily minimized
813+
if (minimized)
814+
return;
815+
813816
UpdateForSizeChange(width, height);
814817

815818
if (!m_swapChain)

0 commit comments

Comments
 (0)