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 // TODO(zmo): Uncomment the below two lines when ANGLE CL is rolled in. |
| 2516 // if (workarounds().init_gl_position_in_vertex_shader) |
| 2517 // driver_bug_workarounds |= SH_INIT_GL_POSITION; |
2516 | 2518 |
2517 ShaderTranslatorCache* cache = ShaderTranslatorCache::GetInstance(); | 2519 ShaderTranslatorCache* cache = ShaderTranslatorCache::GetInstance(); |
2518 vertex_translator_ = cache->GetTranslator( | 2520 vertex_translator_ = cache->GetTranslator( |
2519 SH_VERTEX_SHADER, shader_spec, &resources, | 2521 SH_VERTEX_SHADER, shader_spec, &resources, |
2520 implementation_type, function_behavior); | 2522 implementation_type, |
| 2523 static_cast<ShCompileOptions>(driver_bug_workarounds)); |
2521 if (!vertex_translator_.get()) { | 2524 if (!vertex_translator_.get()) { |
2522 LOG(ERROR) << "Could not initialize vertex shader translator."; | 2525 LOG(ERROR) << "Could not initialize vertex shader translator."; |
2523 Destroy(true); | 2526 Destroy(true); |
2524 return false; | 2527 return false; |
2525 } | 2528 } |
2526 | 2529 |
2527 fragment_translator_ = cache->GetTranslator( | 2530 fragment_translator_ = cache->GetTranslator( |
2528 SH_FRAGMENT_SHADER, shader_spec, &resources, | 2531 SH_FRAGMENT_SHADER, shader_spec, &resources, |
2529 implementation_type, function_behavior); | 2532 implementation_type, |
| 2533 static_cast<ShCompileOptions>(driver_bug_workarounds)); |
2530 if (!fragment_translator_.get()) { | 2534 if (!fragment_translator_.get()) { |
2531 LOG(ERROR) << "Could not initialize fragment shader translator."; | 2535 LOG(ERROR) << "Could not initialize fragment shader translator."; |
2532 Destroy(true); | 2536 Destroy(true); |
2533 return false; | 2537 return false; |
2534 } | 2538 } |
2535 return true; | 2539 return true; |
2536 } | 2540 } |
2537 | 2541 |
2538 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { | 2542 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { |
2539 for (GLsizei ii = 0; ii < n; ++ii) { | 2543 for (GLsizei ii = 0; ii < n; ++ii) { |
(...skipping 7724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10264 return error::kNoError; | 10268 return error::kNoError; |
10265 } | 10269 } |
10266 | 10270 |
10267 // Include the auto-generated part of this file. We split this because it means | 10271 // 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 | 10272 // 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. | 10273 // instead of having to edit some template or the code generator. |
10270 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10274 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10271 | 10275 |
10272 } // namespace gles2 | 10276 } // namespace gles2 |
10273 } // namespace gpu | 10277 } // namespace gpu |
OLD | NEW |