OLD | NEW |
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/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/mac/bind_objc_block.h" | 10 #include "base/mac/bind_objc_block.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 return false; | 43 return false; |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 bool ValidFormat(gfx::BufferFormat format) { | 47 bool ValidFormat(gfx::BufferFormat format) { |
48 switch (format) { | 48 switch (format) { |
49 case gfx::BufferFormat::R_8: | 49 case gfx::BufferFormat::R_8: |
50 case gfx::BufferFormat::BGRA_8888: | 50 case gfx::BufferFormat::BGRA_8888: |
51 case gfx::BufferFormat::BGRX_8888: | 51 case gfx::BufferFormat::BGRX_8888: |
52 case gfx::BufferFormat::RGBA_8888: | 52 case gfx::BufferFormat::RGBA_8888: |
| 53 case gfx::BufferFormat::RGBA_F16: |
53 case gfx::BufferFormat::UYVY_422: | 54 case gfx::BufferFormat::UYVY_422: |
54 case gfx::BufferFormat::YUV_420_BIPLANAR: | 55 case gfx::BufferFormat::YUV_420_BIPLANAR: |
55 return true; | 56 return true; |
56 case gfx::BufferFormat::RG_88: | 57 case gfx::BufferFormat::RG_88: |
57 case gfx::BufferFormat::ATC: | 58 case gfx::BufferFormat::ATC: |
58 case gfx::BufferFormat::ATCIA: | 59 case gfx::BufferFormat::ATCIA: |
59 case gfx::BufferFormat::DXT1: | 60 case gfx::BufferFormat::DXT1: |
60 case gfx::BufferFormat::DXT5: | 61 case gfx::BufferFormat::DXT5: |
61 case gfx::BufferFormat::ETC1: | 62 case gfx::BufferFormat::ETC1: |
62 case gfx::BufferFormat::BGR_565: | 63 case gfx::BufferFormat::BGR_565: |
63 case gfx::BufferFormat::RGBA_4444: | 64 case gfx::BufferFormat::RGBA_4444: |
64 case gfx::BufferFormat::RGBX_8888: | 65 case gfx::BufferFormat::RGBX_8888: |
65 case gfx::BufferFormat::YVU_420: | 66 case gfx::BufferFormat::YVU_420: |
66 return false; | 67 return false; |
67 } | 68 } |
68 | 69 |
69 NOTREACHED(); | 70 NOTREACHED(); |
70 return false; | 71 return false; |
71 } | 72 } |
72 | 73 |
73 GLenum TextureFormat(gfx::BufferFormat format) { | 74 GLenum TextureFormat(gfx::BufferFormat format) { |
74 switch (format) { | 75 switch (format) { |
75 case gfx::BufferFormat::R_8: | 76 case gfx::BufferFormat::R_8: |
76 return GL_RED; | 77 return GL_RED; |
77 case gfx::BufferFormat::RG_88: | 78 case gfx::BufferFormat::RG_88: |
78 return GL_RG; | 79 return GL_RG; |
79 case gfx::BufferFormat::BGRA_8888: | 80 case gfx::BufferFormat::BGRA_8888: |
80 case gfx::BufferFormat::BGRX_8888: | 81 case gfx::BufferFormat::BGRX_8888: |
81 case gfx::BufferFormat::RGBA_8888: | 82 case gfx::BufferFormat::RGBA_8888: |
| 83 case gfx::BufferFormat::RGBA_F16: |
82 return GL_RGBA; | 84 return GL_RGBA; |
83 case gfx::BufferFormat::UYVY_422: | 85 case gfx::BufferFormat::UYVY_422: |
84 return GL_RGB; | 86 return GL_RGB; |
85 case gfx::BufferFormat::YUV_420_BIPLANAR: | 87 case gfx::BufferFormat::YUV_420_BIPLANAR: |
86 return GL_RGB_YCBCR_420V_CHROMIUM; | 88 return GL_RGB_YCBCR_420V_CHROMIUM; |
87 case gfx::BufferFormat::ATC: | 89 case gfx::BufferFormat::ATC: |
88 case gfx::BufferFormat::ATCIA: | 90 case gfx::BufferFormat::ATCIA: |
89 case gfx::BufferFormat::DXT1: | 91 case gfx::BufferFormat::DXT1: |
90 case gfx::BufferFormat::DXT5: | 92 case gfx::BufferFormat::DXT5: |
91 case gfx::BufferFormat::ETC1: | 93 case gfx::BufferFormat::ETC1: |
(...skipping 12 matching lines...) Expand all Loading... |
104 GLenum DataFormat(gfx::BufferFormat format) { | 106 GLenum DataFormat(gfx::BufferFormat format) { |
105 switch (format) { | 107 switch (format) { |
106 case gfx::BufferFormat::R_8: | 108 case gfx::BufferFormat::R_8: |
107 return GL_RED; | 109 return GL_RED; |
108 case gfx::BufferFormat::RG_88: | 110 case gfx::BufferFormat::RG_88: |
109 return GL_RG; | 111 return GL_RG; |
110 case gfx::BufferFormat::BGRA_8888: | 112 case gfx::BufferFormat::BGRA_8888: |
111 case gfx::BufferFormat::BGRX_8888: | 113 case gfx::BufferFormat::BGRX_8888: |
112 case gfx::BufferFormat::RGBA_8888: | 114 case gfx::BufferFormat::RGBA_8888: |
113 return GL_BGRA; | 115 return GL_BGRA; |
| 116 case gfx::BufferFormat::RGBA_F16: |
| 117 return GL_RGBA; |
114 case gfx::BufferFormat::UYVY_422: | 118 case gfx::BufferFormat::UYVY_422: |
115 return GL_YCBCR_422_APPLE; | 119 return GL_YCBCR_422_APPLE; |
116 case gfx::BufferFormat::ATC: | 120 case gfx::BufferFormat::ATC: |
117 case gfx::BufferFormat::ATCIA: | 121 case gfx::BufferFormat::ATCIA: |
118 case gfx::BufferFormat::DXT1: | 122 case gfx::BufferFormat::DXT1: |
119 case gfx::BufferFormat::DXT5: | 123 case gfx::BufferFormat::DXT5: |
120 case gfx::BufferFormat::ETC1: | 124 case gfx::BufferFormat::ETC1: |
121 case gfx::BufferFormat::BGR_565: | 125 case gfx::BufferFormat::BGR_565: |
122 case gfx::BufferFormat::RGBA_4444: | 126 case gfx::BufferFormat::RGBA_4444: |
123 case gfx::BufferFormat::RGBX_8888: | 127 case gfx::BufferFormat::RGBX_8888: |
124 case gfx::BufferFormat::YVU_420: | 128 case gfx::BufferFormat::YVU_420: |
125 case gfx::BufferFormat::YUV_420_BIPLANAR: | 129 case gfx::BufferFormat::YUV_420_BIPLANAR: |
126 NOTREACHED(); | 130 NOTREACHED(); |
127 return 0; | 131 return 0; |
128 } | 132 } |
129 | 133 |
130 NOTREACHED(); | 134 NOTREACHED(); |
131 return 0; | 135 return 0; |
132 } | 136 } |
133 | 137 |
134 GLenum DataType(gfx::BufferFormat format) { | 138 GLenum DataType(gfx::BufferFormat format) { |
135 switch (format) { | 139 switch (format) { |
136 case gfx::BufferFormat::R_8: | 140 case gfx::BufferFormat::R_8: |
137 case gfx::BufferFormat::RG_88: | 141 case gfx::BufferFormat::RG_88: |
138 return GL_UNSIGNED_BYTE; | 142 return GL_UNSIGNED_BYTE; |
139 case gfx::BufferFormat::BGRA_8888: | 143 case gfx::BufferFormat::BGRA_8888: |
140 case gfx::BufferFormat::BGRX_8888: | 144 case gfx::BufferFormat::BGRX_8888: |
141 case gfx::BufferFormat::RGBA_8888: | 145 case gfx::BufferFormat::RGBA_8888: |
142 return GL_UNSIGNED_INT_8_8_8_8_REV; | 146 return GL_UNSIGNED_INT_8_8_8_8_REV; |
| 147 case gfx::BufferFormat::RGBA_F16: |
| 148 return GL_HALF_APPLE; |
143 case gfx::BufferFormat::UYVY_422: | 149 case gfx::BufferFormat::UYVY_422: |
144 return GL_UNSIGNED_SHORT_8_8_APPLE; | 150 return GL_UNSIGNED_SHORT_8_8_APPLE; |
145 break; | 151 break; |
146 case gfx::BufferFormat::ATC: | 152 case gfx::BufferFormat::ATC: |
147 case gfx::BufferFormat::ATCIA: | 153 case gfx::BufferFormat::ATCIA: |
148 case gfx::BufferFormat::DXT1: | 154 case gfx::BufferFormat::DXT1: |
149 case gfx::BufferFormat::DXT5: | 155 case gfx::BufferFormat::DXT5: |
150 case gfx::BufferFormat::ETC1: | 156 case gfx::BufferFormat::ETC1: |
151 case gfx::BufferFormat::BGR_565: | 157 case gfx::BufferFormat::BGR_565: |
152 case gfx::BufferFormat::RGBA_4444: | 158 case gfx::BufferFormat::RGBA_4444: |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 409 } |
404 | 410 |
405 // static | 411 // static |
406 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { | 412 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { |
407 if (!image || image->GetType() != Type::IOSURFACE) | 413 if (!image || image->GetType() != Type::IOSURFACE) |
408 return nullptr; | 414 return nullptr; |
409 return static_cast<GLImageIOSurface*>(image); | 415 return static_cast<GLImageIOSurface*>(image); |
410 } | 416 } |
411 | 417 |
412 } // namespace gl | 418 } // namespace gl |
OLD | NEW |