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 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3714 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3715 // Check it's cached and not called again. | 3715 // Check it's cached and not called again. |
3716 ClearCommands(); | 3716 ClearCommands(); |
3717 gl_->Enable(GL_BLEND); | 3717 gl_->Enable(GL_BLEND); |
3718 EXPECT_TRUE(NoCommandsWritten()); | 3718 EXPECT_TRUE(NoCommandsWritten()); |
3719 } | 3719 } |
3720 | 3720 |
3721 TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) { | 3721 TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) { |
3722 struct Cmds { | 3722 struct Cmds { |
3723 cmds::ConsumeTextureCHROMIUMImmediate cmd; | 3723 cmds::ConsumeTextureCHROMIUMImmediate cmd; |
3724 GLbyte data[64]; | 3724 GLbyte data[GL_MAILBOX_SIZE_CHROMIUM]; |
3725 }; | 3725 }; |
3726 | 3726 |
3727 Mailbox mailbox = Mailbox::Generate(); | 3727 Mailbox mailbox = Mailbox::Generate(); |
3728 Cmds expected; | 3728 Cmds expected; |
3729 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); | 3729 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); |
3730 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 3730 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
3731 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3731 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3732 } | 3732 } |
3733 | 3733 |
3734 TEST_F(GLES2ImplementationTest, CreateAndConsumeTextureCHROMIUM) { | 3734 TEST_F(GLES2ImplementationTest, CreateAndConsumeTextureCHROMIUM) { |
3735 struct Cmds { | 3735 struct Cmds { |
3736 cmds::CreateAndConsumeTextureINTERNALImmediate cmd; | 3736 cmds::CreateAndConsumeTextureINTERNALImmediate cmd; |
3737 GLbyte data[64]; | 3737 GLbyte data[GL_MAILBOX_SIZE_CHROMIUM]; |
3738 }; | 3738 }; |
3739 | 3739 |
3740 Mailbox mailbox = Mailbox::Generate(); | 3740 Mailbox mailbox = Mailbox::Generate(); |
3741 Cmds expected; | 3741 Cmds expected; |
3742 expected.cmd.Init(GL_TEXTURE_2D, kTexturesStartId, mailbox.name); | 3742 expected.cmd.Init(GL_TEXTURE_2D, kTexturesStartId, mailbox.name); |
3743 GLuint id = gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 3743 GLuint id = gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
3744 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3744 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3745 EXPECT_EQ(kTexturesStartId, id); | 3745 EXPECT_EQ(kTexturesStartId, id); |
3746 } | 3746 } |
3747 | 3747 |
3748 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { | 3748 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { |
3749 struct Cmds { | 3749 struct Cmds { |
3750 cmds::ProduceTextureCHROMIUMImmediate cmd; | 3750 cmds::ProduceTextureCHROMIUMImmediate cmd; |
3751 GLbyte data[64]; | 3751 GLbyte data[GL_MAILBOX_SIZE_CHROMIUM]; |
3752 }; | 3752 }; |
3753 | 3753 |
3754 Mailbox mailbox = Mailbox::Generate(); | 3754 Mailbox mailbox = Mailbox::Generate(); |
3755 Cmds expected; | 3755 Cmds expected; |
3756 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); | 3756 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); |
3757 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 3757 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
3758 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3758 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3759 } | 3759 } |
3760 | 3760 |
3761 TEST_F(GLES2ImplementationTest, ProduceTextureDirectCHROMIUM) { | 3761 TEST_F(GLES2ImplementationTest, ProduceTextureDirectCHROMIUM) { |
3762 struct Cmds { | 3762 struct Cmds { |
3763 cmds::ProduceTextureDirectCHROMIUMImmediate cmd; | 3763 cmds::ProduceTextureDirectCHROMIUMImmediate cmd; |
3764 GLbyte data[64]; | 3764 GLbyte data[GL_MAILBOX_SIZE_CHROMIUM]; |
3765 }; | 3765 }; |
3766 | 3766 |
3767 Mailbox mailbox = Mailbox::Generate(); | 3767 Mailbox mailbox = Mailbox::Generate(); |
3768 Cmds expected; | 3768 Cmds expected; |
3769 expected.cmd.Init(kTexturesStartId, GL_TEXTURE_2D, mailbox.name); | 3769 expected.cmd.Init(kTexturesStartId, GL_TEXTURE_2D, mailbox.name); |
3770 gl_->ProduceTextureDirectCHROMIUM( | 3770 gl_->ProduceTextureDirectCHROMIUM( |
3771 kTexturesStartId, GL_TEXTURE_2D, mailbox.name); | 3771 kTexturesStartId, GL_TEXTURE_2D, mailbox.name); |
3772 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3772 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3773 } | 3773 } |
3774 | 3774 |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4660 ContextInitOptions init_options; | 4660 ContextInitOptions init_options; |
4661 init_options.transfer_buffer_initialize_fail = true; | 4661 init_options.transfer_buffer_initialize_fail = true; |
4662 EXPECT_FALSE(Initialize(init_options)); | 4662 EXPECT_FALSE(Initialize(init_options)); |
4663 } | 4663 } |
4664 | 4664 |
4665 #include "base/macros.h" | 4665 #include "base/macros.h" |
4666 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 4666 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
4667 | 4667 |
4668 } // namespace gles2 | 4668 } // namespace gles2 |
4669 } // namespace gpu | 4669 } // namespace gpu |
OLD | NEW |