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

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

Issue 1415723006: ui: Add RGBX_8888 buffer format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gles but no conversion needed case Created 5 years, 2 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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 switch (format) { 68 switch (format) {
69 case gfx::BufferFormat::ATC: 69 case gfx::BufferFormat::ATC:
70 case gfx::BufferFormat::ATCIA: 70 case gfx::BufferFormat::ATCIA:
71 case gfx::BufferFormat::BGRA_8888: 71 case gfx::BufferFormat::BGRA_8888:
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::RGBA_8888: 77 case gfx::BufferFormat::RGBA_8888:
78 case gfx::BufferFormat::RGBX_8888:
78 case gfx::BufferFormat::YUV_420: 79 case gfx::BufferFormat::YUV_420:
79 case gfx::BufferFormat::YUV_420_BIPLANAR: 80 case gfx::BufferFormat::YUV_420_BIPLANAR:
80 case gfx::BufferFormat::UYVY_422: 81 case gfx::BufferFormat::UYVY_422:
81 return format == DefaultBufferFormatForImageFormat(internalformat); 82 return format == DefaultBufferFormatForImageFormat(internalformat);
82 case gfx::BufferFormat::RGBA_4444: 83 case gfx::BufferFormat::RGBA_4444:
83 return internalformat == GL_RGBA; 84 return internalformat == GL_RGBA;
84 } 85 }
85 86
86 NOTREACHED(); 87 NOTREACHED();
87 return false; 88 return false;
88 } 89 }
89 90
90 // static 91 // static
91 bool ImageFactory::IsGpuMemoryBufferFormatSupported( 92 bool ImageFactory::IsGpuMemoryBufferFormatSupported(
92 gfx::BufferFormat format, 93 gfx::BufferFormat format,
93 const gpu::Capabilities& capabilities) { 94 const gpu::Capabilities& capabilities) {
94 switch (format) { 95 switch (format) {
95 case gfx::BufferFormat::ATC: 96 case gfx::BufferFormat::ATC:
96 case gfx::BufferFormat::ATCIA: 97 case gfx::BufferFormat::ATCIA:
97 return capabilities.texture_format_atc; 98 return capabilities.texture_format_atc;
98 case gfx::BufferFormat::BGRA_8888: 99 case gfx::BufferFormat::BGRA_8888:
100 case gfx::BufferFormat::BGRX_8888:
99 return capabilities.texture_format_bgra8888; 101 return capabilities.texture_format_bgra8888;
100 case gfx::BufferFormat::DXT1: 102 case gfx::BufferFormat::DXT1:
101 return capabilities.texture_format_dxt1; 103 return capabilities.texture_format_dxt1;
102 case gfx::BufferFormat::DXT5: 104 case gfx::BufferFormat::DXT5:
103 return capabilities.texture_format_dxt5; 105 return capabilities.texture_format_dxt5;
104 case gfx::BufferFormat::ETC1: 106 case gfx::BufferFormat::ETC1:
105 return capabilities.texture_format_etc1; 107 return capabilities.texture_format_etc1;
106 case gfx::BufferFormat::R_8: 108 case gfx::BufferFormat::R_8:
107 return capabilities.texture_rg; 109 return capabilities.texture_rg;
108 case gfx::BufferFormat::UYVY_422: 110 case gfx::BufferFormat::UYVY_422:
109 return capabilities.image_ycbcr_422; 111 return capabilities.image_ycbcr_422;
110 case gfx::BufferFormat::RGBA_4444: 112 case gfx::BufferFormat::RGBA_4444:
111 case gfx::BufferFormat::RGBA_8888: 113 case gfx::BufferFormat::RGBA_8888:
112 case gfx::BufferFormat::BGRX_8888: 114 case gfx::BufferFormat::RGBX_8888:
113 case gfx::BufferFormat::YUV_420: 115 case gfx::BufferFormat::YUV_420:
114 return true; 116 return true;
115 case gfx::BufferFormat::YUV_420_BIPLANAR: 117 case gfx::BufferFormat::YUV_420_BIPLANAR:
116 return false; 118 return false;
117 } 119 }
118 120
119 NOTREACHED(); 121 NOTREACHED();
120 return false; 122 return false;
121 } 123 }
122 124
123 // static 125 // static
124 bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( 126 bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
125 const gfx::Size& size, 127 const gfx::Size& size,
126 gfx::BufferFormat format) { 128 gfx::BufferFormat format) {
127 switch (format) { 129 switch (format) {
128 case gfx::BufferFormat::ATC: 130 case gfx::BufferFormat::ATC:
129 case gfx::BufferFormat::ATCIA: 131 case gfx::BufferFormat::ATCIA:
130 case gfx::BufferFormat::DXT1: 132 case gfx::BufferFormat::DXT1:
131 case gfx::BufferFormat::DXT5: 133 case gfx::BufferFormat::DXT5:
132 case gfx::BufferFormat::ETC1: 134 case gfx::BufferFormat::ETC1:
133 // Compressed images must have a width and height that's evenly divisible 135 // Compressed images must have a width and height that's evenly divisible
134 // by the block size. 136 // by the block size.
135 return size.width() % 4 == 0 && size.height() % 4 == 0; 137 return size.width() % 4 == 0 && size.height() % 4 == 0;
136 case gfx::BufferFormat::R_8: 138 case gfx::BufferFormat::R_8:
137 case gfx::BufferFormat::RGBA_4444: 139 case gfx::BufferFormat::RGBA_4444:
138 case gfx::BufferFormat::RGBA_8888: 140 case gfx::BufferFormat::RGBA_8888:
141 case gfx::BufferFormat::RGBX_8888:
139 case gfx::BufferFormat::BGRA_8888: 142 case gfx::BufferFormat::BGRA_8888:
140 case gfx::BufferFormat::BGRX_8888: 143 case gfx::BufferFormat::BGRX_8888:
141 return true; 144 return true;
142 case gfx::BufferFormat::YUV_420: 145 case gfx::BufferFormat::YUV_420:
143 case gfx::BufferFormat::YUV_420_BIPLANAR: 146 case gfx::BufferFormat::YUV_420_BIPLANAR:
144 // U and V planes are subsampled by a factor of 2. 147 // U and V planes are subsampled by a factor of 2.
145 return size.width() % 2 == 0 && size.height() % 2 == 0; 148 return size.width() % 2 == 0 && size.height() % 2 == 0;
146 case gfx::BufferFormat::UYVY_422: 149 case gfx::BufferFormat::UYVY_422:
147 return size.width() % 2 == 0; 150 return size.width() % 2 == 0;
148 } 151 }
149 152
150 NOTREACHED(); 153 NOTREACHED();
151 return false; 154 return false;
152 } 155 }
153 156
154 } // namespace gpu 157 } // namespace gpu
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_io_surface.cc ('k') | gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698