| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 3754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3765 break; | 3765 break; |
| 3766 } | 3766 } |
| 3767 | 3767 |
| 3768 if (((shader_spec == SH_WEBGL_SPEC || shader_spec == SH_WEBGL2_SPEC) && | 3768 if (((shader_spec == SH_WEBGL_SPEC || shader_spec == SH_WEBGL2_SPEC) && |
| 3769 features().enable_shader_name_hashing) || | 3769 features().enable_shader_name_hashing) || |
| 3770 force_shader_name_hashing_for_test) | 3770 force_shader_name_hashing_for_test) |
| 3771 resources.HashFunction = &CityHash64; | 3771 resources.HashFunction = &CityHash64; |
| 3772 else | 3772 else |
| 3773 resources.HashFunction = NULL; | 3773 resources.HashFunction = NULL; |
| 3774 | 3774 |
| 3775 int driver_bug_workarounds = 0; | 3775 ShCompileOptions driver_bug_workarounds = 0; |
| 3776 if (workarounds().init_gl_position_in_vertex_shader) | 3776 if (workarounds().init_gl_position_in_vertex_shader) |
| 3777 driver_bug_workarounds |= SH_INIT_GL_POSITION; | 3777 driver_bug_workarounds |= SH_INIT_GL_POSITION; |
| 3778 if (workarounds().unfold_short_circuit_as_ternary_operation) | 3778 if (workarounds().unfold_short_circuit_as_ternary_operation) |
| 3779 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; | 3779 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; |
| 3780 if (workarounds().scalarize_vec_and_mat_constructor_args) | 3780 if (workarounds().scalarize_vec_and_mat_constructor_args) |
| 3781 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; | 3781 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; |
| 3782 if (workarounds().regenerate_struct_names) | 3782 if (workarounds().regenerate_struct_names) |
| 3783 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; | 3783 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; |
| 3784 if (workarounds().remove_pow_with_constant_exponent) | 3784 if (workarounds().remove_pow_with_constant_exponent) |
| 3785 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; | 3785 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; |
| 3786 if (workarounds().emulate_abs_int_function) | 3786 if (workarounds().emulate_abs_int_function) |
| 3787 driver_bug_workarounds |= SH_EMULATE_ABS_INT_FUNCTION; | 3787 driver_bug_workarounds |= SH_EMULATE_ABS_INT_FUNCTION; |
| 3788 if (workarounds().rewrite_texelfetchoffset_to_texelfetch) | 3788 if (workarounds().rewrite_texelfetchoffset_to_texelfetch) |
| 3789 driver_bug_workarounds |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH; | 3789 driver_bug_workarounds |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH; |
| 3790 | 3790 |
| 3791 resources.WEBGL_debug_shader_precision = | 3791 resources.WEBGL_debug_shader_precision = |
| 3792 group_->gpu_preferences().emulate_shader_precision; | 3792 group_->gpu_preferences().emulate_shader_precision; |
| 3793 | 3793 |
| 3794 ShShaderOutput shader_output_language = | 3794 ShShaderOutput shader_output_language = |
| 3795 ShaderTranslator::GetShaderOutputLanguageForContext(gl_version_info()); | 3795 ShaderTranslator::GetShaderOutputLanguageForContext(gl_version_info()); |
| 3796 | 3796 |
| 3797 vertex_translator_ = shader_translator_cache()->GetTranslator( | 3797 vertex_translator_ = shader_translator_cache()->GetTranslator( |
| 3798 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, | 3798 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, |
| 3799 static_cast<ShCompileOptions>(driver_bug_workarounds)); | 3799 driver_bug_workarounds); |
| 3800 if (!vertex_translator_.get()) { | 3800 if (!vertex_translator_.get()) { |
| 3801 LOG(ERROR) << "Could not initialize vertex shader translator."; | 3801 LOG(ERROR) << "Could not initialize vertex shader translator."; |
| 3802 Destroy(true); | 3802 Destroy(true); |
| 3803 return false; | 3803 return false; |
| 3804 } | 3804 } |
| 3805 | 3805 |
| 3806 fragment_translator_ = shader_translator_cache()->GetTranslator( | 3806 fragment_translator_ = shader_translator_cache()->GetTranslator( |
| 3807 GL_FRAGMENT_SHADER, shader_spec, &resources, shader_output_language, | 3807 GL_FRAGMENT_SHADER, shader_spec, &resources, shader_output_language, |
| 3808 static_cast<ShCompileOptions>(driver_bug_workarounds)); | 3808 driver_bug_workarounds); |
| 3809 if (!fragment_translator_.get()) { | 3809 if (!fragment_translator_.get()) { |
| 3810 LOG(ERROR) << "Could not initialize fragment shader translator."; | 3810 LOG(ERROR) << "Could not initialize fragment shader translator."; |
| 3811 Destroy(true); | 3811 Destroy(true); |
| 3812 return false; | 3812 return false; |
| 3813 } | 3813 } |
| 3814 return true; | 3814 return true; |
| 3815 } | 3815 } |
| 3816 | 3816 |
| 3817 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { | 3817 bool GLES2DecoderImpl::GenBuffersHelper(GLsizei n, const GLuint* client_ids) { |
| 3818 for (GLsizei ii = 0; ii < n; ++ii) { | 3818 for (GLsizei ii = 0; ii < n; ++ii) { |
| (...skipping 14115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17934 } | 17934 } |
| 17935 | 17935 |
| 17936 // Include the auto-generated part of this file. We split this because it means | 17936 // Include the auto-generated part of this file. We split this because it means |
| 17937 // we can easily edit the non-auto generated parts right here in this file | 17937 // we can easily edit the non-auto generated parts right here in this file |
| 17938 // instead of having to edit some template or the code generator. | 17938 // instead of having to edit some template or the code generator. |
| 17939 #include "base/macros.h" | 17939 #include "base/macros.h" |
| 17940 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17940 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17941 | 17941 |
| 17942 } // namespace gles2 | 17942 } // namespace gles2 |
| 17943 } // namespace gpu | 17943 } // namespace gpu |
| OLD | NEW |