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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 | 963 |
960 if (gl_version_info_->is_es3 || | 964 if (gl_version_info_->is_es3 || |
961 extensions.Contains("GL_OES_standard_derivatives") || | 965 extensions.Contains("GL_OES_standard_derivatives") || |
962 gl::HasDesktopGLFeatures()) { | 966 gl::HasDesktopGLFeatures()) { |
963 AddExtensionString("GL_OES_standard_derivatives"); | 967 AddExtensionString("GL_OES_standard_derivatives"); |
964 feature_flags_.oes_standard_derivatives = true; | 968 feature_flags_.oes_standard_derivatives = true; |
965 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 969 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
966 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 970 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
967 } | 971 } |
968 | 972 |
| 973 if (extensions.Contains("GL_APPLE_ycbcr_422")) { |
| 974 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); |
| 975 feature_flags_.chromium_image_ycbcr_422 = true; |
| 976 } |
| 977 |
969 if (extensions.Contains("GL_OES_EGL_image_external")) { | 978 if (extensions.Contains("GL_OES_EGL_image_external")) { |
970 AddExtensionString("GL_OES_EGL_image_external"); | 979 AddExtensionString("GL_OES_EGL_image_external"); |
971 feature_flags_.oes_egl_image_external = true; | 980 feature_flags_.oes_egl_image_external = true; |
| 981 #if defined(OS_CHROMEOS) |
| 982 bool has_dma_buf_import = |
| 983 gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_dma_buf_import"); |
| 984 if (has_dma_buf_import) { |
| 985 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); |
| 986 feature_flags_.chromium_image_ycbcr_422 = true; |
| 987 } |
| 988 #endif |
972 } | 989 } |
973 if (extensions.Contains("GL_NV_EGL_stream_consumer_external")) { | 990 if (extensions.Contains("GL_NV_EGL_stream_consumer_external")) { |
974 AddExtensionString("GL_NV_EGL_stream_consumer_external"); | 991 AddExtensionString("GL_NV_EGL_stream_consumer_external"); |
975 feature_flags_.nv_egl_stream_consumer_external = true; | 992 feature_flags_.nv_egl_stream_consumer_external = true; |
976 } | 993 } |
977 | 994 |
978 if (feature_flags_.oes_egl_image_external || | 995 if (feature_flags_.oes_egl_image_external || |
979 feature_flags_.nv_egl_stream_consumer_external) { | 996 feature_flags_.nv_egl_stream_consumer_external) { |
980 validators_.texture_bind_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 997 validators_.texture_bind_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
981 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 998 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 | 1075 |
1059 #if defined(OS_MACOSX) | 1076 #if defined(OS_MACOSX) |
1060 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime | 1077 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime |
1061 // querying minigbm. crbug.com/646148 | 1078 // querying minigbm. crbug.com/646148 |
1062 if (gl::GetGLImplementation() != gl::kGLImplementationOSMesaGL) { | 1079 if (gl::GetGLImplementation() != gl::kGLImplementationOSMesaGL) { |
1063 AddExtensionString("GL_CHROMIUM_ycbcr_420v_image"); | 1080 AddExtensionString("GL_CHROMIUM_ycbcr_420v_image"); |
1064 feature_flags_.chromium_image_ycbcr_420v = true; | 1081 feature_flags_.chromium_image_ycbcr_420v = true; |
1065 } | 1082 } |
1066 #endif | 1083 #endif |
1067 | 1084 |
1068 if (extensions.Contains("GL_APPLE_ycbcr_422")) { | |
1069 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); | |
1070 feature_flags_.chromium_image_ycbcr_422 = true; | |
1071 } | |
1072 | |
1073 // TODO(gman): Add support for these extensions. | 1085 // TODO(gman): Add support for these extensions. |
1074 // GL_OES_depth32 | 1086 // GL_OES_depth32 |
1075 | 1087 |
1076 if (extensions.Contains("GL_ANGLE_texture_usage")) { | 1088 if (extensions.Contains("GL_ANGLE_texture_usage")) { |
1077 feature_flags_.angle_texture_usage = true; | 1089 feature_flags_.angle_texture_usage = true; |
1078 AddExtensionString("GL_ANGLE_texture_usage"); | 1090 AddExtensionString("GL_ANGLE_texture_usage"); |
1079 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); | 1091 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); |
1080 } | 1092 } |
1081 | 1093 |
1082 if (enable_texture_storage) { | 1094 if (enable_texture_storage) { |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 if (pos == std::string::npos) { | 1548 if (pos == std::string::npos) { |
1537 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1549 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1538 } | 1550 } |
1539 } | 1551 } |
1540 | 1552 |
1541 FeatureInfo::~FeatureInfo() { | 1553 FeatureInfo::~FeatureInfo() { |
1542 } | 1554 } |
1543 | 1555 |
1544 } // namespace gles2 | 1556 } // namespace gles2 |
1545 } // namespace gpu | 1557 } // namespace gpu |
OLD | NEW |