| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 62 | 62 | 
| 63   return true; | 63   return true; | 
| 64 } | 64 } | 
| 65 | 65 | 
| 66 // static | 66 // static | 
| 67 std::vector<D3dDevice> D3dDevice::EnumDevices() { | 67 std::vector<D3dDevice> D3dDevice::EnumDevices() { | 
| 68   ComPtr<IDXGIFactory1> factory; | 68   ComPtr<IDXGIFactory1> factory; | 
| 69   _com_error error = CreateDXGIFactory1(__uuidof(IDXGIFactory1), | 69   _com_error error = CreateDXGIFactory1(__uuidof(IDXGIFactory1), | 
| 70       reinterpret_cast<void**>(factory.GetAddressOf())); | 70       reinterpret_cast<void**>(factory.GetAddressOf())); | 
| 71   if (error.Error() != S_OK || !factory) { | 71   if (error.Error() != S_OK || !factory) { | 
|  | 72     LOG(LS_WARNING) << "Cannot create IDXGIFactory1."; | 
| 72     return std::vector<D3dDevice>(); | 73     return std::vector<D3dDevice>(); | 
| 73   } | 74   } | 
| 74 | 75 | 
| 75   std::vector<D3dDevice> result; | 76   std::vector<D3dDevice> result; | 
| 76   for (int i = 0;; i++) { | 77   for (int i = 0;; i++) { | 
| 77     ComPtr<IDXGIAdapter> adapter; | 78     ComPtr<IDXGIAdapter> adapter; | 
| 78     error = factory->EnumAdapters(i, adapter.GetAddressOf()); | 79     error = factory->EnumAdapters(i, adapter.GetAddressOf()); | 
| 79     if (error.Error() == S_OK) { | 80     if (error.Error() == S_OK) { | 
| 80       D3dDevice device; | 81       D3dDevice device; | 
| 81       if (!device.Initialize(adapter)) { | 82       if (device.Initialize(adapter)) { | 
| 82         return std::vector<D3dDevice>(); | 83         result.push_back(std::move(device)); | 
| 83       } | 84       } | 
| 84       result.push_back(std::move(device)); |  | 
| 85     } else if (error.Error() == DXGI_ERROR_NOT_FOUND) { | 85     } else if (error.Error() == DXGI_ERROR_NOT_FOUND) { | 
| 86       break; | 86       break; | 
| 87     } else { | 87     } else { | 
| 88       LOG(LS_WARNING) << "IDXGIFactory1::EnumAdapters returns an unexpected " | 88       LOG(LS_WARNING) << "IDXGIFactory1::EnumAdapters returns an unexpected " | 
| 89                          "error " | 89                          "error " | 
| 90                       << error.ErrorMessage() << " with code " << error.Error(); | 90                       << error.ErrorMessage() << " with code " << error.Error(); | 
| 91       return std::vector<D3dDevice>(); |  | 
| 92     } | 91     } | 
| 93   } | 92   } | 
| 94   return result; | 93   return result; | 
| 95 } | 94 } | 
| 96 | 95 | 
| 97 }  // namespace webrtc | 96 }  // namespace webrtc | 
| OLD | NEW | 
|---|