瀏覽代碼

Merge pull request #1052 from Areloch/GFXDeviceNullCheckFix

Adds a logical check for when we try and check for found adapters
Areloch 2 年之前
父節點
當前提交
ae108d0411
共有 1 個文件被更改,包括 18 次插入9 次删除
  1. 18 9
      Engine/source/gfx/gfxInit.cpp

+ 18 - 9
Engine/source/gfx/gfxInit.cpp

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