| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 GetShaderInfoLog cmd; | 1489 GetShaderInfoLog cmd; |
| 1490 cmd.Init(kInvalidClientId, kBucketId); | 1490 cmd.Init(kInvalidClientId, kBucketId); |
| 1491 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1491 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1492 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1492 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 TEST_P(GLES3DecoderWithShaderTest, GetTransformFeedbackVaryingSucceeds) { | 1495 TEST_P(GLES3DecoderWithShaderTest, GetTransformFeedbackVaryingSucceeds) { |
| 1496 const GLuint kIndex = 1; | 1496 const GLuint kIndex = 1; |
| 1497 const uint32_t kBucketId = 123; | 1497 const uint32_t kBucketId = 123; |
| 1498 const char kName[] = "HolyCow"; | 1498 const char kName[] = "HolyCow"; |
| 1499 const GLsizei kNumVaryings = 2; |
| 1499 const GLsizei kBufferSize = static_cast<GLsizei>(strlen(kName) + 1); | 1500 const GLsizei kBufferSize = static_cast<GLsizei>(strlen(kName) + 1); |
| 1500 const GLsizei kSize = 2; | 1501 const GLsizei kSize = 2; |
| 1501 const GLenum kType = GL_FLOAT_VEC2; | 1502 const GLenum kType = GL_FLOAT_VEC2; |
| 1502 GetTransformFeedbackVarying cmd; | 1503 GetTransformFeedbackVarying cmd; |
| 1503 typedef GetTransformFeedbackVarying::Result Result; | 1504 typedef GetTransformFeedbackVarying::Result Result; |
| 1504 Result* result = static_cast<Result*>(shared_memory_address_); | 1505 Result* result = static_cast<Result*>(shared_memory_address_); |
| 1505 result->success = 0; | 1506 result->success = 0; |
| 1506 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) | 1507 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) |
| 1507 .WillOnce(SetArgPointee<2>(GL_TRUE)) | 1508 .WillOnce(SetArgPointee<2>(GL_TRUE)) |
| 1508 .RetiresOnSaturation(); | 1509 .RetiresOnSaturation(); |
| 1509 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, | 1510 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, |
| 1511 GL_TRANSFORM_FEEDBACK_VARYINGS, _)) |
| 1512 .WillOnce(SetArgPointee<2>(kNumVaryings)) |
| 1513 .RetiresOnSaturation(); |
| 1514 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, |
| 1510 GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, _)) | 1515 GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, _)) |
| 1511 .WillOnce(SetArgPointee<2>(kBufferSize)) | 1516 .WillOnce(SetArgPointee<2>(kBufferSize)) |
| 1512 .RetiresOnSaturation(); | 1517 .RetiresOnSaturation(); |
| 1513 EXPECT_CALL(*gl_, GetError()) | |
| 1514 .WillOnce(Return(GL_NO_ERROR)) | |
| 1515 .WillOnce(Return(GL_NO_ERROR)) | |
| 1516 .RetiresOnSaturation(); | |
| 1517 EXPECT_CALL(*gl_, | 1518 EXPECT_CALL(*gl_, |
| 1518 GetTransformFeedbackVarying( | 1519 GetTransformFeedbackVarying( |
| 1519 kServiceProgramId, kIndex, _, _, _, _, _)) | 1520 kServiceProgramId, kIndex, _, _, _, _, _)) |
| 1520 .WillOnce(DoAll(SetArgPointee<3>(kBufferSize - 1), | 1521 .WillOnce(DoAll(SetArgPointee<3>(kBufferSize - 1), |
| 1521 SetArgPointee<4>(kSize), | 1522 SetArgPointee<4>(kSize), |
| 1522 SetArgPointee<5>(kType), | 1523 SetArgPointee<5>(kType), |
| 1523 SetArrayArgument<6>(kName, kName + kBufferSize))) | 1524 SetArrayArgument<6>(kName, kName + kBufferSize))) |
| 1524 .RetiresOnSaturation(); | 1525 .RetiresOnSaturation(); |
| 1525 cmd.Init(client_program_id_, | 1526 cmd.Init(client_program_id_, |
| 1526 kIndex, | 1527 kIndex, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 shared_memory_id_, | 1567 shared_memory_id_, |
| 1567 shared_memory_offset_); | 1568 shared_memory_offset_); |
| 1568 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1569 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1569 EXPECT_EQ(0, result->success); | 1570 EXPECT_EQ(0, result->success); |
| 1570 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1571 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 1571 } | 1572 } |
| 1572 | 1573 |
| 1573 TEST_P(GLES3DecoderWithShaderTest, GetTransformFeedbackVaryingBadParamsFails) { | 1574 TEST_P(GLES3DecoderWithShaderTest, GetTransformFeedbackVaryingBadParamsFails) { |
| 1574 const GLuint kIndex = 1; | 1575 const GLuint kIndex = 1; |
| 1575 const uint32_t kBucketId = 123; | 1576 const uint32_t kBucketId = 123; |
| 1576 const GLsizei kBufferSize = 10; | 1577 const GLsizei kNumVaryings = 1; |
| 1577 GetTransformFeedbackVarying cmd; | 1578 GetTransformFeedbackVarying cmd; |
| 1578 typedef GetTransformFeedbackVarying::Result Result; | 1579 typedef GetTransformFeedbackVarying::Result Result; |
| 1579 Result* result = static_cast<Result*>(shared_memory_address_); | 1580 Result* result = static_cast<Result*>(shared_memory_address_); |
| 1580 result->success = 0; | 1581 result->success = 0; |
| 1581 cmd.Init(client_program_id_, | 1582 cmd.Init(client_program_id_, |
| 1582 kIndex, | 1583 kIndex, |
| 1583 kBucketId, | 1584 kBucketId, |
| 1584 shared_memory_id_, | 1585 shared_memory_id_, |
| 1585 shared_memory_offset_); | 1586 shared_memory_offset_); |
| 1586 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) | 1587 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) |
| 1587 .WillOnce(SetArgPointee<2>(GL_TRUE)) | 1588 .WillOnce(SetArgPointee<2>(GL_TRUE)) |
| 1588 .RetiresOnSaturation(); | 1589 .RetiresOnSaturation(); |
| 1589 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, | 1590 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, |
| 1590 GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, _)) | 1591 GL_TRANSFORM_FEEDBACK_VARYINGS, _)) |
| 1591 .WillOnce(SetArgPointee<2>(kBufferSize)) | 1592 .WillOnce(SetArgPointee<2>(kNumVaryings)) |
| 1592 .RetiresOnSaturation(); | |
| 1593 EXPECT_CALL(*gl_, GetError()) | |
| 1594 .WillOnce(Return(GL_NO_ERROR)) | |
| 1595 .WillOnce(Return(GL_INVALID_VALUE)) | |
| 1596 .RetiresOnSaturation(); | |
| 1597 EXPECT_CALL(*gl_, | |
| 1598 GetTransformFeedbackVarying( | |
| 1599 kServiceProgramId, kIndex, _, _, _, _, _)) | |
| 1600 .Times(1) | |
| 1601 .RetiresOnSaturation(); | 1593 .RetiresOnSaturation(); |
| 1602 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1594 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1603 EXPECT_EQ(0, result->success); | 1595 EXPECT_EQ(0, result->success); |
| 1604 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1596 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 1605 } | 1597 } |
| 1606 | 1598 |
| 1607 TEST_P(GLES3DecoderWithShaderTest, | 1599 TEST_P(GLES3DecoderWithShaderTest, |
| 1608 GetTransformFeedbackVaryingBadSharedMemoryFails) { | 1600 GetTransformFeedbackVaryingBadSharedMemoryFails) { |
| 1609 const GLuint kIndex = 1; | 1601 const GLuint kIndex = 1; |
| 1610 const uint32_t kBucketId = 123; | 1602 const uint32_t kBucketId = 123; |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 } | 2258 } |
| 2267 | 2259 |
| 2268 // TODO(gman): DeleteProgram | 2260 // TODO(gman): DeleteProgram |
| 2269 | 2261 |
| 2270 // TODO(gman): UseProgram | 2262 // TODO(gman): UseProgram |
| 2271 | 2263 |
| 2272 // TODO(gman): DeleteShader | 2264 // TODO(gman): DeleteShader |
| 2273 | 2265 |
| 2274 } // namespace gles2 | 2266 } // namespace gles2 |
| 2275 } // namespace gpu | 2267 } // namespace gpu |
| OLD | NEW |