mirror of https://github.com/libsdl-org/SDL
parent
fa892d15b7
commit
1a13acac09
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
|
|
@ -965,8 +965,6 @@ static bool GPU_RenderPresent(SDL_Renderer *renderer)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GPUTextureFormat swapchain_fmt = SDL_GetGPUSwapchainTextureFormat(data->device, renderer->window);
|
SDL_GPUTextureFormat swapchain_fmt = SDL_GetGPUSwapchainTextureFormat(data->device, renderer->window);
|
||||||
|
|
||||||
if (swapchain_w != data->backbuffer.width || swapchain_h != data->backbuffer.height || swapchain_fmt != data->backbuffer.format) {
|
|
||||||
SDL_GPUBlitRegion src;
|
SDL_GPUBlitRegion src;
|
||||||
SDL_zero(src);
|
SDL_zero(src);
|
||||||
src.texture = data->backbuffer.texture;
|
src.texture = data->backbuffer.texture;
|
||||||
|
@ -980,20 +978,10 @@ static bool GPU_RenderPresent(SDL_Renderer *renderer)
|
||||||
dst.h = swapchain_h;
|
dst.h = swapchain_h;
|
||||||
|
|
||||||
SDL_BlitGPUTexture(data->state.command_buffer, &src, &dst, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, true);
|
SDL_BlitGPUTexture(data->state.command_buffer, &src, &dst, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, true);
|
||||||
|
|
||||||
|
if (swapchain_w != data->backbuffer.width || swapchain_h != data->backbuffer.height || swapchain_fmt != data->backbuffer.format) {
|
||||||
SDL_ReleaseGPUTexture(data->device, data->backbuffer.texture);
|
SDL_ReleaseGPUTexture(data->device, data->backbuffer.texture);
|
||||||
CreateBackbuffer(data, swapchain_w, swapchain_h, swapchain_fmt);
|
CreateBackbuffer(data, swapchain_w, swapchain_h, swapchain_fmt);
|
||||||
} else {
|
|
||||||
SDL_GPUTextureLocation src;
|
|
||||||
SDL_zero(src);
|
|
||||||
src.texture = data->backbuffer.texture;
|
|
||||||
|
|
||||||
SDL_GPUTextureLocation dst;
|
|
||||||
SDL_zero(dst);
|
|
||||||
dst.texture = swapchain;
|
|
||||||
|
|
||||||
SDL_GPUCopyPass *pass = SDL_BeginGPUCopyPass(data->state.command_buffer);
|
|
||||||
SDL_CopyGPUTextureToTexture(pass, &src, &dst, swapchain_w, swapchain_h, 1, true);
|
|
||||||
SDL_EndGPUCopyPass(pass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** FIXME ***
|
// *** FIXME ***
|
||||||
|
|
Loading…
Reference in New Issue