Skip to content

Commit

Permalink
Fixed crash on device reset
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsharpoblunto committed May 13, 2023
1 parent 0348351 commit 5793091
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Matchstick/src/core/MGDFD3DAppFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ INT32 D3DAppFramework::Run() {
WaitForSingleObjectEx(_frameWaitableObject, 1000, true);
if (wait == WAIT_ABANDONED || wait == WAIT_TIMEOUT ||
wait == WAIT_FAILED) {
FATALERROR(this, "Failed to wait on FrameWaitableObject");
LOG("Failed to wait on FrameWaitableObject", MGDF_LOG_ERROR);
}
}

Expand Down
8 changes: 5 additions & 3 deletions Matchstick/src/core/core.impl/MGDFTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ HRESULT GPUPerformanceCounter::DoBegin(std::map<std::string, std::string> &tags,
desc.Query = D3D11_QUERY_TIMESTAMP;
desc.MiscFlags = 0;

if (FAILED(
_device->CreateQuery(&desc, _beginQueries.emplace().Assign())) ||
FAILED(_device->CreateQuery(&desc, _endQueries.emplace().Assign()))) {
if (!(SUCCEEDED(_device->CreateQuery(&desc,
_beginQueries.emplace().Assign())) &&
SUCCEEDED(
_device->CreateQuery(&desc, _endQueries.emplace().Assign())))) {
Reset();
LOG("Failed to create GPU timing queries", MGDF_LOG_ERROR);
return E_FAIL;
}
Expand Down

0 comments on commit 5793091

Please sign in to comment.