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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 | 2502 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 |
2503 resources.HashFunction = &CityHashForAngle; | 2503 resources.HashFunction = &CityHashForAngle; |
2504 #else | 2504 #else |
2505 resources.HashFunction = &CityHash64; | 2505 resources.HashFunction = &CityHash64; |
2506 #endif | 2506 #endif |
2507 else | 2507 else |
2508 resources.HashFunction = NULL; | 2508 resources.HashFunction = NULL; |
2509 ShaderTranslatorInterface::GlslImplementationType implementation_type = | 2509 ShaderTranslatorInterface::GlslImplementationType implementation_type = |
2510 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ? | 2510 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ? |
2511 ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl; | 2511 ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl; |
2512 ShaderTranslatorInterface::GlslBuiltInFunctionBehavior function_behavior = | 2512 int driver_bug_workarounds = 0; |
2513 workarounds().needs_glsl_built_in_function_emulation ? | 2513 if (workarounds().needs_glsl_built_in_function_emulation) |
2514 ShaderTranslatorInterface::kGlslBuiltInFunctionEmulated : | 2514 driver_bug_workarounds |= SH_EMULATE_BUILT_IN_FUNCTIONS; |
2515 ShaderTranslatorInterface::kGlslBuiltInFunctionOriginal; | 2515 if (workarounds().init_gl_position_in_vertex_shader) |
| 2516 driver_bug_workarounds |= SH_INIT_GL_POSITION; |
2516 | 2517 |
2517 ShaderTranslatorCache* cache = ShaderTranslatorCache::GetInstance(); | 2518 ShaderTranslatorCache* cache = ShaderTranslatorCache::GetInstance(); |
2518 vertex_translator_ = cache->GetTranslator( | 2519 vertex_translator_ = cache->GetTranslator( |
2519 SH_VERTEX_SHADER, shader_spec, &resources, | 2520 SH_VERTEX_SHADER, shader_spec, &resources, |
2520 implementation_type, function_behavior); | 2521 implementation_type, driver_bug_workarounds); |
2521 if (!vertex_translator_.get()) { | 2522 if (!vertex_translator_.get()) { |
2522 LOG(ERROR) << "Could not initialize vertex shader translator."; | 2523 LOG(ERROR) << "Could not initialize vertex shader translator."; |
2523 Destroy(true); | 2524 Destroy(true); |
2524 return false; | 2525 return false; |
2525 } | 2526 } |
2526 | 2527 |
2527 fragment_translator_ = cache->GetTranslator( | 2528 fragment_translator_ = cache->GetTranslator( |
2528 SH_FRAGMENT_SHADER, shader_spec, &resources, | 2529 SH_FRAGMENT_SHADER, shader_spec, &resources, |
2529 implementation_type, function_behavior); | 2530 implementation_type, driver_bug_workarounds); |
2530 if (!fragment_translator_.get()) { | 2531 if (!fragment_translator_.get()) { |
2531 LOG(ERROR) << "Could not initialize fragment shader translator."; | 2532 LOG(ERROR) << "Could not initialize fragment shader translator."; |
2532 Destroy(true); | 2533 Destroy(true); |
2533 return false; | 2534 return false; |
2534 } | 2535 } |
2535 return true; | 2536 return true; |
2536 } | 2537 } |
2537 | 2538 |
2538 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { | 2539 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { |
2539 for (GLsizei ii = 0; ii < n; ++ii) { | 2540 for (GLsizei ii = 0; ii < n; ++ii) { |
(...skipping 7724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10264 return error::kNoError; | 10265 return error::kNoError; |
10265 } | 10266 } |
10266 | 10267 |
10267 // Include the auto-generated part of this file. We split this because it means | 10268 // Include the auto-generated part of this file. We split this because it means |
10268 // we can easily edit the non-auto generated parts right here in this file | 10269 // we can easily edit the non-auto generated parts right here in this file |
10269 // instead of having to edit some template or the code generator. | 10270 // instead of having to edit some template or the code generator. |
10270 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10271 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10271 | 10272 |
10272 } // namespace gles2 | 10273 } // namespace gles2 |
10273 } // namespace gpu | 10274 } // namespace gpu |
OLD | NEW |