mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-08 21:33:57 +00:00
[c-host] dxgi: add more robust error handling on cursor shape failure
Closes #264 - Credit to https://github.com/DataBeaver
This commit is contained in:
parent
75bc038144
commit
3538e7f6f4
2 changed files with 31 additions and 18 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
B1-169-g7018a3e737+1
|
||||
B1-170-g75bc038144+1
|
|
@ -644,6 +644,25 @@ static unsigned int dxgi_getMaxFrameSize()
|
|||
return this->height * this->pitch;
|
||||
}
|
||||
|
||||
static CaptureResult dxgi_hResultToCaptureResult(const HRESULT status)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
case S_OK:
|
||||
return CAPTURE_RESULT_OK;
|
||||
|
||||
case DXGI_ERROR_WAIT_TIMEOUT:
|
||||
return CAPTURE_RESULT_TIMEOUT;
|
||||
|
||||
case WAIT_ABANDONED:
|
||||
case DXGI_ERROR_ACCESS_LOST:
|
||||
return CAPTURE_RESULT_REINIT;
|
||||
|
||||
default:
|
||||
return CAPTURE_RESULT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static CaptureResult dxgi_capture()
|
||||
{
|
||||
assert(this);
|
||||
|
@ -669,24 +688,16 @@ static CaptureResult dxgi_capture()
|
|||
else
|
||||
status = IDXGIOutputDuplication_AcquireNextFrame(this->dup, 1000, &frameInfo, &res);
|
||||
|
||||
switch(status)
|
||||
result = dxgi_hResultToCaptureResult(status);
|
||||
if (result != CAPTURE_RESULT_OK)
|
||||
{
|
||||
case S_OK:
|
||||
this->needsRelease = true;
|
||||
break;
|
||||
|
||||
case DXGI_ERROR_WAIT_TIMEOUT:
|
||||
return CAPTURE_RESULT_TIMEOUT;
|
||||
|
||||
case WAIT_ABANDONED:
|
||||
case DXGI_ERROR_ACCESS_LOST:
|
||||
return CAPTURE_RESULT_REINIT;
|
||||
|
||||
default:
|
||||
if (result == CAPTURE_RESULT_ERROR)
|
||||
DEBUG_WINERROR("AcquireNextFrame failed", status);
|
||||
return CAPTURE_RESULT_ERROR;
|
||||
return result;
|
||||
}
|
||||
|
||||
this->needsRelease = true;
|
||||
|
||||
if (frameInfo.LastPresentTime.QuadPart != 0)
|
||||
{
|
||||
tex = &this->texture[this->texWIndex];
|
||||
|
@ -768,10 +779,12 @@ static CaptureResult dxgi_capture()
|
|||
DXGI_OUTDUPL_POINTER_SHAPE_INFO shapeInfo;
|
||||
|
||||
LOCKED({status = IDXGIOutputDuplication_GetFramePointerShape(this->dup, bufferSize, pointerShape, &pointerShapeSize, &shapeInfo);});
|
||||
if (FAILED(status))
|
||||
result = dxgi_hResultToCaptureResult(status);
|
||||
if (result != CAPTURE_RESULT_OK)
|
||||
{
|
||||
DEBUG_WINERROR("Failed to get the new pointer shape", status);
|
||||
return CAPTURE_RESULT_ERROR;
|
||||
if (result == CAPTURE_RESULT_ERROR)
|
||||
DEBUG_WINERROR("Failed to get the new pointer shape", status);
|
||||
return result;
|
||||
}
|
||||
|
||||
switch(shapeInfo.Type)
|
||||
|
|
Loading…
Reference in a new issue