From 3482de514774a6e6fa03019ac4ed3ddb5eb5dd5a Mon Sep 17 00:00:00 2001 From: Cyd Date: Sat, 8 Aug 2026 19:55:52 -0500 Subject: [PATCH] The renderer stops when it cannot get a device PostQuitMessage is a message, not a return. The fallback CreateDevice posted one and then carried straight on into the Clear below it, so a machine that could not give us the mode we asked for dereferenced a device that was never created and died on an access violation instead of saying what had happened. The quit message it had just posted would not be read until someone pumped the queue, which by then nobody would. Both attempts are now judged once, and the line names the size that was REFUSED. That is the question this failure raises rather than an incidental detail: the back buffer is the requested size windowed as well as full-screen since the render target went back to being the size that was asked for, so a request the adapter will not meet is the first thing to look at. DPLRenderer: no D3D device for a 2560x1440 windowed back buffer (hr=0x8876086c) - giving up mDevice was also never in the initialiser list, so until CreateDevice wrote it the member held whatever was on the stack - and the mPrimaryIndex bail-out above has always returned through that into the destructor's SAFE_RELEASE. It is nulled before either exit can be taken. Found while reading the constructor for an unrelated crash, which turned out to be on another thread. This one is latent - no report of it yet - but it is the difference between a tester sending a dump and a tester sending a line that says what to fix. Co-Authored-By: Claude Opus 5 (1M context) --- MUNGA_L4/L4VIDEO.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/MUNGA_L4/L4VIDEO.cpp b/MUNGA_L4/L4VIDEO.cpp index 94aed2e..03aee1a 100644 --- a/MUNGA_L4/L4VIDEO.cpp +++ b/MUNGA_L4/L4VIDEO.cpp @@ -1746,6 +1746,15 @@ DPLRenderer::DPLRenderer( //} //DEBUG_STREAM<<"**************************"<CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &mPresentParams, &mDevice)); - if (FAILED(hr)) - { - PostQuitMessage(1); - } + } + + // + // PostQuitMessage is a message, not a return. The fallback used to + // post one and then carry straight on into the Clear below, which + // dereferenced a device that was never created - so a machine that + // could not give us the mode we asked for died on an access + // violation instead of saying so. + // + // What was asked for goes in the line, because that is the question + // this failure raises: the back buffer is the requested size now, + // windowed as well as full-screen, so a request the adapter will not + // meet is the thing to look at first. + // + if (FAILED(hr) || mDevice == NULL) + { + DEBUG_STREAM << "DPLRenderer: no D3D device for a " + << mPresentParams.BackBufferWidth << "x" + << mPresentParams.BackBufferHeight + << (mPresentParams.Windowed ? " windowed" : " full-screen") + << " back buffer (hr=0x" << std::hex << hr << std::dec + << ") - giving up\n" << std::flush; + PostQuitMessage(1); + return; } mDevice->Clear(0, NULL, D3DCLEAR_TARGET, 0xFF000000, 0.0f, 0);