mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 04:22:50 +02:00
nwindowReleaseBuffers: cancel dequeued buffer instead of failing
This commit is contained in:
parent
3c851a3443
commit
7b4e02be35
@ -27,6 +27,19 @@ static Result _nwindowConnect(NWindow* nw)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Result _nwindowCancelBuffer(NWindow* nw, s32 slot, const NvMultiFence* fence)
|
||||||
|
{
|
||||||
|
static const NvMultiFence s_emptyFence = {0};
|
||||||
|
if (!fence)
|
||||||
|
fence = &s_emptyFence;
|
||||||
|
|
||||||
|
Result rc = bqCancelBuffer(&nw->bq, slot, fence);
|
||||||
|
if (R_SUCCEEDED(rc))
|
||||||
|
nw->cur_slot = -1;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
static Result _nwindowDisconnect(NWindow* nw)
|
static Result _nwindowDisconnect(NWindow* nw)
|
||||||
{
|
{
|
||||||
Result rc = bqDisconnect(&nw->bq, NATIVE_WINDOW_API_CPU);
|
Result rc = bqDisconnect(&nw->bq, NATIVE_WINDOW_API_CPU);
|
||||||
@ -267,13 +280,7 @@ Result nwindowCancelBuffer(NWindow* nw, s32 slot, const NvMultiFence* fence)
|
|||||||
return MAKERESULT(Module_Libnx, LibnxError_BadGfxQueueBuffer);
|
return MAKERESULT(Module_Libnx, LibnxError_BadGfxQueueBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const NvMultiFence s_emptyFence = {0};
|
Result rc = _nwindowCancelBuffer(nw, slot, fence);
|
||||||
if (!fence)
|
|
||||||
fence = &s_emptyFence;
|
|
||||||
|
|
||||||
Result rc = bqCancelBuffer(&nw->bq, slot, fence);
|
|
||||||
if (R_SUCCEEDED(rc))
|
|
||||||
nw->cur_slot = -1;
|
|
||||||
|
|
||||||
mutexUnlock(&nw->mutex);
|
mutexUnlock(&nw->mutex);
|
||||||
return rc;
|
return rc;
|
||||||
@ -323,8 +330,9 @@ Result nwindowReleaseBuffers(NWindow* nw)
|
|||||||
mutexLock(&nw->mutex);
|
mutexLock(&nw->mutex);
|
||||||
|
|
||||||
if (nw->cur_slot >= 0)
|
if (nw->cur_slot >= 0)
|
||||||
rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
rc = _nwindowCancelBuffer(nw, nw->cur_slot, NULL);
|
||||||
else if (nw->is_connected && nw->slots_configured)
|
|
||||||
|
if (R_SUCCEEDED(rc) && nw->is_connected && nw->slots_configured)
|
||||||
rc = _nwindowDisconnect(nw);
|
rc = _nwindowDisconnect(nw);
|
||||||
|
|
||||||
mutexUnlock(&nw->mutex);
|
mutexUnlock(&nw->mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user