OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/config/gpu_info_collector.h" | 5 #include "gpu/config/gpu_info_collector.h" |
6 | 6 |
7 // This has to be included before windows.h. | 7 // This has to be included before windows.h. |
8 #include "third_party/re2/re2/re2.h" | 8 #include "third_party/re2/re2/re2.h" |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 base::MessageLoop::current()->PostDelayedTask( | 625 base::MessageLoop::current()->PostDelayedTask( |
626 FROM_HERE, | 626 FROM_HERE, |
627 base::Bind(&CollectD3D11Support), | 627 base::Bind(&CollectD3D11Support), |
628 base::TimeDelta::FromSeconds(45)); | 628 base::TimeDelta::FromSeconds(45)); |
629 } | 629 } |
630 } | 630 } |
631 | 631 |
632 return kCollectInfoSuccess; | 632 return kCollectInfoSuccess; |
633 } | 633 } |
634 | 634 |
| 635 namespace { |
| 636 static bool g_should_fallback_to_warp = false; |
| 637 } |
| 638 |
| 639 bool ShouldFallbackToWarp() { |
| 640 return g_should_fallback_to_warp; |
| 641 } |
| 642 |
| 643 void SetShouldFallbackToWarp(bool enable) { |
| 644 g_should_fallback_to_warp = enable; |
| 645 } |
| 646 |
635 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { | 647 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { |
636 TRACE_EVENT0("gpu", "CollectDriverInfoGL"); | 648 TRACE_EVENT0("gpu", "CollectDriverInfoGL"); |
637 | 649 |
638 if (!gpu_info->driver_version.empty()) | 650 if (!gpu_info->driver_version.empty()) |
639 return kCollectInfoSuccess; | 651 return kCollectInfoSuccess; |
640 | 652 |
641 bool parsed = RE2::PartialMatch( | 653 bool parsed = RE2::PartialMatch( |
642 gpu_info->gl_version, "([\\d\\.]+)$", &gpu_info->driver_version); | 654 gpu_info->gl_version, "([\\d\\.]+)$", &gpu_info->driver_version); |
643 return parsed ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; | 655 return parsed ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; |
644 } | 656 } |
645 | 657 |
646 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 658 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
647 const GPUInfo& context_gpu_info) { | 659 const GPUInfo& context_gpu_info) { |
648 DCHECK(basic_gpu_info); | 660 DCHECK(basic_gpu_info); |
649 | 661 |
650 if (context_gpu_info.software_rendering) { | 662 if (context_gpu_info.software_rendering) { |
651 basic_gpu_info->software_rendering = true; | 663 basic_gpu_info->software_rendering = true; |
652 return; | 664 return; |
653 } | 665 } |
654 | 666 |
655 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 667 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
656 | 668 |
657 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; | 669 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; |
658 } | 670 } |
659 | 671 |
660 } // namespace gpu | 672 } // namespace gpu |
OLD | NEW |