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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 return format == BufferFormatForInternalFormat(internalformat); | 82 return format == BufferFormatForInternalFormat(internalformat); |
83 case gfx::BufferFormat::BGR_565: | 83 case gfx::BufferFormat::BGR_565: |
84 case gfx::BufferFormat::RGBX_8888: | 84 case gfx::BufferFormat::RGBX_8888: |
85 return internalformat == GL_RGB; | 85 return internalformat == GL_RGB; |
86 case gfx::BufferFormat::RGBA_4444: | 86 case gfx::BufferFormat::RGBA_4444: |
87 case gfx::BufferFormat::RGBA_F16: | |
87 return internalformat == GL_RGBA; | 88 return internalformat == GL_RGBA; |
88 } | 89 } |
89 | 90 |
90 NOTREACHED(); | 91 NOTREACHED(); |
91 return false; | 92 return false; |
92 } | 93 } |
93 | 94 |
94 bool IsGpuMemoryBufferFormatSupported(gfx::BufferFormat format, | 95 bool IsGpuMemoryBufferFormatSupported(gfx::BufferFormat format, |
95 const gpu::Capabilities& capabilities) { | 96 const gpu::Capabilities& capabilities) { |
96 switch (format) { | 97 switch (format) { |
(...skipping 13 matching lines...) Expand all Loading... | |
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: |
113 return capabilities.image_ycbcr_422; | 114 return capabilities.image_ycbcr_422; |
114 case gfx::BufferFormat::BGR_565: | 115 case gfx::BufferFormat::BGR_565: |
115 case gfx::BufferFormat::RGBA_4444: | 116 case gfx::BufferFormat::RGBA_4444: |
116 case gfx::BufferFormat::RGBA_8888: | 117 case gfx::BufferFormat::RGBA_8888: |
117 case gfx::BufferFormat::RGBX_8888: | 118 case gfx::BufferFormat::RGBX_8888: |
118 case gfx::BufferFormat::YVU_420: | 119 case gfx::BufferFormat::YVU_420: |
119 return true; | 120 return true; |
121 case gfx::BufferFormat::RGBA_F16: | |
122 return capabilities.texture_half_float_linear; | |
reveman
2017/03/31 09:13:55
This looks fine but we should probably rename this
ccameron
2017/04/11 07:45:11
Thanks for the clarification -- I've gone ahead an
| |
120 case gfx::BufferFormat::YUV_420_BIPLANAR: | 123 case gfx::BufferFormat::YUV_420_BIPLANAR: |
121 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 124 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
122 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime | 125 // TODO(dcastagna): Determine ycbcr_420v_image on CrOS at runtime |
123 // querying minigbm. crbug.com/646148 | 126 // querying minigbm. crbug.com/646148 |
124 return true; | 127 return true; |
125 #else | 128 #else |
126 return capabilities.image_ycbcr_420v; | 129 return capabilities.image_ycbcr_420v; |
127 #endif | 130 #endif |
128 } | 131 } |
129 | 132 |
(...skipping 13 matching lines...) Expand all Loading... | |
143 // by the block size. | 146 // by the block size. |
144 return size.width() % 4 == 0 && size.height() % 4 == 0; | 147 return size.width() % 4 == 0 && size.height() % 4 == 0; |
145 case gfx::BufferFormat::R_8: | 148 case gfx::BufferFormat::R_8: |
146 case gfx::BufferFormat::RG_88: | 149 case gfx::BufferFormat::RG_88: |
147 case gfx::BufferFormat::BGR_565: | 150 case gfx::BufferFormat::BGR_565: |
148 case gfx::BufferFormat::RGBA_4444: | 151 case gfx::BufferFormat::RGBA_4444: |
149 case gfx::BufferFormat::RGBA_8888: | 152 case gfx::BufferFormat::RGBA_8888: |
150 case gfx::BufferFormat::RGBX_8888: | 153 case gfx::BufferFormat::RGBX_8888: |
151 case gfx::BufferFormat::BGRA_8888: | 154 case gfx::BufferFormat::BGRA_8888: |
152 case gfx::BufferFormat::BGRX_8888: | 155 case gfx::BufferFormat::BGRX_8888: |
156 case gfx::BufferFormat::RGBA_F16: | |
153 return true; | 157 return true; |
154 case gfx::BufferFormat::YVU_420: | 158 case gfx::BufferFormat::YVU_420: |
155 case gfx::BufferFormat::YUV_420_BIPLANAR: | 159 case gfx::BufferFormat::YUV_420_BIPLANAR: |
156 // U and V planes are subsampled by a factor of 2. | 160 // U and V planes are subsampled by a factor of 2. |
157 return size.width() % 2 == 0 && size.height() % 2 == 0; | 161 return size.width() % 2 == 0 && size.height() % 2 == 0; |
158 case gfx::BufferFormat::UYVY_422: | 162 case gfx::BufferFormat::UYVY_422: |
159 return size.width() % 2 == 0; | 163 return size.width() % 2 == 0; |
160 } | 164 } |
161 | 165 |
162 NOTREACHED(); | 166 NOTREACHED(); |
163 return false; | 167 return false; |
164 } | 168 } |
165 | 169 |
166 } // namespace gpu | 170 } // namespace gpu |
OLD | NEW |