Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ~AsyncPixelTransferDelegateEGL() override; 402 ~AsyncPixelTransferDelegateEGL() override;
403 403
404 void BindTransfer() { state_->BindTransfer(); } 404 void BindTransfer() { state_->BindTransfer(); }
405 405
406 // Implement AsyncPixelTransferDelegate: 406 // Implement AsyncPixelTransferDelegate:
407 void AsyncTexImage2D(const AsyncTexImage2DParams& tex_params, 407 void AsyncTexImage2D(const AsyncTexImage2DParams& tex_params,
408 const AsyncMemoryParams& mem_params, 408 const AsyncMemoryParams& mem_params,
409 const base::Closure& bind_callback) override; 409 const base::Closure& bind_callback) override;
410 void AsyncTexSubImage2D(const AsyncTexSubImage2DParams& tex_params, 410 void AsyncTexSubImage2D(const AsyncTexSubImage2DParams& tex_params,
411 const AsyncMemoryParams& mem_params) override; 411 const AsyncMemoryParams& mem_params) override;
412 void AsyncCompressedTexImage2D(
413 const AsyncCompressedTexImage2DParams& tex_params,
414 const AsyncMemoryParams& mem_params,
415 const base::Closure& bind_callback) override;
416 void AsyncCompressedTexSubImage2D(
417 const AsyncCompressedTexSubImage2DParams& tex_params,
418 const AsyncMemoryParams& mem_params) override;
412 bool TransferIsInProgress() override; 419 bool TransferIsInProgress() override;
413 void WaitForTransferCompletion() override; 420 void WaitForTransferCompletion() override;
414 421
415 private: 422 private:
416 // Returns true if a work-around was used. 423 // Returns true if a work-around was used.
417 bool WorkAroundAsyncTexImage2D( 424 bool WorkAroundAsyncTexImage2D(
418 const AsyncTexImage2DParams& tex_params, 425 const AsyncTexImage2DParams& tex_params,
419 const AsyncMemoryParams& mem_params, 426 const AsyncMemoryParams& mem_params,
420 const base::Closure& bind_callback); 427 const base::Closure& bind_callback);
421 bool WorkAroundAsyncTexSubImage2D( 428 bool WorkAroundAsyncTexSubImage2D(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 base::Bind( 545 base::Bind(
539 &TransferStateInternal::PerformAsyncTexSubImage2D, 546 &TransferStateInternal::PerformAsyncTexSubImage2D,
540 state_, 547 state_,
541 tex_params, 548 tex_params,
542 mem_params, 549 mem_params,
543 shared_state_->texture_upload_stats)); 550 shared_state_->texture_upload_stats));
544 551
545 DCHECK(CHECK_GL()); 552 DCHECK(CHECK_GL());
546 } 553 }
547 554
555 void AsyncPixelTransferDelegateEGL::AsyncCompressedTexImage2D(
556 const AsyncCompressedTexImage2DParams& tex_params,
557 const AsyncMemoryParams& mem_params,
558 const base::Closure& bind_callback) {
559 // EGLImage does not support compressed formats.
560 NOTREACHED();
561 }
562
563 void AsyncPixelTransferDelegateEGL::AsyncCompressedTexSubImage2D(
564 const AsyncCompressedTexSubImage2DParams& tex_params,
565 const AsyncMemoryParams& mem_params) {
566 // EGLImage does not support compressed formats.
567 NOTREACHED();
568 }
569
548 namespace { 570 namespace {
549 bool IsPowerOfTwo (unsigned int x) { 571 bool IsPowerOfTwo (unsigned int x) {
550 return ((x != 0) && !(x & (x - 1))); 572 return ((x != 0) && !(x & (x - 1)));
551 } 573 }
552 574
553 bool IsMultipleOfEight(unsigned int x) { 575 bool IsMultipleOfEight(unsigned int x) {
554 return (x & 7) == 0; 576 return (x & 7) == 0;
555 } 577 }
556 578
557 bool DimensionsSupportImgFastPath(int width, int height) { 579 bool DimensionsSupportImgFastPath(int width, int height) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 void AsyncPixelTransferManagerEGL::WaitAllAsyncTexImage2D() { 752 void AsyncPixelTransferManagerEGL::WaitAllAsyncTexImage2D() {
731 if (shared_state_.pending_allocations.empty()) 753 if (shared_state_.pending_allocations.empty())
732 return; 754 return;
733 755
734 AsyncPixelTransferDelegateEGL* delegate = 756 AsyncPixelTransferDelegateEGL* delegate =
735 shared_state_.pending_allocations.back().get(); 757 shared_state_.pending_allocations.back().get();
736 if (delegate) 758 if (delegate)
737 delegate->WaitForTransferCompletion(); 759 delegate->WaitForTransferCompletion();
738 } 760 }
739 761
762 void AsyncPixelTransferManagerEGL::SuspendUploads(
763 base::WaitableEvent* waitable) {
764 transfer_message_loop_proxy()->PostTask(
765 FROM_HERE,
766 base::Bind(&base::WaitableEvent::Wait,
767 base::Owned(waitable)));
768 }
769
770 void AsyncPixelTransferManagerEGL::SignalWhenUploadsCompleted(
771 base::WaitableEvent* waitable) {
772 transfer_message_loop_proxy()->PostTask(
773 FROM_HERE,
774 base::Bind(&base::WaitableEvent::Signal,
775 // Waitable owned by waiter.
776 base::Unretained(waitable)));
777 }
778
740 AsyncPixelTransferDelegate* 779 AsyncPixelTransferDelegate*
741 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( 780 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl(
742 gles2::TextureRef* ref, 781 gles2::TextureRef* ref,
743 const AsyncTexImage2DParams& define_params) { 782 const AsyncTexImage2DParams& define_params) {
744 return new AsyncPixelTransferDelegateEGL( 783 return new AsyncPixelTransferDelegateEGL(
745 &shared_state_, ref->service_id(), define_params); 784 &shared_state_, ref->service_id(), define_params);
746 } 785 }
747 786
787 AsyncPixelTransferDelegate*
788 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl(
789 gles2::TextureRef* ref,
790 const AsyncCompressedTexImage2DParams& define_params) {
791 // EGLImage does not support non-standard formats such as compressed ones.
792 NOTREACHED();
793 return NULL;
794 }
795
748 } // namespace gpu 796 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698