mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-07 11:58:13 +01:00
whb: Handle GPU hangs by resetting the GPU on shutdown.
So your application will exit cleanly even when you break the GPU.
This commit is contained in:
parent
2c18b246ae
commit
ee9bd49c34
@ -21,6 +21,9 @@ GX2Shutdown();
|
|||||||
void
|
void
|
||||||
GX2Flush();
|
GX2Flush();
|
||||||
|
|
||||||
|
void
|
||||||
|
GX2ResetGPU(uint32_t unknown);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,6 +64,9 @@ sTvContextState = NULL;
|
|||||||
static GX2ContextState *
|
static GX2ContextState *
|
||||||
sDrcContextState = NULL;
|
sDrcContextState = NULL;
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
sGpuTimedOut = FALSE;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
GfxGX2RAlloc(GX2RResourceFlags flags,
|
GfxGX2RAlloc(GX2RResourceFlags flags,
|
||||||
uint32_t size,
|
uint32_t size,
|
||||||
@ -426,6 +429,11 @@ error:
|
|||||||
void
|
void
|
||||||
WHBGfxShutdown()
|
WHBGfxShutdown()
|
||||||
{
|
{
|
||||||
|
if (sGpuTimedOut) {
|
||||||
|
GX2ResetGPU(0);
|
||||||
|
sGpuTimedOut = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
GfxProcCallbackReleased(NULL);
|
GfxProcCallbackReleased(NULL);
|
||||||
GX2Shutdown();
|
GX2Shutdown();
|
||||||
|
|
||||||
@ -452,14 +460,24 @@ WHBGfxBeginRender()
|
|||||||
{
|
{
|
||||||
uint32_t swapCount, flipCount;
|
uint32_t swapCount, flipCount;
|
||||||
OSTime lastFlip, lastVsync;
|
OSTime lastFlip, lastVsync;
|
||||||
|
uint32_t waitCount = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
GX2WaitForVsync();
|
|
||||||
GX2GetSwapStatus(&swapCount, &flipCount, &lastFlip, &lastVsync);
|
GX2GetSwapStatus(&swapCount, &flipCount, &lastFlip, &lastVsync);
|
||||||
|
|
||||||
if (flipCount >= swapCount) {
|
if (flipCount >= swapCount) {
|
||||||
|
sGpuTimedOut = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (waitCount >= 10) {
|
||||||
|
WHBLogPrint("WHBGfxBeginRender wait for swap timed out");
|
||||||
|
sGpuTimedOut = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
waitCount++;
|
||||||
|
GX2WaitForVsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ EXPORT(GX2InitSamplerZMFilter);
|
|||||||
EXPORT(GX2Flush);
|
EXPORT(GX2Flush);
|
||||||
EXPORT(GX2Init);
|
EXPORT(GX2Init);
|
||||||
EXPORT(GX2Shutdown);
|
EXPORT(GX2Shutdown);
|
||||||
|
EXPORT(GX2ResetGPU);
|
||||||
|
|
||||||
// gx2/shader.h
|
// gx2/shader.h
|
||||||
EXPORT(GX2CalcGeometryShaderInputRingBufferSize);
|
EXPORT(GX2CalcGeometryShaderInputRingBufferSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user