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

Side by Side Diff: gpu/command_buffer/service/feature_info.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: 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
OLDNEW
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/command_buffer/service/feature_info.h" 5 #include "gpu/command_buffer/service/feature_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 const std::set<std::string>& GetImpl() { 75 const std::set<std::string>& GetImpl() {
76 return string_set_; 76 return string_set_;
77 } 77 }
78 78
79 private: 79 private:
80 std::set<std::string> string_set_; 80 std::set<std::string> string_set_;
81 }; 81 };
82 82
83 // Process a string of wordaround type IDs (seperated by ',') and set up
84 // the corresponding Workaround flags.
85 void StringToWorkarounds(
86 const std::string& types, FeatureInfo::Workarounds* workarounds) {
87 DCHECK(workarounds);
88 for (const base::StringPiece& piece :
89 base::SplitStringPiece(
90 types, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
91 int number = 0;
92 bool succeed = base::StringToInt(piece, &number);
93 DCHECK(succeed);
94 switch (number) {
95 #define GPU_OP(type, name) \
96 case gpu::type: \
97 workarounds->name = true; \
98 break;
99 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
100 #undef GPU_OP
101 default:
102 NOTIMPLEMENTED();
103 }
104 }
105 if (workarounds->max_texture_size_limit_4096)
106 workarounds->max_texture_size = 4096;
107 if (workarounds->max_cube_map_texture_size_limit_4096)
108 workarounds->max_cube_map_texture_size = 4096;
109 if (workarounds->max_cube_map_texture_size_limit_1024)
110 workarounds->max_cube_map_texture_size = 1024;
111 if (workarounds->max_cube_map_texture_size_limit_512)
112 workarounds->max_cube_map_texture_size = 512;
113
114 if (workarounds->max_fragment_uniform_vectors_32)
115 workarounds->max_fragment_uniform_vectors = 32;
116 if (workarounds->max_varying_vectors_16)
117 workarounds->max_varying_vectors = 16;
118 if (workarounds->max_vertex_uniform_vectors_256)
119 workarounds->max_vertex_uniform_vectors = 256;
120
121 if (workarounds->max_copy_texture_chromium_size_1048576)
122 workarounds->max_copy_texture_chromium_size = 1048576;
123 if (workarounds->max_copy_texture_chromium_size_262144)
124 workarounds->max_copy_texture_chromium_size = 262144;
125 }
126
127 } // anonymous namespace. 83 } // anonymous namespace.
128 84
129 FeatureInfo::FeatureFlags::FeatureFlags() 85 FeatureInfo::FeatureFlags::FeatureFlags()
130 : chromium_framebuffer_multisample(false), 86 : chromium_framebuffer_multisample(false),
131 chromium_sync_query(false), 87 chromium_sync_query(false),
132 use_core_framebuffer_multisample(false), 88 use_core_framebuffer_multisample(false),
133 multisampled_render_to_texture(false), 89 multisampled_render_to_texture(false),
134 use_img_for_multisampled_render_to_texture(false), 90 use_img_for_multisampled_render_to_texture(false),
135 chromium_screen_space_antialiasing(false), 91 chromium_screen_space_antialiasing(false),
136 oes_standard_derivatives(false), 92 oes_standard_derivatives(false),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ext_texture_rg(false), 130 ext_texture_rg(false),
175 chromium_image_ycbcr_420v(false), 131 chromium_image_ycbcr_420v(false),
176 chromium_image_ycbcr_422(false), 132 chromium_image_ycbcr_422(false),
177 enable_subscribe_uniform(false), 133 enable_subscribe_uniform(false),
178 emulate_primitive_restart_fixed_index(false), 134 emulate_primitive_restart_fixed_index(false),
179 ext_render_buffer_format_bgra8888(false), 135 ext_render_buffer_format_bgra8888(false),
180 ext_multisample_compatibility(false), 136 ext_multisample_compatibility(false),
181 ext_blend_func_extended(false), 137 ext_blend_func_extended(false),
182 ext_read_format_bgra(false) {} 138 ext_read_format_bgra(false) {}
183 139
184 FeatureInfo::Workarounds::Workarounds() : 140 FeatureInfo::FeatureInfo(
185 #define GPU_OP(type, name) name(false), 141 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds)
186 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) 142 : workarounds_(gpu_driver_bug_workarounds) {
187 #undef GPU_OP
188 max_texture_size(0),
189 max_cube_map_texture_size(0),
190 max_fragment_uniform_vectors(0),
191 max_varying_vectors(0),
192 max_vertex_uniform_vectors(0),
193 max_copy_texture_chromium_size(0) {
194 }
195
196 FeatureInfo::FeatureInfo() {
197 InitializeBasicState(base::CommandLine::InitializedForCurrentProcess() 143 InitializeBasicState(base::CommandLine::InitializedForCurrentProcess()
198 ? base::CommandLine::ForCurrentProcess() 144 ? base::CommandLine::ForCurrentProcess()
199 : nullptr); 145 : nullptr);
200 } 146 }
201 147
202 FeatureInfo::FeatureInfo(const base::CommandLine& command_line) { 148 FeatureInfo::FeatureInfo(
149 const base::CommandLine& command_line,
150 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds)
151 : workarounds_(gpu_driver_bug_workarounds) {
203 InitializeBasicState(&command_line); 152 InitializeBasicState(&command_line);
204 } 153 }
205 154
206 void FeatureInfo::InitializeBasicState(const base::CommandLine* command_line) { 155 void FeatureInfo::InitializeBasicState(const base::CommandLine* command_line) {
207 if (!command_line) 156 if (!command_line)
208 return; 157 return;
209 158
210 if (command_line->HasSwitch(switches::kGpuDriverBugWorkarounds)) {
211 std::string types = command_line->GetSwitchValueASCII(
212 switches::kGpuDriverBugWorkarounds);
213 StringToWorkarounds(types, &workarounds_);
214 }
215 feature_flags_.enable_shader_name_hashing = 159 feature_flags_.enable_shader_name_hashing =
216 !command_line->HasSwitch(switches::kDisableShaderNameHashing); 160 !command_line->HasSwitch(switches::kDisableShaderNameHashing);
217 161
218 feature_flags_.is_swiftshader = 162 feature_flags_.is_swiftshader =
219 (command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"); 163 (command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader");
220 164
221 feature_flags_.enable_subscribe_uniform = 165 feature_flags_.enable_subscribe_uniform =
222 command_line->HasSwitch(switches::kEnableSubscribeUniformExtension); 166 command_line->HasSwitch(switches::kEnableSubscribeUniformExtension);
223 167
224 enable_unsafe_es3_apis_switch_ = 168 enable_unsafe_es3_apis_switch_ =
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 if (pos == std::string::npos) { 1368 if (pos == std::string::npos) {
1425 extensions_ += (extensions_.empty() ? "" : " ") + str; 1369 extensions_ += (extensions_.empty() ? "" : " ") + str;
1426 } 1370 }
1427 } 1371 }
1428 1372
1429 FeatureInfo::~FeatureInfo() { 1373 FeatureInfo::~FeatureInfo() {
1430 } 1374 }
1431 1375
1432 } // namespace gles2 1376 } // namespace gles2
1433 } // namespace gpu 1377 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698