Chromium Code Reviews| 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 "ui/gl/gl_image_memory.h" | 5 #include "ui/gl/gl_image_memory.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 #include "ui/gl/scoped_binders.h" | 10 #include "ui/gl/scoped_binders.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool GLImageMemory::CopyTexImage(unsigned target) { | 174 bool GLImageMemory::CopyTexImage(unsigned target) { |
| 175 TRACE_EVENT0("gpu", "GLImageMemory::CopyTexImage"); | 175 TRACE_EVENT0("gpu", "GLImageMemory::CopyTexImage"); |
| 176 | 176 |
| 177 // GL_TEXTURE_EXTERNAL_OES is not a supported CopyTexImage target. | 177 // GL_TEXTURE_EXTERNAL_OES is not a supported CopyTexImage target. |
| 178 if (target == GL_TEXTURE_EXTERNAL_OES) | 178 if (target == GL_TEXTURE_EXTERNAL_OES) |
| 179 return false; | 179 return false; |
| 180 | 180 |
| 181 DCHECK(memory_); | 181 DCHECK(memory_); |
| 182 glTexImage2D(target, | 182 glTexSubImage2D(target, 0 /* level */, 0 /* x */, 0 /* y */, size_.width(), |
| 183 0, // mip level | 183 size_.height(), DataFormat(format_), DataType(format_), |
| 184 TextureFormat(format_), | 184 memory_); |
|
dshwang
2014/11/20 16:58:39
glTexImage2D isn't allowed after calling glTexStor
| |
| 185 size_.width(), | |
| 186 size_.height(), | |
| 187 0, // border | |
| 188 DataFormat(format_), | |
| 189 DataType(format_), | |
| 190 memory_); | |
| 191 | 185 |
| 192 return true; | 186 return true; |
| 193 } | 187 } |
| 194 | 188 |
| 195 void GLImageMemory::WillUseTexImage() { | 189 void GLImageMemory::WillUseTexImage() { |
| 196 DCHECK(!in_use_); | 190 DCHECK(!in_use_); |
| 197 in_use_ = true; | 191 in_use_ = true; |
| 198 | 192 |
| 199 if (!need_do_bind_tex_image_) | 193 if (!need_do_bind_tex_image_) |
| 200 return; | 194 return; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 TextureFormat(format_), | 278 TextureFormat(format_), |
| 285 size_.width(), | 279 size_.width(), |
| 286 size_.height(), | 280 size_.height(), |
| 287 0, // border | 281 0, // border |
| 288 DataFormat(format_), | 282 DataFormat(format_), |
| 289 DataType(format_), | 283 DataType(format_), |
| 290 memory_); | 284 memory_); |
| 291 } | 285 } |
| 292 | 286 |
| 293 } // namespace gfx | 287 } // namespace gfx |
| OLD | NEW |