mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-05 21:38:18 +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
|
||||
GX2Flush();
|
||||
|
||||
void
|
||||
GX2ResetGPU(uint32_t unknown);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -64,6 +64,9 @@ sTvContextState = NULL;
|
||||
static GX2ContextState *
|
||||
sDrcContextState = NULL;
|
||||
|
||||
static BOOL
|
||||
sGpuTimedOut = FALSE;
|
||||
|
||||
static void *
|
||||
GfxGX2RAlloc(GX2RResourceFlags flags,
|
||||
uint32_t size,
|
||||
@ -426,6 +429,11 @@ error:
|
||||
void
|
||||
WHBGfxShutdown()
|
||||
{
|
||||
if (sGpuTimedOut) {
|
||||
GX2ResetGPU(0);
|
||||
sGpuTimedOut = FALSE;
|
||||
}
|
||||
|
||||
GfxProcCallbackReleased(NULL);
|
||||
GX2Shutdown();
|
||||
|
||||
@ -452,14 +460,24 @@ WHBGfxBeginRender()
|
||||
{
|
||||
uint32_t swapCount, flipCount;
|
||||
OSTime lastFlip, lastVsync;
|
||||
uint32_t waitCount = 0;
|
||||
|
||||
while (true) {
|
||||
GX2WaitForVsync();
|
||||
GX2GetSwapStatus(&swapCount, &flipCount, &lastFlip, &lastVsync);
|
||||
|
||||
if (flipCount >= swapCount) {
|
||||
sGpuTimedOut = FALSE;
|
||||
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(GX2Init);
|
||||
EXPORT(GX2Shutdown);
|
||||
EXPORT(GX2ResetGPU);
|
||||
|
||||
// gx2/shader.h
|
||||
EXPORT(GX2CalcGeometryShaderInputRingBufferSize);
|
||||
|
Loading…
Reference in New Issue
Block a user