GPU: Fix crash when trying to postprocess surfaceless

This commit is contained in:
Stenzek 2023-12-31 19:40:45 +10:00
parent c57bd3c430
commit 12b9cf1898
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View file

@ -1716,8 +1716,10 @@ bool GPU::RenderDisplay(GPUTexture* target, const Common::Rectangle<s32>& draw_r
const GPUTexture::Format hdformat = target ? target->GetFormat() : g_gpu_device->GetWindowFormat();
const u32 target_width = target ? target->GetWidth() : g_gpu_device->GetWindowWidth();
const u32 target_height = target ? target->GetHeight() : g_gpu_device->GetWindowHeight();
const bool really_postfx = (postfx && HasDisplayTexture() && PostProcessing::IsActive() &&
PostProcessing::CheckTargets(hdformat, target_width, target_height));
const bool really_postfx =
(postfx && HasDisplayTexture() && PostProcessing::IsActive() && !g_gpu_device->GetWindowInfo().IsSurfaceless() &&
hdformat != GPUTexture::Format::Unknown && target_width > 0 && target_height > 0 &&
PostProcessing::CheckTargets(hdformat, target_width, target_height));
const Common::Rectangle<s32> real_draw_rect =
g_gpu_device->UsesLowerLeftOrigin() ? GPUDevice::FlipToLowerLeft(draw_rect, target_height) : draw_rect;
if (really_postfx)

View file

@ -681,6 +681,7 @@ bool PostProcessing::CheckTargets(GPUTexture::Format target_format, u32 target_w
!(s_output_texture = g_gpu_device->FetchTexture(target_width, target_height, 1, 1, 1,
GPUTexture::Type::RenderTarget, target_format)))
{
DestroyTextures();
return false;
}