Skip to content

Commit

Permalink
Fixed two samples that crashed when minimizing the window
Browse files Browse the repository at this point in the history
  • Loading branch information
stanard committed Sep 2, 2022
1 parent 1704d88 commit 1f7da32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Samples/Desktop/D3D12HDR/src/D3D12HDR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,15 @@ void D3D12HDR::OnWindowMoved(int xPos, int yPos)

void D3D12HDR::OnSizeChanged(UINT width, UINT height, bool minimized)
{
// Update the width, height, and aspect ratio member variables.
UpdateForSizeChange(width, height);
// Don't tear down or resize any resources if the window is just temporarily minimized
if (!minimized)
{
// Update the width, height, and aspect ratio member variables.
UpdateForSizeChange(width, height);

// Update the size of swapchain buffers.
UpdateSwapChainBuffer(width, height, GetBackBufferFormat());
// Update the size of swapchain buffers.
UpdateSwapChainBuffer(width, height, GetBackBufferFormat());
}

m_windowVisible = !minimized;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,10 @@ void D3D12SM6WaveIntrinsics::OnKeyDown(UINT8 key)

void D3D12SM6WaveIntrinsics::OnSizeChanged(UINT width, UINT height, bool minimized)
{
UNREFERENCED_PARAMETER(minimized);
// Don't tear down or resize any resources if the window is just temporarily minimized
if (minimized)
return;

UpdateForSizeChange(width, height);

if (!m_swapChain)
Expand Down

0 comments on commit 1f7da32

Please sign in to comment.