Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: gpu/config/gpu_driver_bug_workarounds.cc

Issue 1871613002: Compute GpuDriverBugWorkarounds only one time in the GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/config/gpu_driver_bug_workarounds.h ('k') | gpu/gles2_conform_support/egl/display.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #include "gpu/config/gpu_driver_bug_workarounds.h"
6
7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h"
10 #include "gpu/config/gpu_switches.h"
11
12 namespace {
13 // Process a string of wordaround type IDs (seperated by ',') and set up
14 // the corresponding Workaround flags.
15 void StringToWorkarounds(const std::string& types,
16 gpu::GpuDriverBugWorkarounds* workarounds) {
17 DCHECK(workarounds);
18 for (const base::StringPiece& piece : base::SplitStringPiece(
19 types, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
20 int number = 0;
21 bool succeed = base::StringToInt(piece, &number);
22 DCHECK(succeed);
23 switch (number) {
24 #define GPU_OP(type, name) \
25 case gpu::type: \
26 workarounds->name = true; \
27 break;
28 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
29 #undef GPU_OP
30 default:
31 NOTIMPLEMENTED();
32 }
33 }
34 if (workarounds->max_texture_size_limit_4096)
35 workarounds->max_texture_size = 4096;
36 if (workarounds->max_cube_map_texture_size_limit_4096)
37 workarounds->max_cube_map_texture_size = 4096;
38 if (workarounds->max_cube_map_texture_size_limit_1024)
39 workarounds->max_cube_map_texture_size = 1024;
40 if (workarounds->max_cube_map_texture_size_limit_512)
41 workarounds->max_cube_map_texture_size = 512;
42
43 if (workarounds->max_fragment_uniform_vectors_32)
44 workarounds->max_fragment_uniform_vectors = 32;
45 if (workarounds->max_varying_vectors_16)
46 workarounds->max_varying_vectors = 16;
47 if (workarounds->max_vertex_uniform_vectors_256)
48 workarounds->max_vertex_uniform_vectors = 256;
49
50 if (workarounds->max_copy_texture_chromium_size_1048576)
51 workarounds->max_copy_texture_chromium_size = 1048576;
52 if (workarounds->max_copy_texture_chromium_size_262144)
53 workarounds->max_copy_texture_chromium_size = 262144;
54 }
55
56 } // anonymous namespace
57
58 namespace gpu {
59
60 GpuDriverBugWorkarounds::GpuDriverBugWorkarounds()
61 :
62 #define GPU_OP(type, name) name(false),
63 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
64 #undef GPU_OP
65 max_texture_size(0),
66 max_cube_map_texture_size(0),
67 max_fragment_uniform_vectors(0),
68 max_varying_vectors(0),
69 max_vertex_uniform_vectors(0),
70 max_copy_texture_chromium_size(0) {
71 }
72
73 GpuDriverBugWorkarounds::GpuDriverBugWorkarounds(
74 const base::CommandLine* command_line)
75 :
76 #define GPU_OP(type, name) name(false),
77 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
78 #undef GPU_OP
79 max_texture_size(0),
80 max_cube_map_texture_size(0),
81 max_fragment_uniform_vectors(0),
82 max_varying_vectors(0),
83 max_vertex_uniform_vectors(0),
84 max_copy_texture_chromium_size(0) {
85 if (!command_line)
86 return;
87
88 std::string types =
89 command_line->GetSwitchValueASCII(switches::kGpuDriverBugWorkarounds);
90 StringToWorkarounds(types, this);
91 }
92
93 GpuDriverBugWorkarounds::GpuDriverBugWorkarounds(
94 const GpuDriverBugWorkarounds& other) = default;
95
96 GpuDriverBugWorkarounds::~GpuDriverBugWorkarounds() {}
97
98 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/config/gpu_driver_bug_workarounds.h ('k') | gpu/gles2_conform_support/egl/display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698