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

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

Issue 1052153002: Use the desktop GL core profile on Linux when ES3 support is requested. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added link to bug in TODO. Created 5 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/command_buffer/service/shader_translator.h ('k') | gpu/config/gpu_info_collector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string.h> 7 #include <string.h>
8 #include <GLES2/gl2.h> 8 #include <GLES2/gl2.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ShCompileOptions driver_bug_workarounds) { 110 ShCompileOptions driver_bug_workarounds) {
111 // Make sure Init is called only once. 111 // Make sure Init is called only once.
112 DCHECK(compiler_ == NULL); 112 DCHECK(compiler_ == NULL);
113 DCHECK(shader_type == GL_FRAGMENT_SHADER || shader_type == GL_VERTEX_SHADER); 113 DCHECK(shader_type == GL_FRAGMENT_SHADER || shader_type == GL_VERTEX_SHADER);
114 DCHECK(shader_spec == SH_GLES2_SPEC || shader_spec == SH_WEBGL_SPEC || 114 DCHECK(shader_spec == SH_GLES2_SPEC || shader_spec == SH_WEBGL_SPEC ||
115 shader_spec == SH_GLES3_SPEC || shader_spec == SH_WEBGL2_SPEC); 115 shader_spec == SH_GLES3_SPEC || shader_spec == SH_WEBGL2_SPEC);
116 DCHECK(resources != NULL); 116 DCHECK(resources != NULL);
117 117
118 g_translator_initializer.Get(); 118 g_translator_initializer.Get();
119 119
120 ShShaderOutput shader_output; 120 ShShaderOutput shader_output = SH_ESSL_OUTPUT;
121 if (glsl_implementation_type == kGlslES) { 121 switch (glsl_implementation_type) {
122 shader_output = SH_ESSL_OUTPUT; 122 case kGlsl:
123 } else { 123 shader_output = SH_GLSL_COMPATIBILITY_OUTPUT;
124 // TODO(kbr): clean up the tests of shader_spec and 124 break;
125 // gfx::GetGLImplementation(). crbug.com/471960 125 case kGlslCoreProfile:
126 if (shader_spec == SH_WEBGL2_SPEC ||
127 gfx::GetGLImplementation() ==
128 gfx::kGLImplementationDesktopGLCoreProfile) {
129 shader_output = SH_GLSL_CORE_OUTPUT; 126 shader_output = SH_GLSL_CORE_OUTPUT;
130 } else { 127 break;
131 shader_output = SH_GLSL_COMPATIBILITY_OUTPUT; 128 case kGlslES:
132 } 129 // Handled in initialization above.
130 break;
131 default:
132 NOTREACHED();
133 break;
133 } 134 }
134 135
135 { 136 {
136 TRACE_EVENT0("gpu", "ShConstructCompiler"); 137 TRACE_EVENT0("gpu", "ShConstructCompiler");
137 compiler_ = ShConstructCompiler( 138 compiler_ = ShConstructCompiler(
138 shader_type, shader_spec, shader_output, resources); 139 shader_type, shader_spec, shader_output, resources);
139 } 140 }
140 implementation_is_glsl_es_ = (glsl_implementation_type == kGlslES); 141 implementation_is_glsl_es_ = (glsl_implementation_type == kGlslES);
141 driver_bug_workarounds_ = driver_bug_workarounds; 142 driver_bug_workarounds_ = driver_bug_workarounds;
142 return compiler_ != NULL; 143 return compiler_ != NULL;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 destruction_observers_, 219 destruction_observers_,
219 OnDestruct(this)); 220 OnDestruct(this));
220 221
221 if (compiler_ != NULL) 222 if (compiler_ != NULL)
222 ShDestruct(compiler_); 223 ShDestruct(compiler_);
223 } 224 }
224 225
225 } // namespace gles2 226 } // namespace gles2
226 } // namespace gpu 227 } // namespace gpu
227 228
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/shader_translator.h ('k') | gpu/config/gpu_info_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698