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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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 <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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 bool ShaderTranslator::Init( 104 bool ShaderTranslator::Init(
105 GLenum shader_type, 105 GLenum shader_type,
106 ShShaderSpec shader_spec, 106 ShShaderSpec shader_spec,
107 const ShBuiltInResources* resources, 107 const ShBuiltInResources* resources,
108 ShaderTranslatorInterface::GlslImplementationType glsl_implementation_type, 108 ShaderTranslatorInterface::GlslImplementationType glsl_implementation_type,
109 ShCompileOptions driver_bug_workarounds) { 109 ShCompileOptions driver_bug_workarounds) {
110 // Make sure Init is called only once. 110 // Make sure Init is called only once.
111 DCHECK(compiler_ == NULL); 111 DCHECK(compiler_ == NULL);
112 DCHECK(shader_type == GL_FRAGMENT_SHADER || shader_type == GL_VERTEX_SHADER); 112 DCHECK(shader_type == GL_FRAGMENT_SHADER || shader_type == GL_VERTEX_SHADER);
113 DCHECK(shader_spec == SH_GLES2_SPEC || shader_spec == SH_WEBGL_SPEC); 113 DCHECK(shader_spec == SH_GLES2_SPEC || shader_spec == SH_WEBGL_SPEC ||
114 shader_spec == SH_GLES3_SPEC || shader_spec == SH_WEBGL2_SPEC);
114 DCHECK(resources != NULL); 115 DCHECK(resources != NULL);
115 116
116 g_translator_initializer.Get(); 117 g_translator_initializer.Get();
117 118
118 ShShaderOutput shader_output = 119 ShShaderOutput shader_output;
119 (glsl_implementation_type == kGlslES ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT); 120 if (glsl_implementation_type == kGlslES) {
121 shader_output = SH_ESSL_OUTPUT;
122 } else {
123 shader_output = (shader_spec == SH_WEBGL2_SPEC) ? SH_GLSL_CORE_OUTPUT :
124 SH_GLSL_COMPATIBILITY_OUTPUT;
125 }
120 126
121 { 127 {
122 TRACE_EVENT0("gpu", "ShConstructCompiler"); 128 TRACE_EVENT0("gpu", "ShConstructCompiler");
123 compiler_ = ShConstructCompiler( 129 compiler_ = ShConstructCompiler(
124 shader_type, shader_spec, shader_output, resources); 130 shader_type, shader_spec, shader_output, resources);
125 } 131 }
126 implementation_is_glsl_es_ = (glsl_implementation_type == kGlslES); 132 implementation_is_glsl_es_ = (glsl_implementation_type == kGlslES);
127 driver_bug_workarounds_ = driver_bug_workarounds; 133 driver_bug_workarounds_ = driver_bug_workarounds;
128 return compiler_ != NULL; 134 return compiler_ != NULL;
129 } 135 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 destruction_observers_, 210 destruction_observers_,
205 OnDestruct(this)); 211 OnDestruct(this));
206 212
207 if (compiler_ != NULL) 213 if (compiler_ != NULL)
208 ShDestruct(compiler_); 214 ShDestruct(compiler_);
209 } 215 }
210 216
211 } // namespace gles2 217 } // namespace gles2
212 } // namespace gpu 218 } // namespace gpu
213 219
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/image_factory.cc ('k') | gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698