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 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 TEST_F(GLES2ImplementationTest, ClientWaitSync) { | 4000 TEST_F(GLES2ImplementationTest, ClientWaitSync) { |
4001 const GLuint client_sync_id = 36; | 4001 const GLuint client_sync_id = 36; |
4002 struct Cmds { | 4002 struct Cmds { |
4003 cmds::ClientWaitSync cmd; | 4003 cmds::ClientWaitSync cmd; |
4004 }; | 4004 }; |
4005 | 4005 |
4006 Cmds expected; | 4006 Cmds expected; |
4007 ExpectedMemoryInfo result1 = | 4007 ExpectedMemoryInfo result1 = |
4008 GetExpectedResultMemory(sizeof(cmds::ClientWaitSync::Result)); | 4008 GetExpectedResultMemory(sizeof(cmds::ClientWaitSync::Result)); |
4009 const GLuint64 kTimeout = 0xABCDEF0123456789; | 4009 const GLuint64 kTimeout = 0xABCDEF0123456789; |
4010 uint32_t v32_0 = 0, v32_1 = 0; | |
4011 GLES2Util::MapUint64ToTwoUint32(kTimeout, &v32_0, &v32_1); | |
4012 expected.cmd.Init(client_sync_id, GL_SYNC_FLUSH_COMMANDS_BIT, | 4010 expected.cmd.Init(client_sync_id, GL_SYNC_FLUSH_COMMANDS_BIT, |
4013 v32_0, v32_1, result1.id, result1.offset); | 4011 kTimeout, result1.id, result1.offset); |
4014 | 4012 |
4015 EXPECT_CALL(*command_buffer(), OnFlush()) | 4013 EXPECT_CALL(*command_buffer(), OnFlush()) |
4016 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_CONDITION_SATISFIED))) | 4014 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_CONDITION_SATISFIED))) |
4017 .RetiresOnSaturation(); | 4015 .RetiresOnSaturation(); |
4018 | 4016 |
4019 GLenum result = gl_->ClientWaitSync( | 4017 GLenum result = gl_->ClientWaitSync( |
4020 reinterpret_cast<GLsync>(client_sync_id), GL_SYNC_FLUSH_COMMANDS_BIT, | 4018 reinterpret_cast<GLsync>(client_sync_id), GL_SYNC_FLUSH_COMMANDS_BIT, |
4021 kTimeout); | 4019 kTimeout); |
4022 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 4020 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
4023 EXPECT_EQ(static_cast<GLenum>(GL_CONDITION_SATISFIED), result); | 4021 EXPECT_EQ(static_cast<GLenum>(GL_CONDITION_SATISFIED), result); |
4024 } | 4022 } |
4025 | 4023 |
4026 TEST_F(GLES2ImplementationTest, WaitSync) { | 4024 TEST_F(GLES2ImplementationTest, WaitSync) { |
4027 const GLuint kClientSyncId = 36; | 4025 const GLuint kClientSyncId = 36; |
4028 struct Cmds { | 4026 struct Cmds { |
4029 cmds::WaitSync cmd; | 4027 cmds::WaitSync cmd; |
4030 }; | 4028 }; |
4031 Cmds expected; | 4029 Cmds expected; |
4032 const GLuint64 kTimeout = GL_TIMEOUT_IGNORED; | 4030 const GLuint64 kTimeout = GL_TIMEOUT_IGNORED; |
4033 uint32_t v32_0 = 0, v32_1 = 0; | 4031 expected.cmd.Init(kClientSyncId, 0, kTimeout); |
4034 GLES2Util::MapUint64ToTwoUint32(kTimeout, &v32_0, &v32_1); | |
4035 expected.cmd.Init(kClientSyncId, 0, v32_0, v32_1); | |
4036 | 4032 |
4037 gl_->WaitSync(reinterpret_cast<GLsync>(kClientSyncId), 0, kTimeout); | 4033 gl_->WaitSync(reinterpret_cast<GLsync>(kClientSyncId), 0, kTimeout); |
4038 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 4034 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
4039 } | 4035 } |
4040 | 4036 |
4041 TEST_F(GLES2ImplementationTest, MapBufferRangeUnmapBufferWrite) { | 4037 TEST_F(GLES2ImplementationTest, MapBufferRangeUnmapBufferWrite) { |
4042 ExpectedMemoryInfo result = | 4038 ExpectedMemoryInfo result = |
4043 GetExpectedResultMemory(sizeof(cmds::MapBufferRange::Result)); | 4039 GetExpectedResultMemory(sizeof(cmds::MapBufferRange::Result)); |
4044 | 4040 |
4045 EXPECT_CALL(*command_buffer(), OnFlush()) | 4041 EXPECT_CALL(*command_buffer(), OnFlush()) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4257 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { | 4253 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { |
4258 ContextInitOptions init_options; | 4254 ContextInitOptions init_options; |
4259 init_options.transfer_buffer_initialize_fail = true; | 4255 init_options.transfer_buffer_initialize_fail = true; |
4260 EXPECT_FALSE(Initialize(init_options)); | 4256 EXPECT_FALSE(Initialize(init_options)); |
4261 } | 4257 } |
4262 | 4258 |
4263 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 4259 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
4264 | 4260 |
4265 } // namespace gles2 | 4261 } // namespace gles2 |
4266 } // namespace gpu | 4262 } // namespace gpu |
OLD | NEW |