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

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: add trace event 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
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 }
81
82 NOTREACHED();
83 return false;
67 } 84 }
68 85
69 // static 86 // static
70 bool ImageFactory::IsGpuMemoryBufferFormatSupported( 87 bool ImageFactory::IsGpuMemoryBufferFormatSupported(
71 gfx::BufferFormat format, 88 gfx::BufferFormat format,
72 const gpu::Capabilities& capabilities) { 89 const gpu::Capabilities& capabilities) {
73 switch (format) { 90 switch (format) {
74 case gfx::BufferFormat::ATC: 91 case gfx::BufferFormat::ATC:
75 case gfx::BufferFormat::ATCIA: 92 case gfx::BufferFormat::ATCIA:
76 return capabilities.texture_format_atc; 93 return capabilities.texture_format_atc;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 case gfx::BufferFormat::YUV_420: 134 case gfx::BufferFormat::YUV_420:
118 // U and V planes are subsampled by a factor of 2. 135 // U and V planes are subsampled by a factor of 2.
119 return size.width() % 2 == 0 && size.height() % 2 == 0; 136 return size.width() % 2 == 0 && size.height() % 2 == 0;
120 } 137 }
121 138
122 NOTREACHED(); 139 NOTREACHED();
123 return false; 140 return false;
124 } 141 }
125 142
126 } // namespace gpu 143 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698