| 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/feature_info.h" | 5 #include "gpu/command_buffer/service/feature_info.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "gpu/command_buffer/service/gpu_switches.h" | 16 #include "gpu/command_buffer/service/gpu_switches.h" |
| 17 #include "gpu/command_buffer/service/texture_definition.h" | 17 #include "gpu/command_buffer/service/texture_definition.h" |
| 18 #include "gpu/config/gpu_switches.h" | 18 #include "gpu/config/gpu_switches.h" |
| 19 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
| 20 #include "ui/gl/gl_fence.h" | 20 #include "ui/gl/gl_fence.h" |
| 21 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
| 22 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
| 23 #include "ui/gl/gl_version_info.h" | 23 #include "ui/gl/gl_version_info.h" |
| 24 | 24 |
| 25 #if defined(OS_CHROMEOS) |
| 26 #include "ui/gl/gl_surface_egl.h" |
| 27 #endif |
| 28 |
| 25 #if !defined(OS_MACOSX) | 29 #if !defined(OS_MACOSX) |
| 26 #include "ui/gl/gl_fence_egl.h" | 30 #include "ui/gl/gl_fence_egl.h" |
| 27 #endif | 31 #endif |
| 28 | 32 |
| 29 namespace gpu { | 33 namespace gpu { |
| 30 namespace gles2 { | 34 namespace gles2 { |
| 31 | 35 |
| 32 namespace { | 36 namespace { |
| 33 | 37 |
| 34 struct FormatInfo { | 38 struct FormatInfo { |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 | 936 |
| 933 if (gl_version_info_->is_es3 || | 937 if (gl_version_info_->is_es3 || |
| 934 extensions.Contains("GL_OES_standard_derivatives") || | 938 extensions.Contains("GL_OES_standard_derivatives") || |
| 935 gl::HasDesktopGLFeatures()) { | 939 gl::HasDesktopGLFeatures()) { |
| 936 AddExtensionString("GL_OES_standard_derivatives"); | 940 AddExtensionString("GL_OES_standard_derivatives"); |
| 937 feature_flags_.oes_standard_derivatives = true; | 941 feature_flags_.oes_standard_derivatives = true; |
| 938 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 942 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
| 939 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 943 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
| 940 } | 944 } |
| 941 | 945 |
| 946 if (extensions.Contains("GL_APPLE_ycbcr_422")) { |
| 947 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); |
| 948 feature_flags_.chromium_image_ycbcr_422 = true; |
| 949 } |
| 950 |
| 942 if (extensions.Contains("GL_OES_EGL_image_external")) { | 951 if (extensions.Contains("GL_OES_EGL_image_external")) { |
| 943 AddExtensionString("GL_OES_EGL_image_external"); | 952 AddExtensionString("GL_OES_EGL_image_external"); |
| 944 feature_flags_.oes_egl_image_external = true; | 953 feature_flags_.oes_egl_image_external = true; |
| 954 #if defined(OS_CHROMEOS) |
| 955 bool has_dma_buf_import = |
| 956 gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_dma_buf_import"); |
| 957 if (has_dma_buf_import) { |
| 958 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); |
| 959 feature_flags_.chromium_image_ycbcr_422 = true; |
| 960 } |
| 961 #endif |
| 945 } | 962 } |
| 946 if (extensions.Contains("GL_NV_EGL_stream_consumer_external")) { | 963 if (extensions.Contains("GL_NV_EGL_stream_consumer_external")) { |
| 947 AddExtensionString("GL_NV_EGL_stream_consumer_external"); | 964 AddExtensionString("GL_NV_EGL_stream_consumer_external"); |
| 948 feature_flags_.nv_egl_stream_consumer_external = true; | 965 feature_flags_.nv_egl_stream_consumer_external = true; |
| 949 } | 966 } |
| 950 | 967 |
| 951 if (feature_flags_.oes_egl_image_external || | 968 if (feature_flags_.oes_egl_image_external || |
| 952 feature_flags_.nv_egl_stream_consumer_external) { | 969 feature_flags_.nv_egl_stream_consumer_external) { |
| 953 validators_.texture_bind_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 970 validators_.texture_bind_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
| 954 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 971 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1048 |
| 1032 #if defined(OS_MACOSX) | 1049 #if defined(OS_MACOSX) |
| 1033 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime | 1050 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime |
| 1034 // querying minigbm. crbug.com/646148 | 1051 // querying minigbm. crbug.com/646148 |
| 1035 if (gl::GetGLImplementation() != gl::kGLImplementationOSMesaGL) { | 1052 if (gl::GetGLImplementation() != gl::kGLImplementationOSMesaGL) { |
| 1036 AddExtensionString("GL_CHROMIUM_ycbcr_420v_image"); | 1053 AddExtensionString("GL_CHROMIUM_ycbcr_420v_image"); |
| 1037 feature_flags_.chromium_image_ycbcr_420v = true; | 1054 feature_flags_.chromium_image_ycbcr_420v = true; |
| 1038 } | 1055 } |
| 1039 #endif | 1056 #endif |
| 1040 | 1057 |
| 1041 if (extensions.Contains("GL_APPLE_ycbcr_422")) { | |
| 1042 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); | |
| 1043 feature_flags_.chromium_image_ycbcr_422 = true; | |
| 1044 } | |
| 1045 | |
| 1046 // TODO(gman): Add support for these extensions. | 1058 // TODO(gman): Add support for these extensions. |
| 1047 // GL_OES_depth32 | 1059 // GL_OES_depth32 |
| 1048 | 1060 |
| 1049 if (extensions.Contains("GL_ANGLE_texture_usage")) { | 1061 if (extensions.Contains("GL_ANGLE_texture_usage")) { |
| 1050 feature_flags_.angle_texture_usage = true; | 1062 feature_flags_.angle_texture_usage = true; |
| 1051 AddExtensionString("GL_ANGLE_texture_usage"); | 1063 AddExtensionString("GL_ANGLE_texture_usage"); |
| 1052 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); | 1064 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); |
| 1053 } | 1065 } |
| 1054 | 1066 |
| 1055 bool have_occlusion_query = | 1067 bool have_occlusion_query = |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 if (pos == std::string::npos) { | 1695 if (pos == std::string::npos) { |
| 1684 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1696 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1685 } | 1697 } |
| 1686 } | 1698 } |
| 1687 | 1699 |
| 1688 FeatureInfo::~FeatureInfo() { | 1700 FeatureInfo::~FeatureInfo() { |
| 1689 } | 1701 } |
| 1690 | 1702 |
| 1691 } // namespace gles2 | 1703 } // namespace gles2 |
| 1692 } // namespace gpu | 1704 } // namespace gpu |
| OLD | NEW |