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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // TODO(zmo): we can't include "City.h" due to type def conflicts. | 67 // TODO(zmo): we can't include "City.h" due to type def conflicts. |
68 extern uint64 CityHash64(const char*, size_t); | 68 extern uint64 CityHash64(const char*, size_t); |
69 | 69 |
70 namespace gpu { | 70 namespace gpu { |
71 namespace gles2 { | 71 namespace gles2 { |
72 | 72 |
73 namespace { | 73 namespace { |
74 | 74 |
75 static const char kOESDerivativeExtension[] = "GL_OES_standard_derivatives"; | 75 static const char kOESDerivativeExtension[] = "GL_OES_standard_derivatives"; |
76 | 76 |
| 77 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 |
77 khronos_uint64_t CityHashForAngle(const char* name, unsigned int len) { | 78 khronos_uint64_t CityHashForAngle(const char* name, unsigned int len) { |
78 return static_cast<khronos_uint64_t>( | 79 return static_cast<khronos_uint64_t>( |
79 CityHash64(name, static_cast<size_t>(len))); | 80 CityHash64(name, static_cast<size_t>(len))); |
80 } | 81 } |
| 82 #endif |
81 | 83 |
82 } // namespace | 84 } // namespace |
83 | 85 |
84 class GLES2DecoderImpl; | 86 class GLES2DecoderImpl; |
85 | 87 |
86 // Check that certain assumptions the code makes are true. There are places in | 88 // Check that certain assumptions the code makes are true. There are places in |
87 // the code where shared memory is passed direclty to GL. Example, glUniformiv, | 89 // the code where shared memory is passed direclty to GL. Example, glUniformiv, |
88 // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe | 90 // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe |
89 // a few others) are 32bits. If they are not 32bits the code will have to change | 91 // a few others) are 32bits. If they are not 32bits the code will have to change |
90 // to call those GL functions with service side memory and then copy the results | 92 // to call those GL functions with service side memory and then copy the results |
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 features().oes_standard_derivatives ? 1 : 0; | 2495 features().oes_standard_derivatives ? 1 : 0; |
2494 resources.ARB_texture_rectangle = | 2496 resources.ARB_texture_rectangle = |
2495 features().arb_texture_rectangle ? 1 : 0; | 2497 features().arb_texture_rectangle ? 1 : 0; |
2496 resources.OES_EGL_image_external = | 2498 resources.OES_EGL_image_external = |
2497 features().oes_egl_image_external ? 1 : 0; | 2499 features().oes_egl_image_external ? 1 : 0; |
2498 } | 2500 } |
2499 | 2501 |
2500 ShShaderSpec shader_spec = force_webgl_glsl_validation_ || | 2502 ShShaderSpec shader_spec = force_webgl_glsl_validation_ || |
2501 force_webgl_glsl_validation_ ? SH_WEBGL_SPEC : SH_GLES2_SPEC; | 2503 force_webgl_glsl_validation_ ? SH_WEBGL_SPEC : SH_GLES2_SPEC; |
2502 if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing) | 2504 if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing) |
| 2505 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 |
2503 resources.HashFunction = &CityHashForAngle; | 2506 resources.HashFunction = &CityHashForAngle; |
| 2507 #else |
| 2508 resources.HashFunction = &CityHash64; |
| 2509 #endif |
2504 else | 2510 else |
2505 resources.HashFunction = NULL; | 2511 resources.HashFunction = NULL; |
2506 ShaderTranslatorInterface::GlslImplementationType implementation_type = | 2512 ShaderTranslatorInterface::GlslImplementationType implementation_type = |
2507 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ? | 2513 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ? |
2508 ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl; | 2514 ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl; |
2509 ShaderTranslatorInterface::GlslBuiltInFunctionBehavior function_behavior = | 2515 ShaderTranslatorInterface::GlslBuiltInFunctionBehavior function_behavior = |
2510 workarounds().needs_glsl_built_in_function_emulation ? | 2516 workarounds().needs_glsl_built_in_function_emulation ? |
2511 ShaderTranslatorInterface::kGlslBuiltInFunctionEmulated : | 2517 ShaderTranslatorInterface::kGlslBuiltInFunctionEmulated : |
2512 ShaderTranslatorInterface::kGlslBuiltInFunctionOriginal; | 2518 ShaderTranslatorInterface::kGlslBuiltInFunctionOriginal; |
2513 | 2519 |
(...skipping 7563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10077 return error::kNoError; | 10083 return error::kNoError; |
10078 } | 10084 } |
10079 | 10085 |
10080 // Include the auto-generated part of this file. We split this because it means | 10086 // Include the auto-generated part of this file. We split this because it means |
10081 // we can easily edit the non-auto generated parts right here in this file | 10087 // we can easily edit the non-auto generated parts right here in this file |
10082 // instead of having to edit some template or the code generator. | 10088 // instead of having to edit some template or the code generator. |
10083 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10089 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10084 | 10090 |
10085 } // namespace gles2 | 10091 } // namespace gles2 |
10086 } // namespace gpu | 10092 } // namespace gpu |
OLD | NEW |