mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-13 07:03:54 +00:00
Send SDL_EVENT_WINDOW_EXPOSED when the GPU renderer swap chain is resized
In this case the current frame being rendered doesn't match the swapchain size and the application should re-render the frame.
Fixes https://github.com/libsdl-org/SDL/issues/15550
(cherry picked from commit 2b0df96f25)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#ifdef SDL_VIDEO_RENDER_GPU
|
||||
|
||||
#include "../../events/SDL_windowevents_c.h"
|
||||
#include "../../video/SDL_pixels_c.h"
|
||||
#include "../SDL_d3dmath.h"
|
||||
#include "../SDL_sysrender.h"
|
||||
@@ -1501,6 +1502,9 @@ static bool GPU_RenderPresent(SDL_Renderer *renderer)
|
||||
|
||||
if (swapchain_texture_width != data->backbuffer.width || swapchain_texture_height != data->backbuffer.height) {
|
||||
CreateBackbuffer(data, swapchain_texture_width, swapchain_texture_height, SDL_GetGPUSwapchainTextureFormat(data->device, renderer->window));
|
||||
|
||||
// Notify the application that it needs to redraw this frame
|
||||
SDL_SendWindowEvent(renderer->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||
}
|
||||
} else {
|
||||
SDL_SubmitGPUCommandBuffer(data->state.command_buffer);
|
||||
|
||||
Reference in New Issue
Block a user