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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1014 | 1018 |
1015 if (gl_version_info_->is_es3 || | 1019 if (gl_version_info_->is_es3 || |
1016 extensions.Contains("GL_OES_standard_derivatives") || | 1020 extensions.Contains("GL_OES_standard_derivatives") || |
1017 gl::HasDesktopGLFeatures()) { | 1021 gl::HasDesktopGLFeatures()) { |
1018 AddExtensionString("GL_OES_standard_derivatives"); | 1022 AddExtensionString("GL_OES_standard_derivatives"); |
1019 feature_flags_.oes_standard_derivatives = true; | 1023 feature_flags_.oes_standard_derivatives = true; |
1020 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 1024 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
1021 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 1025 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
1022 } | 1026 } |
1023 | 1027 |
1028 if (extensions.Contains("GL_APPLE_ycbcr_422")) { | |
1029 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); | |
1030 feature_flags_.chromium_image_ycbcr_422 = true; | |
1031 } | |
1032 | |
1024 if (extensions.Contains("GL_OES_EGL_image_external")) { | 1033 if (extensions.Contains("GL_OES_EGL_image_external")) { |
1025 AddExtensionString("GL_OES_EGL_image_external"); | 1034 AddExtensionString("GL_OES_EGL_image_external"); |
1026 feature_flags_.oes_egl_image_external = true; | 1035 feature_flags_.oes_egl_image_external = true; |
1036 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
1037 // TODO(dshwang): when ARM support YUYV, remove ARCH_CPU_X86_FAMILY check. | |
marcheu1
2017/01/21 00:25:18
Som ARM platforms already support YUYV, please don
dshwang
2017/01/23 23:13:42
Ok, remove the X86 check. and the code is protecte
| |
1038 // crbug.com/683347 | |
1039 bool has_dma_buf_import = | |
1040 gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_dma_buf_import"); | |
marcheu1
2017/01/21 00:25:18
we might not need to test this, dma_buf_import is
dshwang
2017/01/23 23:13:42
In ChromeOS, GLImageOzoneNativePixmap binds YUYV d
| |
1041 if (has_dma_buf_import) { | |
1042 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); | |
marcheu1
2017/01/21 00:25:18
I think it's incorrect to prevent allocation of im
dshwang
2017/01/23 23:13:42
gbm already provides the ability to tell if alloca
| |
1043 feature_flags_.chromium_image_ycbcr_422 = true; | |
1044 } | |
1045 #endif | |
1027 } | 1046 } |
1028 if (extensions.Contains("GL_NV_EGL_stream_consumer_external")) { | 1047 if (extensions.Contains("GL_NV_EGL_stream_consumer_external")) { |
1029 AddExtensionString("GL_NV_EGL_stream_consumer_external"); | 1048 AddExtensionString("GL_NV_EGL_stream_consumer_external"); |
1030 feature_flags_.nv_egl_stream_consumer_external = true; | 1049 feature_flags_.nv_egl_stream_consumer_external = true; |
1031 } | 1050 } |
1032 | 1051 |
1033 if (feature_flags_.oes_egl_image_external || | 1052 if (feature_flags_.oes_egl_image_external || |
1034 feature_flags_.nv_egl_stream_consumer_external) { | 1053 feature_flags_.nv_egl_stream_consumer_external) { |
1035 validators_.texture_bind_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 1054 validators_.texture_bind_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
1036 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 1055 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1113 | 1132 |
1114 #if defined(OS_MACOSX) | 1133 #if defined(OS_MACOSX) |
1115 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime | 1134 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime |
1116 // querying minigbm. crbug.com/646148 | 1135 // querying minigbm. crbug.com/646148 |
1117 if (gl::GetGLImplementation() != gl::kGLImplementationOSMesaGL) { | 1136 if (gl::GetGLImplementation() != gl::kGLImplementationOSMesaGL) { |
1118 AddExtensionString("GL_CHROMIUM_ycbcr_420v_image"); | 1137 AddExtensionString("GL_CHROMIUM_ycbcr_420v_image"); |
1119 feature_flags_.chromium_image_ycbcr_420v = true; | 1138 feature_flags_.chromium_image_ycbcr_420v = true; |
1120 } | 1139 } |
1121 #endif | 1140 #endif |
1122 | 1141 |
1123 if (extensions.Contains("GL_APPLE_ycbcr_422")) { | |
1124 AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); | |
1125 feature_flags_.chromium_image_ycbcr_422 = true; | |
1126 } | |
1127 | |
1128 // TODO(gman): Add support for these extensions. | 1142 // TODO(gman): Add support for these extensions. |
1129 // GL_OES_depth32 | 1143 // GL_OES_depth32 |
1130 | 1144 |
1131 if (extensions.Contains("GL_ANGLE_texture_usage")) { | 1145 if (extensions.Contains("GL_ANGLE_texture_usage")) { |
1132 feature_flags_.angle_texture_usage = true; | 1146 feature_flags_.angle_texture_usage = true; |
1133 AddExtensionString("GL_ANGLE_texture_usage"); | 1147 AddExtensionString("GL_ANGLE_texture_usage"); |
1134 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); | 1148 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); |
1135 } | 1149 } |
1136 | 1150 |
1137 if (enable_texture_storage) { | 1151 if (enable_texture_storage) { |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1588 if (pos == std::string::npos) { | 1602 if (pos == std::string::npos) { |
1589 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1603 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1590 } | 1604 } |
1591 } | 1605 } |
1592 | 1606 |
1593 FeatureInfo::~FeatureInfo() { | 1607 FeatureInfo::~FeatureInfo() { |
1594 } | 1608 } |
1595 | 1609 |
1596 } // namespace gles2 | 1610 } // namespace gles2 |
1597 } // namespace gpu | 1611 } // namespace gpu |
OLD | NEW |