Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / config / gpu_driver_bug_list.cc
blobb0d82eb7fcdebd472ffdea3f353fe4d28f62b522
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gpu/config/gpu_driver_bug_list.h"
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9 #include "gpu/config/gpu_driver_bug_workaround_type.h"
11 namespace gpu {
13 namespace {
15 struct GpuDriverBugWorkaroundInfo {
16 GpuDriverBugWorkaroundType type;
17 const char* name;
20 const GpuDriverBugWorkaroundInfo kFeatureList[] = {
21 #define GPU_OP(type, name) { type, #name },
22 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
23 #undef GPU_OP
26 } // namespace anonymous
28 GpuDriverBugList::GpuDriverBugList()
29 : GpuControlList() {
32 GpuDriverBugList::~GpuDriverBugList() {
35 // static
36 GpuDriverBugList* GpuDriverBugList::Create() {
37 GpuDriverBugList* list = new GpuDriverBugList();
39 DCHECK_EQ(static_cast<int>(arraysize(kFeatureList)),
40 NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES);
41 for (int i = 0; i < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES; ++i) {
42 list->AddSupportedFeature(kFeatureList[i].name,
43 kFeatureList[i].type);
45 return list;
48 std::string GpuDriverBugWorkaroundTypeToString(
49 GpuDriverBugWorkaroundType type) {
50 if (type < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES)
51 return kFeatureList[type].name;
52 else
53 return "unknown";
56 // static
57 void GpuDriverBugList::AppendWorkaroundsFromCommandLine(
58 std::set<int>* workarounds,
59 const base::CommandLine& command_line) {
60 DCHECK(workarounds);
61 for (int i = 0; i < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES; i++) {
62 if (!command_line.HasSwitch(kFeatureList[i].name))
63 continue;
64 // Removing conflicting workarounds.
65 switch (kFeatureList[i].type) {
66 case FORCE_DISCRETE_GPU:
67 workarounds->erase(FORCE_INTEGRATED_GPU);
68 workarounds->insert(FORCE_DISCRETE_GPU);
69 break;
70 case FORCE_INTEGRATED_GPU:
71 workarounds->erase(FORCE_DISCRETE_GPU);
72 workarounds->insert(FORCE_INTEGRATED_GPU);
73 break;
74 case MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512:
75 case MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024:
76 case MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096:
77 workarounds->erase(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512);
78 workarounds->erase(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024);
79 workarounds->erase(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096);
80 workarounds->insert(kFeatureList[i].type);
81 break;
82 default:
83 workarounds->insert(kFeatureList[i].type);
84 break;
89 } // namespace gpu