OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/async_pixel_transfer_delegate_android.h" | 5 #include "ui/gl/async_pixel_transfer_delegate_android.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 void BindTransfer() { | 206 void BindTransfer() { |
207 TRACE_EVENT2("gpu", "BindAsyncTransfer glEGLImageTargetTexture2DOES", | 207 TRACE_EVENT2("gpu", "BindAsyncTransfer glEGLImageTargetTexture2DOES", |
208 "width", define_params_.width, | 208 "width", define_params_.width, |
209 "height", define_params_.height); | 209 "height", define_params_.height); |
210 DCHECK(texture_id_); | 210 DCHECK(texture_id_); |
211 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_); | 211 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_); |
212 | 212 |
213 // We can only change the active texture and unit 0, | 213 // We can only change the active texture and unit 0, |
214 // as that is all that will be restored. | 214 // as that is all that will be restored. |
215 glActiveTexture(GL_TEXTURE0); | |
216 glBindTexture(GL_TEXTURE_2D, texture_id_); | 215 glBindTexture(GL_TEXTURE_2D, texture_id_); |
217 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); | 216 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); |
218 bind_callback_.Run(); | 217 bind_callback_.Run(); |
219 | 218 |
220 DCHECK(CHECK_GL()); | 219 DCHECK(CHECK_GL()); |
221 } | 220 } |
222 | 221 |
223 void CreateEglImage(GLuint texture_id) { | 222 void CreateEglImage(GLuint texture_id) { |
224 TRACE_EVENT0("gpu", "eglCreateImageKHR"); | 223 TRACE_EVENT0("gpu", "eglCreateImageKHR"); |
225 DCHECK(texture_id); | 224 DCHECK(texture_id); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 const AsyncMemoryParams& mem_params, | 376 const AsyncMemoryParams& mem_params, |
378 const base::Closure& bind_callback) OVERRIDE; | 377 const base::Closure& bind_callback) OVERRIDE; |
379 virtual void AsyncTexSubImage2D( | 378 virtual void AsyncTexSubImage2D( |
380 AsyncPixelTransferState* state, | 379 AsyncPixelTransferState* state, |
381 const AsyncTexSubImage2DParams& tex_params, | 380 const AsyncTexSubImage2DParams& tex_params, |
382 const AsyncMemoryParams& mem_params) OVERRIDE; | 381 const AsyncMemoryParams& mem_params) OVERRIDE; |
383 virtual void WaitForTransferCompletion( | 382 virtual void WaitForTransferCompletion( |
384 AsyncPixelTransferState* state) OVERRIDE; | 383 AsyncPixelTransferState* state) OVERRIDE; |
385 virtual uint32 GetTextureUploadCount() OVERRIDE; | 384 virtual uint32 GetTextureUploadCount() OVERRIDE; |
386 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; | 385 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; |
| 386 virtual bool ProcessMorePendingTransfers() OVERRIDE; |
| 387 virtual bool NeedsProcessMorePendingTransfers() OVERRIDE; |
387 | 388 |
388 private: | 389 private: |
389 // implement AsyncPixelTransferDelegate: | 390 // implement AsyncPixelTransferDelegate: |
390 virtual AsyncPixelTransferState* | 391 virtual AsyncPixelTransferState* |
391 CreateRawPixelTransferState(GLuint texture_id, | 392 CreateRawPixelTransferState(GLuint texture_id, |
392 const AsyncTexImage2DParams& define_params) OVERRIDE; | 393 const AsyncTexImage2DParams& define_params) OVERRIDE; |
393 | 394 |
394 static void PerformNotifyCompletion( | 395 static void PerformNotifyCompletion( |
395 AsyncMemoryParams mem_params, | 396 AsyncMemoryParams mem_params, |
396 ScopedSafeSharedMemory* safe_shared_memory, | 397 ScopedSafeSharedMemory* safe_shared_memory, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 return texture_upload_stats_->GetStats(NULL); | 652 return texture_upload_stats_->GetStats(NULL); |
652 } | 653 } |
653 | 654 |
654 base::TimeDelta AsyncPixelTransferDelegateAndroid::GetTotalTextureUploadTime() { | 655 base::TimeDelta AsyncPixelTransferDelegateAndroid::GetTotalTextureUploadTime() { |
655 CHECK(texture_upload_stats_); | 656 CHECK(texture_upload_stats_); |
656 base::TimeDelta total_texture_upload_time; | 657 base::TimeDelta total_texture_upload_time; |
657 texture_upload_stats_->GetStats(&total_texture_upload_time); | 658 texture_upload_stats_->GetStats(&total_texture_upload_time); |
658 return total_texture_upload_time; | 659 return total_texture_upload_time; |
659 } | 660 } |
660 | 661 |
| 662 bool AsyncPixelTransferDelegateAndroid::ProcessMorePendingTransfers() { |
| 663 return false; |
| 664 } |
| 665 |
| 666 bool AsyncPixelTransferDelegateAndroid::NeedsProcessMorePendingTransfers() { |
| 667 return false; |
| 668 } |
| 669 |
| 670 |
661 namespace { | 671 namespace { |
662 void SetGlParametersForEglImageTexture() { | 672 void SetGlParametersForEglImageTexture() { |
663 // These params are needed for EGLImage creation to succeed on several | 673 // These params are needed for EGLImage creation to succeed on several |
664 // Android devices. I couldn't find this requirement in the EGLImage | 674 // Android devices. I couldn't find this requirement in the EGLImage |
665 // extension spec, but several devices fail without it. | 675 // extension spec, but several devices fail without it. |
666 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 676 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
667 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 677 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
668 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 678 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
669 } | 679 } |
670 } // namespace | 680 } // namespace |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 if (texture_upload_stats_) { | 898 if (texture_upload_stats_) { |
889 texture_upload_stats_->AddUpload( | 899 texture_upload_stats_->AddUpload( |
890 base::TimeTicks::HighResNow() - begin_time); | 900 base::TimeTicks::HighResNow() - begin_time); |
891 } | 901 } |
892 | 902 |
893 DCHECK(CHECK_GL()); | 903 DCHECK(CHECK_GL()); |
894 return true; | 904 return true; |
895 } | 905 } |
896 | 906 |
897 } // namespace gfx | 907 } // namespace gfx |
OLD | NEW |