OLD | NEW |
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/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (!CheckGLFeatureU( | 216 if (!CheckGLFeatureU( |
217 kMinFragmentUniformVectors, &max_fragment_uniform_vectors_) || | 217 kMinFragmentUniformVectors, &max_fragment_uniform_vectors_) || |
218 !CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) || | 218 !CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) || |
219 !CheckGLFeatureU( | 219 !CheckGLFeatureU( |
220 kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) { | 220 kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) { |
221 LOG(ERROR) << "ContextGroup::Initialize failed because too few " | 221 LOG(ERROR) << "ContextGroup::Initialize failed because too few " |
222 << "uniforms or varyings supported."; | 222 << "uniforms or varyings supported."; |
223 return false; | 223 return false; |
224 } | 224 } |
225 | 225 |
226 // TODO(gman): Use workarounds similar to max_texture_size above to implement. | 226 // Some shaders in Skia need more than the min available vertex and |
227 if (gfx::GetGLImplementation() == gfx::kGLImplementationOSMesaGL) { | 227 // fragment shader uniform vectors in case of OSMesa GL Implementation |
228 // Some shaders in Skia needed more than the min. | 228 if (feature_info_->workarounds().max_fragment_uniform_vectors) { |
229 max_fragment_uniform_vectors_ = | 229 max_fragment_uniform_vectors_ = std::min( |
230 std::min(static_cast<uint32>(kMinFragmentUniformVectors * 2), | 230 max_fragment_uniform_vectors_, |
231 max_fragment_uniform_vectors_); | 231 static_cast<uint32>( |
232 max_varying_vectors_ = | 232 feature_info_->workarounds().max_fragment_uniform_vectors)); |
233 std::min(static_cast<uint32>(kMinVaryingVectors * 2), | 233 } |
234 max_varying_vectors_); | 234 if (feature_info_->workarounds().max_varying_vectors) { |
| 235 max_varying_vectors_ = std::min( |
| 236 max_varying_vectors_, |
| 237 static_cast<uint32>(feature_info_->workarounds().max_varying_vectors)); |
| 238 } |
| 239 if (feature_info_->workarounds().max_vertex_uniform_vectors) { |
235 max_vertex_uniform_vectors_ = | 240 max_vertex_uniform_vectors_ = |
236 std::min(static_cast<uint32>(kMinVertexUniformVectors * 2), | 241 std::min(max_vertex_uniform_vectors_, |
237 max_vertex_uniform_vectors_); | 242 static_cast<uint32>( |
| 243 feature_info_->workarounds().max_vertex_uniform_vectors)); |
238 } | 244 } |
239 | 245 |
240 program_manager_.reset(new ProgramManager( | 246 program_manager_.reset(new ProgramManager( |
241 program_cache_, max_varying_vectors_)); | 247 program_cache_, max_varying_vectors_)); |
242 | 248 |
243 if (!texture_manager_->Initialize()) { | 249 if (!texture_manager_->Initialize()) { |
244 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " | 250 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " |
245 << "failed to initialize."; | 251 << "failed to initialize."; |
246 return false; | 252 return false; |
247 } | 253 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 GLenum pname, GLint min_required, uint32* v) { | 387 GLenum pname, GLint min_required, uint32* v) { |
382 uint32 value = 0; | 388 uint32 value = 0; |
383 GetIntegerv(pname, &value); | 389 GetIntegerv(pname, &value); |
384 bool result = CheckGLFeatureU(min_required, &value); | 390 bool result = CheckGLFeatureU(min_required, &value); |
385 *v = value; | 391 *v = value; |
386 return result; | 392 return result; |
387 } | 393 } |
388 | 394 |
389 } // namespace gles2 | 395 } // namespace gles2 |
390 } // namespace gpu | 396 } // namespace gpu |
OLD | NEW |