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

Side by Side Diff: gpu/command_buffer/service/image_factory.cc

Issue 1327513003: Merge to M46 for BUG=510252 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2490
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | media/blink/skcanvas_video_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/service/image_factory.h" 5 #include "gpu/command_buffer/service/image_factory.h"
6 6
7 #include "gpu/command_buffer/common/capabilities.h" 7 #include "gpu/command_buffer/common/capabilities.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 9
10 namespace gpu { 10 namespace gpu {
(...skipping 21 matching lines...) Expand all
32 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 32 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
33 return gfx::BufferFormat::ATCIA; 33 return gfx::BufferFormat::ATCIA;
34 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 34 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
35 return gfx::BufferFormat::DXT1; 35 return gfx::BufferFormat::DXT1;
36 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: 36 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
37 return gfx::BufferFormat::DXT5; 37 return gfx::BufferFormat::DXT5;
38 case GL_ETC1_RGB8_OES: 38 case GL_ETC1_RGB8_OES:
39 return gfx::BufferFormat::ETC1; 39 return gfx::BufferFormat::ETC1;
40 case GL_RGB_YUV_420_CHROMIUM: 40 case GL_RGB_YUV_420_CHROMIUM:
41 return gfx::BufferFormat::YUV_420; 41 return gfx::BufferFormat::YUV_420;
42 case GL_RGB_YCBCR_422_CHROMIUM:
43 return gfx::BufferFormat::UYVY_422;
42 default: 44 default:
43 NOTREACHED(); 45 NOTREACHED();
44 return gfx::BufferFormat::RGBA_8888; 46 return gfx::BufferFormat::RGBA_8888;
45 } 47 }
46 } 48 }
47 49
48 // static 50 // static
49 gfx::BufferUsage ImageFactory::ImageUsageToGpuMemoryBufferUsage( 51 gfx::BufferUsage ImageFactory::ImageUsageToGpuMemoryBufferUsage(
50 unsigned usage) { 52 unsigned usage) {
51 switch (usage) { 53 switch (usage) {
(...skipping 15 matching lines...) Expand all
67 case gfx::BufferFormat::ATC: 69 case gfx::BufferFormat::ATC:
68 case gfx::BufferFormat::ATCIA: 70 case gfx::BufferFormat::ATCIA:
69 case gfx::BufferFormat::BGRA_8888: 71 case gfx::BufferFormat::BGRA_8888:
70 case gfx::BufferFormat::BGRX_8888: 72 case gfx::BufferFormat::BGRX_8888:
71 case gfx::BufferFormat::DXT1: 73 case gfx::BufferFormat::DXT1:
72 case gfx::BufferFormat::DXT5: 74 case gfx::BufferFormat::DXT5:
73 case gfx::BufferFormat::ETC1: 75 case gfx::BufferFormat::ETC1:
74 case gfx::BufferFormat::R_8: 76 case gfx::BufferFormat::R_8:
75 case gfx::BufferFormat::RGBA_8888: 77 case gfx::BufferFormat::RGBA_8888:
76 case gfx::BufferFormat::YUV_420: 78 case gfx::BufferFormat::YUV_420:
79 case gfx::BufferFormat::UYVY_422:
77 return format == DefaultBufferFormatForImageFormat(internalformat); 80 return format == DefaultBufferFormatForImageFormat(internalformat);
78 case gfx::BufferFormat::RGBA_4444: 81 case gfx::BufferFormat::RGBA_4444:
79 return internalformat == GL_RGBA; 82 return internalformat == GL_RGBA;
80 case gfx::BufferFormat::UYVY_422:
81 return internalformat == GL_RGB;
82 } 83 }
83 84
84 NOTREACHED(); 85 NOTREACHED();
85 return false; 86 return false;
86 } 87 }
87 88
88 // static 89 // static
89 bool ImageFactory::IsGpuMemoryBufferFormatSupported( 90 bool ImageFactory::IsGpuMemoryBufferFormatSupported(
90 gfx::BufferFormat format, 91 gfx::BufferFormat format,
91 const gpu::Capabilities& capabilities) { 92 const gpu::Capabilities& capabilities) {
92 switch (format) { 93 switch (format) {
93 case gfx::BufferFormat::ATC: 94 case gfx::BufferFormat::ATC:
94 case gfx::BufferFormat::ATCIA: 95 case gfx::BufferFormat::ATCIA:
95 return capabilities.texture_format_atc; 96 return capabilities.texture_format_atc;
96 case gfx::BufferFormat::BGRA_8888: 97 case gfx::BufferFormat::BGRA_8888:
97 return capabilities.texture_format_bgra8888; 98 return capabilities.texture_format_bgra8888;
98 case gfx::BufferFormat::DXT1: 99 case gfx::BufferFormat::DXT1:
99 return capabilities.texture_format_dxt1; 100 return capabilities.texture_format_dxt1;
100 case gfx::BufferFormat::DXT5: 101 case gfx::BufferFormat::DXT5:
101 return capabilities.texture_format_dxt5; 102 return capabilities.texture_format_dxt5;
102 case gfx::BufferFormat::ETC1: 103 case gfx::BufferFormat::ETC1:
103 return capabilities.texture_format_etc1; 104 return capabilities.texture_format_etc1;
104 case gfx::BufferFormat::R_8: 105 case gfx::BufferFormat::R_8:
105 return capabilities.texture_rg; 106 return capabilities.texture_rg;
107 case gfx::BufferFormat::UYVY_422:
108 return capabilities.image_ycbcr_422;
106 case gfx::BufferFormat::RGBA_4444: 109 case gfx::BufferFormat::RGBA_4444:
107 case gfx::BufferFormat::RGBA_8888: 110 case gfx::BufferFormat::RGBA_8888:
108 case gfx::BufferFormat::BGRX_8888: 111 case gfx::BufferFormat::BGRX_8888:
109 case gfx::BufferFormat::YUV_420: 112 case gfx::BufferFormat::YUV_420:
110 case gfx::BufferFormat::UYVY_422:
111 return true; 113 return true;
112 } 114 }
113 115
114 NOTREACHED(); 116 NOTREACHED();
115 return false; 117 return false;
116 } 118 }
117 119
118 // static 120 // static
119 bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( 121 bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
120 const gfx::Size& size, 122 const gfx::Size& size,
(...skipping 18 matching lines...) Expand all
139 return size.width() % 2 == 0 && size.height() % 2 == 0; 141 return size.width() % 2 == 0 && size.height() % 2 == 0;
140 case gfx::BufferFormat::UYVY_422: 142 case gfx::BufferFormat::UYVY_422:
141 return size.width() % 2 == 0; 143 return size.width() % 2 == 0;
142 } 144 }
143 145
144 NOTREACHED(); 146 NOTREACHED();
145 return false; 147 return false;
146 } 148 }
147 149
148 } // namespace gpu 150 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | media/blink/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698