| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/buffer.h" | 5 #include "components/exo/buffer.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 image_id_(0), | 178 image_id_(0), |
| 179 query_id_(0), | 179 query_id_(0), |
| 180 texture_id_(0), | 180 texture_id_(0), |
| 181 wait_for_release_pending_(false), | 181 wait_for_release_pending_(false), |
| 182 weak_ptr_factory_(this) { | 182 weak_ptr_factory_(this) { |
| 183 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 183 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 184 gfx::Size size = gpu_memory_buffer->GetSize(); | 184 gfx::Size size = gpu_memory_buffer->GetSize(); |
| 185 image_id_ = | 185 image_id_ = |
| 186 gles2->CreateImageCHROMIUM(gpu_memory_buffer->AsClientBuffer(), | 186 gles2->CreateImageCHROMIUM(gpu_memory_buffer->AsClientBuffer(), |
| 187 size.width(), size.height(), internalformat_); | 187 size.width(), size.height(), internalformat_); |
| 188 DLOG_IF(WARNING, !image_id_) << "Failed to create GLImage"; |
| 189 |
| 188 gles2->GenQueriesEXT(1, &query_id_); | 190 gles2->GenQueriesEXT(1, &query_id_); |
| 189 texture_id_ = CreateGLTexture(gles2, texture_target_); | 191 texture_id_ = CreateGLTexture(gles2, texture_target_); |
| 190 } | 192 } |
| 191 | 193 |
| 192 Buffer::Texture::~Texture() { | 194 Buffer::Texture::~Texture() { |
| 193 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 195 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 194 gles2->DeleteTextures(1, &texture_id_); | 196 gles2->DeleteTextures(1, &texture_id_); |
| 195 if (query_id_) | 197 if (query_id_) |
| 196 gles2->DeleteQueriesEXT(1, &query_id_); | 198 gles2->DeleteQueriesEXT(1, &query_id_); |
| 197 if (image_id_) | 199 if (image_id_) |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 497 } |
| 496 | 498 |
| 497 void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { | 499 void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { |
| 498 TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); | 500 TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); |
| 499 | 501 |
| 500 contents_texture_ = std::move(texture); | 502 contents_texture_ = std::move(texture); |
| 501 Release(); | 503 Release(); |
| 502 } | 504 } |
| 503 | 505 |
| 504 } // namespace exo | 506 } // namespace exo |
| OLD | NEW |