tests: Fix GPU tests crashing when window is minimized
This commit is contained in:
parent
c9e22d4672
commit
0f9e86fe1c
2 changed files with 25 additions and 14 deletions
|
@ -87,6 +87,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
||||||
return SDL_APP_FAILURE;
|
return SDL_APP_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (swapchainTexture != NULL) {
|
||||||
const double currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency();
|
const double currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency();
|
||||||
SDL_GPURenderPass *renderPass;
|
SDL_GPURenderPass *renderPass;
|
||||||
SDL_GPUColorTargetInfo color_target_info;
|
SDL_GPUColorTargetInfo color_target_info;
|
||||||
|
@ -103,6 +104,10 @@ SDL_AppResult SDL_AppIterate(void *appstate)
|
||||||
SDL_EndGPURenderPass(renderPass);
|
SDL_EndGPURenderPass(renderPass);
|
||||||
|
|
||||||
SDL_SubmitGPUCommandBuffer(cmdbuf);
|
SDL_SubmitGPUCommandBuffer(cmdbuf);
|
||||||
|
} else {
|
||||||
|
/* Swapchain is unavailable, cancel work */
|
||||||
|
SDL_CancelGPUCommandBuffer(cmdbuf);
|
||||||
|
}
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
|
|
|
@ -346,6 +346,12 @@ Render(SDL_Window *window, const int windownum)
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (swapchainTexture == NULL) {
|
||||||
|
/* Swapchain is unavailable, cancel work */
|
||||||
|
SDL_CancelGPUCommandBuffer(cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do some rotation with Euler angles. It is not a fixed axis as
|
* Do some rotation with Euler angles. It is not a fixed axis as
|
||||||
* quaternions would be, but the effect is cool.
|
* quaternions would be, but the effect is cool.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue