| 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 return gfx::BufferFormat::UYVY_422; | 44 return gfx::BufferFormat::YUYV_422; |
| 45 default: | 45 default: |
| 46 NOTREACHED(); | 46 NOTREACHED(); |
| 47 return gfx::BufferFormat::RGBA_8888; | 47 return gfx::BufferFormat::RGBA_8888; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 gfx::BufferFormat DefaultBufferFormatForImageFormat(unsigned internalformat) { | 53 gfx::BufferFormat DefaultBufferFormatForImageFormat(unsigned internalformat) { |
| 54 switch (internalformat) { | 54 switch (internalformat) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 case gfx::BufferFormat::BGRX_8888: | 72 case gfx::BufferFormat::BGRX_8888: |
| 73 case gfx::BufferFormat::DXT1: | 73 case gfx::BufferFormat::DXT1: |
| 74 case gfx::BufferFormat::DXT5: | 74 case gfx::BufferFormat::DXT5: |
| 75 case gfx::BufferFormat::ETC1: | 75 case gfx::BufferFormat::ETC1: |
| 76 case gfx::BufferFormat::R_8: | 76 case gfx::BufferFormat::R_8: |
| 77 case gfx::BufferFormat::RG_88: | 77 case gfx::BufferFormat::RG_88: |
| 78 case gfx::BufferFormat::RGBA_8888: | 78 case gfx::BufferFormat::RGBA_8888: |
| 79 case gfx::BufferFormat::YVU_420: | 79 case gfx::BufferFormat::YVU_420: |
| 80 case gfx::BufferFormat::YUV_420_BIPLANAR: | 80 case gfx::BufferFormat::YUV_420_BIPLANAR: |
| 81 case gfx::BufferFormat::UYVY_422: | 81 case gfx::BufferFormat::UYVY_422: |
| 82 case gfx::BufferFormat::YUYV_422: |
| 82 return format == BufferFormatForInternalFormat(internalformat); | 83 return format == BufferFormatForInternalFormat(internalformat); |
| 83 case gfx::BufferFormat::BGR_565: | 84 case gfx::BufferFormat::BGR_565: |
| 84 case gfx::BufferFormat::RGBX_8888: | 85 case gfx::BufferFormat::RGBX_8888: |
| 85 return internalformat == GL_RGB; | 86 return internalformat == GL_RGB; |
| 86 case gfx::BufferFormat::RGBA_4444: | 87 case gfx::BufferFormat::RGBA_4444: |
| 87 return internalformat == GL_RGBA; | 88 return internalformat == GL_RGBA; |
| 88 } | 89 } |
| 89 | 90 |
| 90 NOTREACHED(); | 91 NOTREACHED(); |
| 91 return false; | 92 return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 case gfx::BufferFormat::DXT1: | 104 case gfx::BufferFormat::DXT1: |
| 104 return capabilities.texture_format_dxt1; | 105 return capabilities.texture_format_dxt1; |
| 105 case gfx::BufferFormat::DXT5: | 106 case gfx::BufferFormat::DXT5: |
| 106 return capabilities.texture_format_dxt5; | 107 return capabilities.texture_format_dxt5; |
| 107 case gfx::BufferFormat::ETC1: | 108 case gfx::BufferFormat::ETC1: |
| 108 return capabilities.texture_format_etc1; | 109 return capabilities.texture_format_etc1; |
| 109 case gfx::BufferFormat::R_8: | 110 case gfx::BufferFormat::R_8: |
| 110 case gfx::BufferFormat::RG_88: | 111 case gfx::BufferFormat::RG_88: |
| 111 return capabilities.texture_rg; | 112 return capabilities.texture_rg; |
| 112 case gfx::BufferFormat::UYVY_422: | 113 case gfx::BufferFormat::UYVY_422: |
| 114 case gfx::BufferFormat::YUYV_422: |
| 113 return capabilities.image_ycbcr_422; | 115 return capabilities.image_ycbcr_422; |
| 114 case gfx::BufferFormat::BGR_565: | 116 case gfx::BufferFormat::BGR_565: |
| 115 case gfx::BufferFormat::RGBA_4444: | 117 case gfx::BufferFormat::RGBA_4444: |
| 116 case gfx::BufferFormat::RGBA_8888: | 118 case gfx::BufferFormat::RGBA_8888: |
| 117 case gfx::BufferFormat::RGBX_8888: | 119 case gfx::BufferFormat::RGBX_8888: |
| 118 case gfx::BufferFormat::YVU_420: | 120 case gfx::BufferFormat::YVU_420: |
| 119 return true; | 121 return true; |
| 120 case gfx::BufferFormat::YUV_420_BIPLANAR: | 122 case gfx::BufferFormat::YUV_420_BIPLANAR: |
| 121 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 123 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 122 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime | 124 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime |
| (...skipping 26 matching lines...) Expand all Loading... |
| 149 case gfx::BufferFormat::RGBA_8888: | 151 case gfx::BufferFormat::RGBA_8888: |
| 150 case gfx::BufferFormat::RGBX_8888: | 152 case gfx::BufferFormat::RGBX_8888: |
| 151 case gfx::BufferFormat::BGRA_8888: | 153 case gfx::BufferFormat::BGRA_8888: |
| 152 case gfx::BufferFormat::BGRX_8888: | 154 case gfx::BufferFormat::BGRX_8888: |
| 153 return true; | 155 return true; |
| 154 case gfx::BufferFormat::YVU_420: | 156 case gfx::BufferFormat::YVU_420: |
| 155 case gfx::BufferFormat::YUV_420_BIPLANAR: | 157 case gfx::BufferFormat::YUV_420_BIPLANAR: |
| 156 // U and V planes are subsampled by a factor of 2. | 158 // U and V planes are subsampled by a factor of 2. |
| 157 return size.width() % 2 == 0 && size.height() % 2 == 0; | 159 return size.width() % 2 == 0 && size.height() % 2 == 0; |
| 158 case gfx::BufferFormat::UYVY_422: | 160 case gfx::BufferFormat::UYVY_422: |
| 161 case gfx::BufferFormat::YUYV_422: |
| 159 return size.width() % 2 == 0; | 162 return size.width() % 2 == 0; |
| 160 } | 163 } |
| 161 | 164 |
| 162 NOTREACHED(); | 165 NOTREACHED(); |
| 163 return false; | 166 return false; |
| 164 } | 167 } |
| 165 | 168 |
| 166 } // namespace gpu | 169 } // namespace gpu |
| OLD | NEW |