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

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

Issue 962723002: Change CHROMIUM_image declarations to support multi planar input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle through IPC. Created 5 years, 9 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 "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 10
11 ImageFactory::ImageFactory() { 11 ImageFactory::ImageFactory() {
12 } 12 }
13 13
14 ImageFactory::~ImageFactory() { 14 ImageFactory::~ImageFactory() {
15 } 15 }
16 16
17 // static 17 // static
18 gfx::GpuMemoryBuffer::Format ImageFactory::ImageFormatToGpuMemoryBufferFormat( 18 int ImageFactory::GpuMemoryBufferCountForImageFormat(unsigned internalformat) {
19 unsigned internalformat) {
20 switch (internalformat) { 19 switch (internalformat) {
21 case GL_RGB: 20 case GL_RGB:
22 return gfx::GpuMemoryBuffer::RGBX_8888;
23 case GL_RGBA: 21 case GL_RGBA:
24 return gfx::GpuMemoryBuffer::RGBA_8888;
25 case GL_ATC_RGB_AMD: 22 case GL_ATC_RGB_AMD:
26 return gfx::GpuMemoryBuffer::ATC;
27 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 23 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
28 return gfx::GpuMemoryBuffer::ATCIA;
29 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 24 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
30 return gfx::GpuMemoryBuffer::DXT1;
31 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: 25 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
32 return gfx::GpuMemoryBuffer::DXT5;
33 case GL_ETC1_RGB8_OES: 26 case GL_ETC1_RGB8_OES:
34 return gfx::GpuMemoryBuffer::ETC1; 27 return 1;
35 default: 28 default:
36 NOTREACHED(); 29 NOTREACHED();
37 return gfx::GpuMemoryBuffer::RGBA_8888; 30 return 1;
reveman 2015/03/04 05:56:00 return 0 in this case?
emircan 2015/03/04 23:31:50 Done.
38 } 31 }
39 } 32 }
40 33
34 // static
35 void ImageFactory::ImageFormatToGpuMemoryBufferFormats(
36 unsigned internalformat,
37 std::vector<gfx::GpuMemoryBuffer::Format>* formats) {
38 switch (internalformat) {
39 case GL_RGB:
40 case GL_RGBA:
41 formats->push_back(gfx::GpuMemoryBuffer::RGBA_8888);
42 return;
43 case GL_ATC_RGB_AMD:
44 formats->push_back(gfx::GpuMemoryBuffer::ATC);
45 return;
46 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
47 formats->push_back(gfx::GpuMemoryBuffer::ATCIA);
48 return;
49 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
50 formats->push_back(gfx::GpuMemoryBuffer::DXT1);
51 return;
52 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
53 formats->push_back(gfx::GpuMemoryBuffer::DXT5);
54 return;
55 case GL_ETC1_RGB8_OES:
56 formats->push_back(gfx::GpuMemoryBuffer::ETC1);
57 return;
58 default:
59 NOTREACHED();
60 formats->push_back(gfx::GpuMemoryBuffer::RGBA_8888);
61 return;
62 }
63 }
64
41 // static 65 // static
42 gfx::GpuMemoryBuffer::Usage ImageFactory::ImageUsageToGpuMemoryBufferUsage( 66 gfx::GpuMemoryBuffer::Usage ImageFactory::ImageUsageToGpuMemoryBufferUsage(
43 unsigned usage) { 67 unsigned usage) {
44 switch (usage) { 68 switch (usage) {
45 case GL_MAP_CHROMIUM: 69 case GL_MAP_CHROMIUM:
46 return gfx::GpuMemoryBuffer::MAP; 70 return gfx::GpuMemoryBuffer::MAP;
47 case GL_SCANOUT_CHROMIUM: 71 case GL_SCANOUT_CHROMIUM:
48 return gfx::GpuMemoryBuffer::SCANOUT; 72 return gfx::GpuMemoryBuffer::SCANOUT;
49 default: 73 default:
50 NOTREACHED(); 74 NOTREACHED();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 111 }
88 NOTREACHED(); 112 NOTREACHED();
89 return false; 113 return false;
90 default: 114 default:
91 NOTREACHED(); 115 NOTREACHED();
92 return false; 116 return false;
93 } 117 }
94 } 118 }
95 119
96 } // namespace gpu 120 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698