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

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

Issue 1248253003: Add better support for RGBA_4444 textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and forward flags Created 5 years, 4 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 | « content/renderer/gpu/render_widget_compositor.cc ('k') | ui/compositor/compositor.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 default: 56 default:
57 NOTREACHED(); 57 NOTREACHED();
58 return gfx::BufferUsage::MAP; 58 return gfx::BufferUsage::MAP;
59 } 59 }
60 } 60 }
61 61
62 // static 62 // static
63 bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( 63 bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
64 unsigned internalformat, 64 unsigned internalformat,
65 gfx::BufferFormat format) { 65 gfx::BufferFormat format) {
66 return ImageFormatToGpuMemoryBufferFormat(internalformat) == format; 66 switch (format) {
67 case gfx::BufferFormat::ATC:
68 case gfx::BufferFormat::ATCIA:
69 case gfx::BufferFormat::BGRA_8888:
70 case gfx::BufferFormat::DXT1:
71 case gfx::BufferFormat::DXT5:
72 case gfx::BufferFormat::ETC1:
73 case gfx::BufferFormat::R_8:
74 case gfx::BufferFormat::RGBA_8888:
75 case gfx::BufferFormat::RGBX_8888:
76 case gfx::BufferFormat::YUV_420:
77 return ImageFormatToGpuMemoryBufferFormat(internalformat) == format;
78 case gfx::BufferFormat::RGBA_4444:
79 return internalformat == GL_RGBA;
80 case gfx::BufferFormat::YUV_420_BIPLANAR:
81 return false;
82 }
83
84 NOTREACHED();
85 return false;
67 } 86 }
68 87
69 // static 88 // static
70 bool ImageFactory::IsGpuMemoryBufferFormatSupported( 89 bool ImageFactory::IsGpuMemoryBufferFormatSupported(
71 gfx::BufferFormat format, 90 gfx::BufferFormat format,
72 const gpu::Capabilities& capabilities) { 91 const gpu::Capabilities& capabilities) {
73 switch (format) { 92 switch (format) {
74 case gfx::BufferFormat::ATC: 93 case gfx::BufferFormat::ATC:
75 case gfx::BufferFormat::ATCIA: 94 case gfx::BufferFormat::ATCIA:
76 return capabilities.texture_format_atc; 95 return capabilities.texture_format_atc;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 case gfx::BufferFormat::YUV_420_BIPLANAR: 138 case gfx::BufferFormat::YUV_420_BIPLANAR:
120 // U and V planes are subsampled by a factor of 2. 139 // U and V planes are subsampled by a factor of 2.
121 return size.width() % 2 == 0 && size.height() % 2 == 0; 140 return size.width() % 2 == 0 && size.height() % 2 == 0;
122 } 141 }
123 142
124 NOTREACHED(); 143 NOTREACHED();
125 return false; 144 return false;
126 } 145 }
127 146
128 } // namespace gpu 147 } // namespace gpu
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.cc ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698