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

Side by Side Diff: ui/gl/gl_image_io_surface.mm

Issue 1741513002: Revert of gpu: Expose internal format R8 instead of RED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « media/video/gpu_memory_buffer_video_frame_pool.cc ('k') | ui/gl/gl_image_memory.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/gl/gl_image_io_surface.h" 5 #include "ui/gl/gl_image_io_surface.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "base/strings/stringize_macros.h" 11 #include "base/strings/stringize_macros.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/trace_event/memory_allocator_dump.h" 13 #include "base/trace_event/memory_allocator_dump.h"
14 #include "base/trace_event/memory_dump_manager.h" 14 #include "base/trace_event/memory_dump_manager.h"
15 #include "base/trace_event/process_memory_dump.h" 15 #include "base/trace_event/process_memory_dump.h"
16 #include "ui/gl/gl_bindings.h" 16 #include "ui/gl/gl_bindings.h"
17 #include "ui/gl/gl_context.h" 17 #include "ui/gl/gl_context.h"
18 #include "ui/gl/gl_helper.h" 18 #include "ui/gl/gl_helper.h"
19 #include "ui/gl/gl_version_info.h"
20 #include "ui/gl/scoped_binders.h" 19 #include "ui/gl/scoped_binders.h"
21 20
22 // Note that this must be included after gl_bindings.h to avoid conflicts. 21 // Note that this must be included after gl_bindings.h to avoid conflicts.
23 #include <OpenGL/CGLIOSurface.h> 22 #include <OpenGL/CGLIOSurface.h>
24 #include <Quartz/Quartz.h> 23 #include <Quartz/Quartz.h>
25 #include <stddef.h> 24 #include <stddef.h>
26 25
27 using gfx::BufferFormat; 26 using gfx::BufferFormat;
28 27
29 namespace gl { 28 namespace gl {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 vec3 yuv = vec3( 61 vec3 yuv = vec3(
63 texture2DRect(a_y_texture, v_texCoord).r, 62 texture2DRect(a_y_texture, v_texCoord).r,
64 texture2DRect(a_uv_texture, v_texCoord * 0.5).rg); 63 texture2DRect(a_uv_texture, v_texCoord * 0.5).rg);
65 gl_FragColor = vec4(yuv_matrix * (yuv + yuv_adj), 1.0); 64 gl_FragColor = vec4(yuv_matrix * (yuv + yuv_adj), 1.0);
66 } 65 }
67 ); 66 );
68 // clang-format on 67 // clang-format on
69 68
70 bool ValidInternalFormat(unsigned internalformat) { 69 bool ValidInternalFormat(unsigned internalformat) {
71 switch (internalformat) { 70 switch (internalformat) {
72 case GL_R8: 71 case GL_RED:
73 case GL_BGRA_EXT: 72 case GL_BGRA_EXT:
74 case GL_RGB: 73 case GL_RGB:
75 case GL_RGB_YCBCR_420V_CHROMIUM: 74 case GL_RGB_YCBCR_420V_CHROMIUM:
76 case GL_RGB_YCBCR_422_CHROMIUM: 75 case GL_RGB_YCBCR_422_CHROMIUM:
77 case GL_RGBA: 76 case GL_RGBA:
78 return true; 77 return true;
79 default: 78 default:
80 return false; 79 return false;
81 } 80 }
82 } 81 }
(...skipping 18 matching lines...) Expand all
101 return false; 100 return false;
102 } 101 }
103 102
104 NOTREACHED(); 103 NOTREACHED();
105 return false; 104 return false;
106 } 105 }
107 106
108 GLenum TextureFormat(BufferFormat format) { 107 GLenum TextureFormat(BufferFormat format) {
109 switch (format) { 108 switch (format) {
110 case BufferFormat::R_8: 109 case BufferFormat::R_8:
111 return gfx::GLContext::GetCurrent()->GetVersionInfo()->IsES3Capable() 110 return GL_RED;
112 ? GL_R8
113 : GL_RED;
114 case BufferFormat::BGRA_8888: 111 case BufferFormat::BGRA_8888:
115 case BufferFormat::RGBA_8888: 112 case BufferFormat::RGBA_8888:
116 return GL_RGBA; 113 return GL_RGBA;
117 case BufferFormat::UYVY_422: 114 case BufferFormat::UYVY_422:
118 return GL_RGB; 115 return GL_RGB;
119 case BufferFormat::YUV_420_BIPLANAR: 116 case BufferFormat::YUV_420_BIPLANAR:
120 return GL_RGB_YCBCR_420V_CHROMIUM; 117 return GL_RGB_YCBCR_420V_CHROMIUM;
121 case BufferFormat::ATC: 118 case BufferFormat::ATC:
122 case BufferFormat::ATCIA: 119 case BufferFormat::ATCIA:
123 case BufferFormat::DXT1: 120 case BufferFormat::DXT1:
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 g_widget_to_layer_map.Pointer()->erase(widget); 418 g_widget_to_layer_map.Pointer()->erase(widget);
422 } 419 }
423 420
424 // static 421 // static
425 unsigned GLImageIOSurface::GetInternalFormatForTesting( 422 unsigned GLImageIOSurface::GetInternalFormatForTesting(
426 gfx::BufferFormat format) { 423 gfx::BufferFormat format) {
427 DCHECK(ValidFormat(format)); 424 DCHECK(ValidFormat(format));
428 return TextureFormat(format); 425 return TextureFormat(format);
429 } 426 }
430 } // namespace gl 427 } // namespace gl
OLDNEW
« no previous file with comments | « media/video/gpu_memory_buffer_video_frame_pool.cc ('k') | ui/gl/gl_image_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698