add null-checks on software render path

This commit is contained in:
celerizer
2026-04-07 11:05:50 -05:00
parent 909148f554
commit 72bd0fa4d3
2 changed files with 23 additions and 13 deletions
+5 -3
View File
@@ -76,9 +76,11 @@ public:
GPUDebugBuffer buf;
u16 w = NATIVEWIDTH;
u16 h = NATIVEHEIGHT;
gpuDebug->GetOutputFramebuffer(buf);
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buf, w, h);
memcpy(soft_bmp, pixels.data(), SOFT_BMP_SIZE);
if (gpuDebug) {
gpuDebug->GetOutputFramebuffer(buf);
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buf, w, h);
memcpy(soft_bmp, pixels.data(), SOFT_BMP_SIZE);
}
u32 offset = g_Config.bDisplayCropTo16x9 ? w << 1 : 0;
h -= g_Config.bDisplayCropTo16x9 ? 2 : 0;
video_cb(soft_bmp + offset, w, h, w << 2);
+18 -10
View File
@@ -1356,8 +1356,9 @@ namespace Libretro
static void EmuFrame()
{
ctx->SetRenderTarget();
if (ctx->GetDrawContext()) {
ctx->GetDrawContext()->BeginFrame(Draw::DebugFlags::NONE);
Draw::DrawContext *draw = ctx->GetDrawContext();
if (draw) {
draw->BeginFrame(Draw::DebugFlags::NONE);
}
const DisplayLayoutConfig &displayLayoutConfig = g_Config.GetDisplayLayoutConfig(g_display.GetDeviceOrientation());
@@ -1379,21 +1380,24 @@ namespace Libretro
if (gpu) {
gpu->EndHostFrame();
gpu->PrepareCopyDisplayToOutput(displayLayoutConfig);
if (draw) {
gpu->PrepareCopyDisplayToOutput(displayLayoutConfig);
}
}
// gotta do the backbuffer bind somewhere.
using namespace Draw;
ctx->GetDrawContext()->BindFramebufferAsRenderTarget(nullptr, {RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR}, "BackBuffer");
if (draw) {
draw->BindFramebufferAsRenderTarget(nullptr, {RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR}, "BackBuffer");
}
if (gpu) {
if (gpu && draw) {
gpu->CopyDisplayToOutput(displayLayoutConfig);
}
if (ctx->GetDrawContext()) {
ctx->GetDrawContext()->EndFrame();
ctx->GetDrawContext()->Present(Draw::PresentMode::FIFO);
if (draw) {
draw->EndFrame();
draw->Present(Draw::PresentMode::FIFO);
}
}
@@ -1427,7 +1431,11 @@ namespace Libretro
void EmuThreadStart()
{
bool wasPaused = emuThreadState == EmuThreadState::PAUSED;
EmuThreadState state = emuThreadState;
if (state == EmuThreadState::RUNNING || state == EmuThreadState::START_REQUESTED || emuThread.joinable())
return;
bool wasPaused = state == EmuThreadState::PAUSED;
emuThreadState = EmuThreadState::START_REQUESTED;
if (!wasPaused)