| 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/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
| 10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 ExpectedMemoryInfo result1 = | 1431 ExpectedMemoryInfo result1 = |
| 1432 GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); | 1432 GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); |
| 1433 ExpectedMemoryInfo mem2 = | 1433 ExpectedMemoryInfo mem2 = |
| 1434 GetExpectedMemory(kWidth * kHeight / 2 * kBytesPerPixel); | 1434 GetExpectedMemory(kWidth * kHeight / 2 * kBytesPerPixel); |
| 1435 ExpectedMemoryInfo result2 = | 1435 ExpectedMemoryInfo result2 = |
| 1436 GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); | 1436 GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); |
| 1437 | 1437 |
| 1438 Cmds expected; | 1438 Cmds expected; |
| 1439 expected.read1.Init( | 1439 expected.read1.Init( |
| 1440 0, 0, kWidth, kHeight / 2, kFormat, kType, | 1440 0, 0, kWidth, kHeight / 2, kFormat, kType, |
| 1441 mem1.id, mem1.offset, result1.id, result1.offset); | 1441 mem1.id, mem1.offset, result1.id, result1.offset, |
| 1442 false); |
| 1442 expected.set_token1.Init(GetNextToken()); | 1443 expected.set_token1.Init(GetNextToken()); |
| 1443 expected.read2.Init( | 1444 expected.read2.Init( |
| 1444 0, kHeight / 2, kWidth, kHeight / 2, kFormat, kType, | 1445 0, kHeight / 2, kWidth, kHeight / 2, kFormat, kType, |
| 1445 mem2.id, mem2.offset, result2.id, result2.offset); | 1446 mem2.id, mem2.offset, result2.id, result2.offset, false); |
| 1446 expected.set_token2.Init(GetNextToken()); | 1447 expected.set_token2.Init(GetNextToken()); |
| 1447 scoped_ptr<int8[]> buffer(new int8[kWidth * kHeight * kBytesPerPixel]); | 1448 scoped_ptr<int8[]> buffer(new int8[kWidth * kHeight * kBytesPerPixel]); |
| 1448 | 1449 |
| 1449 EXPECT_CALL(*command_buffer(), OnFlush()) | 1450 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 1450 .WillOnce(SetMemory(result1.ptr, static_cast<uint32>(1))) | 1451 .WillOnce(SetMemory(result1.ptr, static_cast<uint32>(1))) |
| 1451 .WillOnce(SetMemory(result2.ptr, static_cast<uint32>(1))) | 1452 .WillOnce(SetMemory(result2.ptr, static_cast<uint32>(1))) |
| 1452 .RetiresOnSaturation(); | 1453 .RetiresOnSaturation(); |
| 1453 | 1454 |
| 1454 gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get()); | 1455 gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get()); |
| 1455 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1456 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1467 const GLenum kType = 0; | 1468 const GLenum kType = 0; |
| 1468 | 1469 |
| 1469 ExpectedMemoryInfo mem1 = | 1470 ExpectedMemoryInfo mem1 = |
| 1470 GetExpectedMemory(kWidth * kHeight * kBytesPerPixel); | 1471 GetExpectedMemory(kWidth * kHeight * kBytesPerPixel); |
| 1471 ExpectedMemoryInfo result1 = | 1472 ExpectedMemoryInfo result1 = |
| 1472 GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); | 1473 GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); |
| 1473 | 1474 |
| 1474 Cmds expected; | 1475 Cmds expected; |
| 1475 expected.read.Init( | 1476 expected.read.Init( |
| 1476 0, 0, kWidth, kHeight, kFormat, kType, | 1477 0, 0, kWidth, kHeight, kFormat, kType, |
| 1477 mem1.id, mem1.offset, result1.id, result1.offset); | 1478 mem1.id, mem1.offset, result1.id, result1.offset, false); |
| 1478 expected.set_token.Init(GetNextToken()); | 1479 expected.set_token.Init(GetNextToken()); |
| 1479 scoped_ptr<int8[]> buffer(new int8[kWidth * kHeight * kBytesPerPixel]); | 1480 scoped_ptr<int8[]> buffer(new int8[kWidth * kHeight * kBytesPerPixel]); |
| 1480 | 1481 |
| 1481 EXPECT_CALL(*command_buffer(), OnFlush()) | 1482 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 1482 .Times(1) | 1483 .Times(1) |
| 1483 .RetiresOnSaturation(); | 1484 .RetiresOnSaturation(); |
| 1484 | 1485 |
| 1485 gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get()); | 1486 gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get()); |
| 1486 } | 1487 } |
| 1487 | 1488 |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 ClearCommands(); | 2868 ClearCommands(); |
| 2868 gl_->Enable(GL_BLEND); | 2869 gl_->Enable(GL_BLEND); |
| 2869 EXPECT_TRUE(NoCommandsWritten()); | 2870 EXPECT_TRUE(NoCommandsWritten()); |
| 2870 } | 2871 } |
| 2871 | 2872 |
| 2872 | 2873 |
| 2873 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 2874 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
| 2874 | 2875 |
| 2875 } // namespace gles2 | 2876 } // namespace gles2 |
| 2876 } // namespace gpu | 2877 } // namespace gpu |
| OLD | NEW |