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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 2610853005: Modify Copy{Sub}TextureCHROMIUM entry point to add level argument (Closed)
Patch Set: fix chromeos Created 3 years, 11 months 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 (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 "media/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <GLES3/gl3.h> 7 #include <GLES3/gl3.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 source_textures[i].fTarget = mailbox_holder.texture_target; 113 source_textures[i].fTarget = mailbox_holder.texture_target;
114 114
115 // TODO(dcastagna): avoid this copy once Skia supports native textures 115 // TODO(dcastagna): avoid this copy once Skia supports native textures
116 // with a GL_TEXTURE_RECTANGLE_ARB texture target. 116 // with a GL_TEXTURE_RECTANGLE_ARB texture target.
117 // crbug.com/505026 117 // crbug.com/505026
118 if (mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB) { 118 if (mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB) {
119 unsigned texture_copy = 0; 119 unsigned texture_copy = 0;
120 gl->GenTextures(1, &texture_copy); 120 gl->GenTextures(1, &texture_copy);
121 DCHECK(texture_copy); 121 DCHECK(texture_copy);
122 gl->BindTexture(GL_TEXTURE_2D, texture_copy); 122 gl->BindTexture(GL_TEXTURE_2D, texture_copy);
123 gl->CopyTextureCHROMIUM(source_textures[i].fID, texture_copy, GL_RGB, 123 gl->CopyTextureCHROMIUM(source_textures[i].fID, 0, texture_copy, 0,
124 GL_UNSIGNED_BYTE, false, true, false); 124 GL_RGB, GL_UNSIGNED_BYTE, false, true, false);
125 125
126 gl->DeleteTextures(1, &source_textures[i].fID); 126 gl->DeleteTextures(1, &source_textures[i].fID);
127 source_textures[i].fID = texture_copy; 127 source_textures[i].fID = texture_copy;
128 source_textures[i].fTarget = GL_TEXTURE_2D; 128 source_textures[i].fTarget = GL_TEXTURE_2D;
129 } 129 }
130 } 130 }
131 GrBackendObject handles[3] = { 131 GrBackendObject handles[3] = {
132 skia::GrGLTextureInfoToGrBackendObject(source_textures[0]), 132 skia::GrGLTextureInfoToGrBackendObject(source_textures[0]),
133 skia::GrGLTextureInfoToGrBackendObject(source_textures[1]), 133 skia::GrGLTextureInfoToGrBackendObject(source_textures[1]),
134 skia::GrGLTextureInfoToGrBackendObject(source_textures[2])}; 134 skia::GrGLTextureInfoToGrBackendObject(source_textures[2])};
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); 769 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData());
770 uint32_t source_texture = gl->CreateAndConsumeTextureCHROMIUM( 770 uint32_t source_texture = gl->CreateAndConsumeTextureCHROMIUM(
771 mailbox_holder.texture_target, mailbox_holder.mailbox.name); 771 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
772 772
773 // The video is stored in a unmultiplied format, so premultiply 773 // The video is stored in a unmultiplied format, so premultiply
774 // if necessary. 774 // if necessary.
775 // Application itself needs to take care of setting the right |flip_y| 775 // Application itself needs to take care of setting the right |flip_y|
776 // value down to get the expected result. 776 // value down to get the expected result.
777 // "flip_y == true" means to reverse the video orientation while 777 // "flip_y == true" means to reverse the video orientation while
778 // "flip_y == false" means to keep the intrinsic orientation. 778 // "flip_y == false" means to keep the intrinsic orientation.
779 gl->CopyTextureCHROMIUM(source_texture, texture, internal_format, type, 779 gl->CopyTextureCHROMIUM(source_texture, 0, texture, 0, internal_format, type,
780 flip_y, premultiply_alpha, false); 780 flip_y, premultiply_alpha, false);
781 gl->DeleteTextures(1, &source_texture); 781 gl->DeleteTextures(1, &source_texture);
782 gl->Flush(); 782 gl->Flush();
783 783
784 SyncTokenClientImpl client(gl); 784 SyncTokenClientImpl client(gl);
785 video_frame->UpdateReleaseSyncToken(&client); 785 video_frame->UpdateReleaseSyncToken(&client);
786 } 786 }
787 787
788 bool SkCanvasVideoRenderer::CopyVideoFrameTexturesToGLTexture( 788 bool SkCanvasVideoRenderer::CopyVideoFrameTexturesToGLTexture(
789 const Context3D& context_3d, 789 const Context3D& context_3d,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 canvas_gl->ShallowFlushCHROMIUM(); 821 canvas_gl->ShallowFlushCHROMIUM();
822 canvas_gl->GenSyncTokenCHROMIUM(fence_sync, 822 canvas_gl->GenSyncTokenCHROMIUM(fence_sync,
823 mailbox_holder.sync_token.GetData()); 823 mailbox_holder.sync_token.GetData());
824 824
825 destination_gl->WaitSyncTokenCHROMIUM( 825 destination_gl->WaitSyncTokenCHROMIUM(
826 mailbox_holder.sync_token.GetConstData()); 826 mailbox_holder.sync_token.GetConstData());
827 uint32_t intermediate_texture = 827 uint32_t intermediate_texture =
828 destination_gl->CreateAndConsumeTextureCHROMIUM( 828 destination_gl->CreateAndConsumeTextureCHROMIUM(
829 mailbox_holder.texture_target, mailbox_holder.mailbox.name); 829 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
830 830
831 destination_gl->CopyTextureCHROMIUM(intermediate_texture, texture, 831 destination_gl->CopyTextureCHROMIUM(intermediate_texture, 0, texture, 0,
832 internal_format, type, flip_y, 832 internal_format, type, flip_y,
833 premultiply_alpha, false); 833 premultiply_alpha, false);
834 destination_gl->DeleteTextures(1, &intermediate_texture); 834 destination_gl->DeleteTextures(1, &intermediate_texture);
835 835
836 // Wait for destination context to consume mailbox before deleting it in 836 // Wait for destination context to consume mailbox before deleting it in
837 // canvas context. 837 // canvas context.
838 const GLuint64 dest_fence_sync = destination_gl->InsertFenceSyncCHROMIUM(); 838 const GLuint64 dest_fence_sync = destination_gl->InsertFenceSyncCHROMIUM();
839 destination_gl->ShallowFlushCHROMIUM(); 839 destination_gl->ShallowFlushCHROMIUM();
840 gpu::SyncToken dest_sync_token; 840 gpu::SyncToken dest_sync_token;
841 destination_gl->GenSyncTokenCHROMIUM(dest_fence_sync, 841 destination_gl->GenSyncTokenCHROMIUM(dest_fence_sync,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 last_image_->bounds().contains(visible_rect)) { 948 last_image_->bounds().contains(visible_rect)) {
949 last_image_ = last_image_->makeSubset(visible_rect); 949 last_image_ = last_image_->makeSubset(visible_rect);
950 } 950 }
951 } 951 }
952 952
953 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { 953 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() {
954 return last_image_dimensions_for_testing_; 954 return last_image_dimensions_for_testing_;
955 } 955 }
956 956
957 } // namespace media 957 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698