OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/gpu_memory_buffer_support.h" | 5 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2extchromium.h> | 8 #include <GLES2/gl2extchromium.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 return gfx::BufferFormat::DXT1; | 34 return gfx::BufferFormat::DXT1; |
35 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: | 35 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: |
36 return gfx::BufferFormat::DXT5; | 36 return gfx::BufferFormat::DXT5; |
37 case GL_ETC1_RGB8_OES: | 37 case GL_ETC1_RGB8_OES: |
38 return gfx::BufferFormat::ETC1; | 38 return gfx::BufferFormat::ETC1; |
39 case GL_RGB_YCRCB_420_CHROMIUM: | 39 case GL_RGB_YCRCB_420_CHROMIUM: |
40 return gfx::BufferFormat::YVU_420; | 40 return gfx::BufferFormat::YVU_420; |
41 case GL_RGB_YCBCR_420V_CHROMIUM: | 41 case GL_RGB_YCBCR_420V_CHROMIUM: |
42 return gfx::BufferFormat::YUV_420_BIPLANAR; | 42 return gfx::BufferFormat::YUV_420_BIPLANAR; |
43 case GL_RGB_YCBCR_422_CHROMIUM: | 43 case GL_RGB_YCBCR_422_CHROMIUM: |
44 #if defined(OS_MACOSX) | |
45 // Mac supports UYVY IOSurface. | |
44 return gfx::BufferFormat::UYVY_422; | 46 return gfx::BufferFormat::UYVY_422; |
47 #elif defined(OS_CHROMEOS) | |
48 // Mesa EGL supports not UYVY but YUYV image. | |
marcheu1
2017/01/21 00:25:18
ditto
dshwang
2017/01/23 23:13:42
Done.
| |
49 return gfx::BufferFormat::YUYV_422; | |
50 #endif | |
45 default: | 51 default: |
46 NOTREACHED(); | 52 NOTREACHED(); |
47 return gfx::BufferFormat::RGBA_8888; | 53 return gfx::BufferFormat::RGBA_8888; |
48 } | 54 } |
49 } | 55 } |
50 | 56 |
51 } // namespace | 57 } // namespace |
52 | 58 |
53 gfx::BufferFormat DefaultBufferFormatForImageFormat(unsigned internalformat) { | 59 gfx::BufferFormat DefaultBufferFormatForImageFormat(unsigned internalformat) { |
54 switch (internalformat) { | 60 switch (internalformat) { |
(...skipping 17 matching lines...) Expand all Loading... | |
72 case gfx::BufferFormat::BGRX_8888: | 78 case gfx::BufferFormat::BGRX_8888: |
73 case gfx::BufferFormat::DXT1: | 79 case gfx::BufferFormat::DXT1: |
74 case gfx::BufferFormat::DXT5: | 80 case gfx::BufferFormat::DXT5: |
75 case gfx::BufferFormat::ETC1: | 81 case gfx::BufferFormat::ETC1: |
76 case gfx::BufferFormat::R_8: | 82 case gfx::BufferFormat::R_8: |
77 case gfx::BufferFormat::RG_88: | 83 case gfx::BufferFormat::RG_88: |
78 case gfx::BufferFormat::RGBA_8888: | 84 case gfx::BufferFormat::RGBA_8888: |
79 case gfx::BufferFormat::YVU_420: | 85 case gfx::BufferFormat::YVU_420: |
80 case gfx::BufferFormat::YUV_420_BIPLANAR: | 86 case gfx::BufferFormat::YUV_420_BIPLANAR: |
81 case gfx::BufferFormat::UYVY_422: | 87 case gfx::BufferFormat::UYVY_422: |
88 case gfx::BufferFormat::YUYV_422: | |
82 return format == BufferFormatForInternalFormat(internalformat); | 89 return format == BufferFormatForInternalFormat(internalformat); |
83 case gfx::BufferFormat::BGR_565: | 90 case gfx::BufferFormat::BGR_565: |
84 case gfx::BufferFormat::RGBX_8888: | 91 case gfx::BufferFormat::RGBX_8888: |
85 return internalformat == GL_RGB; | 92 return internalformat == GL_RGB; |
86 case gfx::BufferFormat::RGBA_4444: | 93 case gfx::BufferFormat::RGBA_4444: |
87 return internalformat == GL_RGBA; | 94 return internalformat == GL_RGBA; |
88 } | 95 } |
89 | 96 |
90 NOTREACHED(); | 97 NOTREACHED(); |
91 return false; | 98 return false; |
(...skipping 11 matching lines...) Expand all Loading... | |
103 case gfx::BufferFormat::DXT1: | 110 case gfx::BufferFormat::DXT1: |
104 return capabilities.texture_format_dxt1; | 111 return capabilities.texture_format_dxt1; |
105 case gfx::BufferFormat::DXT5: | 112 case gfx::BufferFormat::DXT5: |
106 return capabilities.texture_format_dxt5; | 113 return capabilities.texture_format_dxt5; |
107 case gfx::BufferFormat::ETC1: | 114 case gfx::BufferFormat::ETC1: |
108 return capabilities.texture_format_etc1; | 115 return capabilities.texture_format_etc1; |
109 case gfx::BufferFormat::R_8: | 116 case gfx::BufferFormat::R_8: |
110 case gfx::BufferFormat::RG_88: | 117 case gfx::BufferFormat::RG_88: |
111 return capabilities.texture_rg; | 118 return capabilities.texture_rg; |
112 case gfx::BufferFormat::UYVY_422: | 119 case gfx::BufferFormat::UYVY_422: |
120 case gfx::BufferFormat::YUYV_422: | |
113 return capabilities.image_ycbcr_422; | 121 return capabilities.image_ycbcr_422; |
114 case gfx::BufferFormat::BGR_565: | 122 case gfx::BufferFormat::BGR_565: |
115 case gfx::BufferFormat::RGBA_4444: | 123 case gfx::BufferFormat::RGBA_4444: |
116 case gfx::BufferFormat::RGBA_8888: | 124 case gfx::BufferFormat::RGBA_8888: |
117 case gfx::BufferFormat::RGBX_8888: | 125 case gfx::BufferFormat::RGBX_8888: |
118 case gfx::BufferFormat::YVU_420: | 126 case gfx::BufferFormat::YVU_420: |
119 return true; | 127 return true; |
120 case gfx::BufferFormat::YUV_420_BIPLANAR: | 128 case gfx::BufferFormat::YUV_420_BIPLANAR: |
121 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 129 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
122 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime | 130 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime |
(...skipping 26 matching lines...) Expand all Loading... | |
149 case gfx::BufferFormat::RGBA_8888: | 157 case gfx::BufferFormat::RGBA_8888: |
150 case gfx::BufferFormat::RGBX_8888: | 158 case gfx::BufferFormat::RGBX_8888: |
151 case gfx::BufferFormat::BGRA_8888: | 159 case gfx::BufferFormat::BGRA_8888: |
152 case gfx::BufferFormat::BGRX_8888: | 160 case gfx::BufferFormat::BGRX_8888: |
153 return true; | 161 return true; |
154 case gfx::BufferFormat::YVU_420: | 162 case gfx::BufferFormat::YVU_420: |
155 case gfx::BufferFormat::YUV_420_BIPLANAR: | 163 case gfx::BufferFormat::YUV_420_BIPLANAR: |
156 // U and V planes are subsampled by a factor of 2. | 164 // U and V planes are subsampled by a factor of 2. |
157 return size.width() % 2 == 0 && size.height() % 2 == 0; | 165 return size.width() % 2 == 0 && size.height() % 2 == 0; |
158 case gfx::BufferFormat::UYVY_422: | 166 case gfx::BufferFormat::UYVY_422: |
167 case gfx::BufferFormat::YUYV_422: | |
159 return size.width() % 2 == 0; | 168 return size.width() % 2 == 0; |
160 } | 169 } |
161 | 170 |
162 NOTREACHED(); | 171 NOTREACHED(); |
163 return false; | 172 return false; |
164 } | 173 } |
165 | 174 |
166 } // namespace gpu | 175 } // namespace gpu |
OLD | NEW |