OLD | NEW |
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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2chromium.h> | 6 #include <GLES2/gl2chromium.h> |
7 #include <GLES2/gl2ext.h> | 7 #include <GLES2/gl2ext.h> |
8 #include <GLES2/gl2extchromium.h> | 8 #include <GLES2/gl2extchromium.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 case gfx::BufferFormat::BGRA_8888: | 102 case gfx::BufferFormat::BGRA_8888: |
103 for (int i = 0; i < width * 4; i += 4) { | 103 for (int i = 0; i < width * 4; i += 4) { |
104 buffer[i + 0] = pixel[2]; | 104 buffer[i + 0] = pixel[2]; |
105 buffer[i + 1] = pixel[1]; | 105 buffer[i + 1] = pixel[1]; |
106 buffer[i + 2] = pixel[0]; | 106 buffer[i + 2] = pixel[0]; |
107 buffer[i + 3] = pixel[3]; | 107 buffer[i + 3] = pixel[3]; |
108 } | 108 } |
109 return; | 109 return; |
110 case gfx::BufferFormat::ATC: | 110 case gfx::BufferFormat::ATC: |
111 case gfx::BufferFormat::ATCIA: | 111 case gfx::BufferFormat::ATCIA: |
| 112 case gfx::BufferFormat::BGRX_8888: |
112 case gfx::BufferFormat::DXT1: | 113 case gfx::BufferFormat::DXT1: |
113 case gfx::BufferFormat::DXT5: | 114 case gfx::BufferFormat::DXT5: |
114 case gfx::BufferFormat::ETC1: | 115 case gfx::BufferFormat::ETC1: |
115 case gfx::BufferFormat::BGRX_8888: | 116 case gfx::BufferFormat::RGBX_8888: |
| 117 case gfx::BufferFormat::UYVY_422: |
116 case gfx::BufferFormat::YUV_420: | 118 case gfx::BufferFormat::YUV_420: |
117 case gfx::BufferFormat::YUV_420_BIPLANAR: | 119 case gfx::BufferFormat::YUV_420_BIPLANAR: |
118 case gfx::BufferFormat::UYVY_422: | |
119 NOTREACHED(); | 120 NOTREACHED(); |
120 return; | 121 return; |
121 } | 122 } |
122 | 123 |
123 NOTREACHED(); | 124 NOTREACHED(); |
124 } | 125 } |
125 | 126 |
126 GLenum InternalFormat(gfx::BufferFormat format) { | 127 GLenum InternalFormat(gfx::BufferFormat format) { |
127 switch (format) { | 128 switch (format) { |
128 case gfx::BufferFormat::R_8: | 129 case gfx::BufferFormat::R_8: |
129 return GL_R8; | 130 return GL_R8; |
130 case gfx::BufferFormat::RGBA_4444: | 131 case gfx::BufferFormat::RGBA_4444: |
131 case gfx::BufferFormat::RGBA_8888: | 132 case gfx::BufferFormat::RGBA_8888: |
132 return GL_RGBA; | 133 return GL_RGBA; |
133 case gfx::BufferFormat::BGRA_8888: | 134 case gfx::BufferFormat::BGRA_8888: |
134 return GL_BGRA_EXT; | 135 return GL_BGRA_EXT; |
135 case gfx::BufferFormat::ATC: | 136 case gfx::BufferFormat::ATC: |
136 case gfx::BufferFormat::ATCIA: | 137 case gfx::BufferFormat::ATCIA: |
| 138 case gfx::BufferFormat::BGRX_8888: |
137 case gfx::BufferFormat::DXT1: | 139 case gfx::BufferFormat::DXT1: |
138 case gfx::BufferFormat::DXT5: | 140 case gfx::BufferFormat::DXT5: |
139 case gfx::BufferFormat::ETC1: | 141 case gfx::BufferFormat::ETC1: |
140 case gfx::BufferFormat::BGRX_8888: | 142 case gfx::BufferFormat::RGBX_8888: |
| 143 case gfx::BufferFormat::UYVY_422: |
141 case gfx::BufferFormat::YUV_420: | 144 case gfx::BufferFormat::YUV_420: |
142 case gfx::BufferFormat::YUV_420_BIPLANAR: | 145 case gfx::BufferFormat::YUV_420_BIPLANAR: |
143 case gfx::BufferFormat::UYVY_422: | |
144 NOTREACHED(); | 146 NOTREACHED(); |
145 return 0; | 147 return 0; |
146 } | 148 } |
147 | 149 |
148 NOTREACHED(); | 150 NOTREACHED(); |
149 return 0; | 151 return 0; |
150 } | 152 } |
151 | 153 |
152 } // namespace | 154 } // namespace |
153 | 155 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 234 |
233 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, | 235 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, |
234 GpuMemoryBufferTest, | 236 GpuMemoryBufferTest, |
235 ::testing::Values(gfx::BufferFormat::R_8, | 237 ::testing::Values(gfx::BufferFormat::R_8, |
236 gfx::BufferFormat::RGBA_4444, | 238 gfx::BufferFormat::RGBA_4444, |
237 gfx::BufferFormat::RGBA_8888, | 239 gfx::BufferFormat::RGBA_8888, |
238 gfx::BufferFormat::BGRA_8888)); | 240 gfx::BufferFormat::BGRA_8888)); |
239 | 241 |
240 } // namespace gles2 | 242 } // namespace gles2 |
241 } // namespace gpu | 243 } // namespace gpu |
OLD | NEW |