| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/service_utils.h" | 5 #include "gpu/command_buffer/service/service_utils.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 8 #include "gpu/command_buffer/service/gpu_preferences.h" | 9 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 10 #include "ui/gl/gl_switches.h" |
| 9 | 11 |
| 10 namespace gpu { | 12 namespace gpu { |
| 11 namespace gles2 { | 13 namespace gles2 { |
| 12 | 14 |
| 13 gl::GLContextAttribs GenerateGLContextAttribs( | 15 gl::GLContextAttribs GenerateGLContextAttribs( |
| 14 const ContextCreationAttribHelper& attribs_helper, | 16 const ContextCreationAttribHelper& attribs_helper, |
| 15 const GpuPreferences& gpu_preferences) { | 17 const GpuPreferences& gpu_preferences) { |
| 16 gl::GLContextAttribs attribs; | 18 gl::GLContextAttribs attribs; |
| 17 attribs.gpu_preference = attribs_helper.gpu_preference; | 19 attribs.gpu_preference = attribs_helper.gpu_preference; |
| 18 if (gpu_preferences.use_passthrough_cmd_decoder) { | 20 if (gpu_preferences.use_passthrough_cmd_decoder) { |
| 19 attribs.bind_generates_resource = attribs_helper.bind_generates_resource; | 21 attribs.bind_generates_resource = attribs_helper.bind_generates_resource; |
| 20 attribs.webgl_compatibility_context = | 22 attribs.webgl_compatibility_context = |
| 21 IsWebGLContextType(attribs_helper.context_type); | 23 IsWebGLContextType(attribs_helper.context_type); |
| 24 |
| 25 // Always use the global texture share group for the passthrough command |
| 26 // decoder |
| 27 attribs.global_texture_share_group = true; |
| 28 |
| 29 // Request a specific context version instead of always 3.0 |
| 30 if (IsWebGL2OrES3ContextType(attribs_helper.context_type)) { |
| 31 attribs.client_major_es_version = 3; |
| 32 attribs.client_minor_es_version = 0; |
| 33 } else { |
| 34 DCHECK(IsWebGL1OrES2ContextType(attribs_helper.context_type)); |
| 35 attribs.client_major_es_version = 2; |
| 36 attribs.client_minor_es_version = 0; |
| 37 } |
| 38 } else { |
| 39 attribs.client_major_es_version = 3; |
| 40 attribs.client_minor_es_version = 0; |
| 22 } | 41 } |
| 42 |
| 43 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kDisableES3GLContext)) { |
| 45 // Forcefully disable ES3 contexts |
| 46 attribs.client_major_es_version = 2; |
| 47 attribs.client_minor_es_version = 0; |
| 48 } |
| 49 |
| 23 return attribs; | 50 return attribs; |
| 24 } | 51 } |
| 25 | 52 |
| 26 } // namespace gles2 | 53 } // namespace gles2 |
| 27 } // namespace gpu | 54 } // namespace gpu |
| OLD | NEW |