Skip to content

Commit

Permalink
Ignoring "occluded" return code
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfatbrowncat committed Feb 7, 2024
1 parent df4a397 commit 5bc3a2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class Base {
// Crash if hr != S_OK.
static void hr_check(HRESULT hr)
{
if (hr == S_OK) return;
// Ignore the "occluded" state as a success
if (hr == DXGI_STATUS_OCCLUDED) return;

if (hr == S_OK) return;
while (true) __debugbreak();
}
};
6 changes: 3 additions & 3 deletions D3D11Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ D3DContext::D3DContext(): deviceContext(nullptr), swapChain(nullptr) {
}

void D3DContext::reposition(const RECT& position) {
unsigned int width = position.right - position.left;
unsigned int height = position.bottom - position.top;
int width = position.right - position.left;
int height = position.bottom - position.top;

lookForIntelOutput(position);

Expand All @@ -190,7 +190,7 @@ void D3DContext::reposition(const RECT& position) {

syncIntelOutput();

// Discard outstanding queued presents and queue a frame with the new size ASAP.
// Discard outstanding queued presents and queue a frame with the new size ASAP.
hr_check(swapChain->Present(0, DXGI_PRESENT_RESTART));
//Sleep(500);
// Wait for a vblank to really make sure our frame with the new size is ready before
Expand Down
4 changes: 2 additions & 2 deletions D3D12Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ D3DContext::D3DContext(): swapChain(nullptr), descriptorHeap(nullptr) {
}

void D3DContext::reposition(const RECT& position) {
unsigned int width = position.right - position.left;
unsigned int height = position.bottom - position.top;
int width = position.right - position.left;
int height = position.bottom - position.top;

lookForIntelOutput(position);

Expand Down

0 comments on commit 5bc3a2f

Please sign in to comment.