Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: gpu/command_buffer/common/gpu_memory_buffer_support.cc

Issue 2786103003: Add half-float IOSurface GpuMemoryBuffer support (Closed)
Patch Set: Re-add software support Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 11 matching lines...) Expand all
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:
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:
119 case gfx::BufferFormat::RGBA_F16:
120 return capabilities.texture_half_float_linear;
Daniele Castagna 2017/03/30 21:47:10 Does this return false on all the non-mac platform
ccameron 2017/03/30 23:07:03 Ops, this affected the behavior of the above cases
Daniele Castagna 2017/03/31 00:25:20 Looking at IsGpuMemoryBufferFormatSupported makes
118 case gfx::BufferFormat::YVU_420: 121 case gfx::BufferFormat::YVU_420:
119 return true; 122 return true;
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
(...skipping 15 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698