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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 case GL_RGB_YCBCR_422_CHROMIUM: | 43 case GL_RGB_YCBCR_422_CHROMIUM: |
44 return gfx::BufferFormat::UYVY_422; | 44 return gfx::BufferFormat::UYVY_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) { | |
54 switch (internalformat) { | |
55 case GL_RGB: | |
56 return gfx::BufferFormat::BGRX_8888; | |
57 case GL_RGBA: | |
58 return gfx::BufferFormat::RGBA_8888; | |
59 default: | |
60 NOTREACHED(); | |
61 return gfx::BufferFormat::RGBA_8888; | |
62 } | |
63 } | |
64 | |
65 bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 53 bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
66 unsigned internalformat, | 54 unsigned internalformat, |
67 gfx::BufferFormat format) { | 55 gfx::BufferFormat format) { |
68 switch (format) { | 56 switch (format) { |
69 case gfx::BufferFormat::ATC: | 57 case gfx::BufferFormat::ATC: |
70 case gfx::BufferFormat::ATCIA: | 58 case gfx::BufferFormat::ATCIA: |
71 case gfx::BufferFormat::BGRA_8888: | 59 case gfx::BufferFormat::BGRA_8888: |
72 case gfx::BufferFormat::BGRX_8888: | 60 case gfx::BufferFormat::BGRX_8888: |
73 case gfx::BufferFormat::DXT1: | 61 case gfx::BufferFormat::DXT1: |
74 case gfx::BufferFormat::DXT5: | 62 case gfx::BufferFormat::DXT5: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return size.width() % 2 == 0 && size.height() % 2 == 0; | 150 return size.width() % 2 == 0 && size.height() % 2 == 0; |
163 case gfx::BufferFormat::UYVY_422: | 151 case gfx::BufferFormat::UYVY_422: |
164 return size.width() % 2 == 0; | 152 return size.width() % 2 == 0; |
165 } | 153 } |
166 | 154 |
167 NOTREACHED(); | 155 NOTREACHED(); |
168 return false; | 156 return false; |
169 } | 157 } |
170 | 158 |
171 } // namespace gpu | 159 } // namespace gpu |
OLD | NEW |