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

Side by Side Diff: content/common/cc_messages_unittest.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: c301e01d Rebase. Created 6 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 | Annotate | Revision Log
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 "content/common/cc_messages.h" 5 #include "content/common/cc_messages.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { 182 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) {
183 EXPECT_EQ(a->tex_scale, b->tex_scale); 183 EXPECT_EQ(a->tex_scale, b->tex_scale);
184 EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id); 184 EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id);
185 EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id); 185 EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id);
186 EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id); 186 EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id);
187 EXPECT_EQ(a->a_plane_resource_id, b->a_plane_resource_id); 187 EXPECT_EQ(a->a_plane_resource_id, b->a_plane_resource_id);
188 } 188 }
189 189
190 void Compare(const TransferableResource& a, const TransferableResource& b) { 190 void Compare(const TransferableResource& a, const TransferableResource& b) {
191 EXPECT_EQ(a.id, b.id); 191 EXPECT_EQ(a.id, b.id);
192 EXPECT_EQ(a.sync_point, b.sync_point);
193 EXPECT_EQ(a.format, b.format); 192 EXPECT_EQ(a.format, b.format);
194 EXPECT_EQ(a.target, b.target);
195 EXPECT_EQ(a.filter, b.filter); 193 EXPECT_EQ(a.filter, b.filter);
196 EXPECT_EQ(a.size.ToString(), b.size.ToString()); 194 EXPECT_EQ(a.size.ToString(), b.size.ToString());
197 for (size_t i = 0; i < arraysize(a.mailbox.name); ++i) 195 for (size_t i = 0; i < arraysize(a.mailbox_holder.mailbox.name); ++i) {
198 EXPECT_EQ(a.mailbox.name[i], b.mailbox.name[i]); 196 EXPECT_EQ(a.mailbox_holder.mailbox.name[i],
197 b.mailbox_holder.mailbox.name[i]);
198 }
199 EXPECT_EQ(a.mailbox_holder.texture_target, b.mailbox_holder.texture_target);
200 EXPECT_EQ(a.mailbox_holder.sync_point, b.mailbox_holder.sync_point);
199 } 201 }
200 }; 202 };
201 203
202 TEST_F(CCMessagesTest, AllQuads) { 204 TEST_F(CCMessagesTest, AllQuads) {
203 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 205 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
204 206
205 Transform arbitrary_matrix; 207 Transform arbitrary_matrix;
206 arbitrary_matrix.Scale(3, 3); 208 arbitrary_matrix.Scale(3, 3);
207 arbitrary_matrix.Translate(-5, 20); 209 arbitrary_matrix.Translate(-5, 20);
208 arbitrary_matrix.Rotate(15); 210 arbitrary_matrix.Rotate(15);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 628
627 GLbyte arbitrary_mailbox2[64] = { 629 GLbyte arbitrary_mailbox2[64] = {
628 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 630 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
629 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 631 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
630 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 632 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0,
631 0, 9, 8, 7 633 0, 9, 8, 7
632 }; 634 };
633 635
634 TransferableResource arbitrary_resource1; 636 TransferableResource arbitrary_resource1;
635 arbitrary_resource1.id = 2178312; 637 arbitrary_resource1.id = 2178312;
636 arbitrary_resource1.sync_point = arbitrary_uint1;
637 arbitrary_resource1.format = cc::RGBA_8888; 638 arbitrary_resource1.format = cc::RGBA_8888;
638 arbitrary_resource1.target = GL_TEXTURE_2D;
639 arbitrary_resource1.filter = 53; 639 arbitrary_resource1.filter = 53;
640 arbitrary_resource1.size = gfx::Size(37189, 123123); 640 arbitrary_resource1.size = gfx::Size(37189, 123123);
641 arbitrary_resource1.mailbox.SetName(arbitrary_mailbox1); 641 arbitrary_resource1.mailbox_holder.mailbox.SetName(arbitrary_mailbox1);
642 arbitrary_resource1.mailbox_holder.texture_target = GL_TEXTURE_2D;
643 arbitrary_resource1.mailbox_holder.sync_point = arbitrary_uint1;
642 644
643 TransferableResource arbitrary_resource2; 645 TransferableResource arbitrary_resource2;
644 arbitrary_resource2.id = 789132; 646 arbitrary_resource2.id = 789132;
645 arbitrary_resource2.sync_point = arbitrary_uint2;
646 arbitrary_resource2.format = cc::RGBA_4444; 647 arbitrary_resource2.format = cc::RGBA_4444;
647 arbitrary_resource2.target = GL_TEXTURE_EXTERNAL_OES;
648 arbitrary_resource2.filter = 47; 648 arbitrary_resource2.filter = 47;
649 arbitrary_resource2.size = gfx::Size(89123, 23789); 649 arbitrary_resource2.size = gfx::Size(89123, 23789);
650 arbitrary_resource2.mailbox.SetName(arbitrary_mailbox2); 650 arbitrary_resource2.mailbox_holder.mailbox.SetName(arbitrary_mailbox2);
651 arbitrary_resource2.mailbox_holder.texture_target = GL_TEXTURE_EXTERNAL_OES;
652 arbitrary_resource2.mailbox_holder.sync_point = arbitrary_uint2;
651 653
652 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create(); 654 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create();
653 renderpass_in->SetNew( 655 renderpass_in->SetNew(
654 RenderPass::Id(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform()); 656 RenderPass::Id(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform());
655 657
656 DelegatedFrameData frame_in; 658 DelegatedFrameData frame_in;
657 frame_in.resource_list.push_back(arbitrary_resource1); 659 frame_in.resource_list.push_back(arbitrary_resource1);
658 frame_in.resource_list.push_back(arbitrary_resource2); 660 frame_in.resource_list.push_back(arbitrary_resource2);
659 frame_in.render_pass_list.push_back(renderpass_in.Pass()); 661 frame_in.render_pass_list.push_back(renderpass_in.Pass());
660 662
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 716 }
715 717
716 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever 718 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever
717 // changes, then the ReserveSizeForRenderPassWrite() method needs to be 719 // changes, then the ReserveSizeForRenderPassWrite() method needs to be
718 // updated as well to use the new largest quad. 720 // updated as well to use the new largest quad.
719 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest); 721 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest);
720 } 722 }
721 723
722 } // namespace 724 } // namespace
723 } // namespace content 725 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698