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) <noreply@anthropic.com>
This commit is contained in:
+33
-4
@@ -1746,6 +1746,15 @@ DPLRenderer::DPLRenderer(
|
||||
//}
|
||||
//DEBUG_STREAM<<"**************************"<<std::endl<<"**************************"<<std::endl<<std::flush;
|
||||
|
||||
//
|
||||
// NULL before anything can leave this constructor early. It was not
|
||||
// in the initialiser list, so until CreateDevice wrote it the member
|
||||
// held whatever was on the stack - and the bail-out below it, plus
|
||||
// the one that has always been here, both run the destructor and its
|
||||
// SAFE_RELEASE(mDevice) over exactly that.
|
||||
//
|
||||
mDevice = NULL;
|
||||
|
||||
if (mPrimaryIndex == NULL)
|
||||
{
|
||||
DEBUG_STREAM<<"Unable to locate a suitable primary device index."<<std::endl<<std::flush;
|
||||
@@ -1759,10 +1768,30 @@ DPLRenderer::DPLRenderer(
|
||||
DEBUG_STREAM<<"Couldn't create HARDWARE_VERTEXPROCESSING device."<<std::endl<<std::flush;
|
||||
|
||||
V(gD3D->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);
|
||||
|
||||
Reference in New Issue
Block a user