| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 gpu::SyncToken Buffer::Texture::CopyTexImage(Texture* destination, | 280 gpu::SyncToken Buffer::Texture::CopyTexImage(Texture* destination, |
| 281 const base::Closure& callback) { | 281 const base::Closure& callback) { |
| 282 gpu::SyncToken sync_token; | 282 gpu::SyncToken sync_token; |
| 283 if (context_provider_) { | 283 if (context_provider_) { |
| 284 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 284 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 285 gles2->ActiveTexture(GL_TEXTURE0); | 285 gles2->ActiveTexture(GL_TEXTURE0); |
| 286 gles2->BindTexture(texture_target_, texture_id_); | 286 gles2->BindTexture(texture_target_, texture_id_); |
| 287 DCHECK_NE(image_id_, 0u); | 287 DCHECK_NE(image_id_, 0u); |
| 288 gles2->BindTexImage2DCHROMIUM(texture_target_, image_id_); | 288 gles2->BindTexImage2DCHROMIUM(texture_target_, image_id_); |
| 289 gles2->CopyTextureCHROMIUM(texture_id_, destination->texture_id_, | 289 gles2->CopyTextureCHROMIUM(texture_id_, 0, destination->texture_id_, 0, |
| 290 internalformat_, GL_UNSIGNED_BYTE, false, false, | 290 internalformat_, GL_UNSIGNED_BYTE, false, false, |
| 291 false); | 291 false); |
| 292 DCHECK_NE(query_id_, 0u); | 292 DCHECK_NE(query_id_, 0u); |
| 293 gles2->BeginQueryEXT(query_type_, query_id_); | 293 gles2->BeginQueryEXT(query_type_, query_id_); |
| 294 gles2->ReleaseTexImage2DCHROMIUM(texture_target_, image_id_); | 294 gles2->ReleaseTexImage2DCHROMIUM(texture_target_, image_id_); |
| 295 gles2->EndQueryEXT(query_type_); | 295 gles2->EndQueryEXT(query_type_); |
| 296 // Run callback when query result is available and ReleaseTexImage has been | 296 // Run callback when query result is available and ReleaseTexImage has been |
| 297 // handled. | 297 // handled. |
| 298 ReleaseWhenQueryResultIsAvailable(callback); | 298 ReleaseWhenQueryResultIsAvailable(callback); |
| 299 // Create and return a sync token that can be used to ensure that the | 299 // Create and return a sync token that can be used to ensure that the |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 texture_ = std::move(texture); | 560 texture_ = std::move(texture); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { | 563 void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { |
| 564 TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); | 564 TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); |
| 565 contents_texture_ = std::move(texture); | 565 contents_texture_ = std::move(texture); |
| 566 Release(); | 566 Release(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace exo | 569 } // namespace exo |
| OLD | NEW |