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

Side by Side Diff: gpu/command_buffer/service/shader_translator.cc

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 10 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/shader_translator.h" 5 #include "gpu/command_buffer/service/shader_translator.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/at_exit.h" 12 #include "base/at_exit.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "gpu/command_buffer/service/gpu_switches.h" 18 #include "gpu/command_buffer/service/gpu_preferences.h"
19 #include "ui/gl/gl_implementation.h" 19 #include "ui/gl/gl_implementation.h"
20 #include "ui/gl/gl_version_info.h" 20 #include "ui/gl/gl_version_info.h"
21 21
22 namespace gpu { 22 namespace gpu {
23 namespace gles2 { 23 namespace gles2 {
24 24
25 namespace { 25 namespace {
26 26
27 class ShaderTranslatorInitializer { 27 class ShaderTranslatorInitializer {
28 public: 28 public:
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 driver_bug_workarounds_ = driver_bug_workarounds; 188 driver_bug_workarounds_ = driver_bug_workarounds;
189 return compiler_ != NULL; 189 return compiler_ != NULL;
190 } 190 }
191 191
192 int ShaderTranslator::GetCompileOptions() const { 192 int ShaderTranslator::GetCompileOptions() const {
193 int compile_options = 193 int compile_options =
194 SH_OBJECT_CODE | SH_VARIABLES | SH_ENFORCE_PACKING_RESTRICTIONS | 194 SH_OBJECT_CODE | SH_VARIABLES | SH_ENFORCE_PACKING_RESTRICTIONS |
195 SH_LIMIT_EXPRESSION_COMPLEXITY | SH_LIMIT_CALL_STACK_DEPTH | 195 SH_LIMIT_EXPRESSION_COMPLEXITY | SH_LIMIT_CALL_STACK_DEPTH |
196 SH_CLAMP_INDIRECT_ARRAY_BOUNDS; 196 SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
197 197
198 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 198 if (GpuPreferences::GetInstance()->gl_shader_interm_output)
199 switches::kGLShaderIntermOutput))
200 compile_options |= SH_INTERMEDIATE_TREE; 199 compile_options |= SH_INTERMEDIATE_TREE;
201 200
202 compile_options |= driver_bug_workarounds_; 201 compile_options |= driver_bug_workarounds_;
203 202
204 return compile_options; 203 return compile_options;
205 } 204 }
206 205
207 bool ShaderTranslator::Translate(const std::string& shader_source, 206 bool ShaderTranslator::Translate(const std::string& shader_source,
208 std::string* info_log, 207 std::string* info_log,
209 std::string* translated_source, 208 std::string* translated_source,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 destruction_observers_, 274 destruction_observers_,
276 OnDestruct(this)); 275 OnDestruct(this));
277 276
278 if (compiler_ != NULL) 277 if (compiler_ != NULL)
279 ShDestruct(compiler_); 278 ShDestruct(compiler_);
280 } 279 }
281 280
282 } // namespace gles2 281 } // namespace gles2
283 } // namespace gpu 282 } // namespace gpu
284 283
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698