Merge pull request #1052 from Areloch/GFXDeviceNullCheckFix

Adds a logical check for when we try and check for found adapters
This commit is contained in:
Areloch 2023-07-17 21:55:01 -05:00 committed by GitHub
commit ae108d0411
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -333,17 +333,26 @@ GFXAdapter *GFXInit::getBestAdapterChoice()
} }
} }
// Return best found in order DX11, GL if (renderer.equal("NullDevice", String::NoCase) == false)
if (foundAdapter11) {
return foundAdapter11; // Return best found in order DX11, GL
if (foundAdapter11)
return foundAdapter11;
if (foundAdapterGL) if (foundAdapterGL)
return foundAdapterGL; return foundAdapterGL;
// Uh oh - we didn't find anything. Grab whatever we can that's not Null... // Uh oh - we didn't find anything. Grab whatever we can that's not Null...
for(S32 i=0; i<smAdapters.size(); i++) for (S32 i = 0; i < smAdapters.size(); i++)
if(smAdapters[i]->mType != NullDevice) if (smAdapters[i]->mType != NullDevice)
return smAdapters[i]; return smAdapters[i];
}
else
{
for (S32 i = 0; i < smAdapters.size(); i++)
if (smAdapters[i]->mType == NullDevice)
return smAdapters[i];
}
// Dare we return a null device? No. Just return NULL. // Dare we return a null device? No. Just return NULL.
return NULL; return NULL;