Chromium Code Reviews| 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| (...skipping 7048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7059 | 7059 |
| 7060 GenHelper<GenQueriesEXTImmediate>(kNewClientId); | 7060 GenHelper<GenQueriesEXTImmediate>(kNewClientId); |
| 7061 | 7061 |
| 7062 // Test valid parameters work. | 7062 // Test valid parameters work. |
| 7063 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) | 7063 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) |
| 7064 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 7064 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
| 7065 .RetiresOnSaturation(); | 7065 .RetiresOnSaturation(); |
| 7066 EXPECT_CALL(*gl_, BeginQueryARB(GL_ANY_SAMPLES_PASSED_EXT, kNewServiceId)) | 7066 EXPECT_CALL(*gl_, BeginQueryARB(GL_ANY_SAMPLES_PASSED_EXT, kNewServiceId)) |
| 7067 .Times(1) | 7067 .Times(1) |
| 7068 .RetiresOnSaturation(); | 7068 .RetiresOnSaturation(); |
| 7069 | |
| 7070 // Query object should not be created untill BeginQueriesEXT. | |
| 7071 QueryManager* query_manager = decoder_->GetQueryManager(); | |
| 7072 ASSERT_TRUE(query_manager != NULL); | |
| 7073 QueryManager::Query* query = query_manager->GetQuery(kNewClientId); | |
| 7074 ASSERT_TRUE(query == NULL); | |
|
piman
2014/04/22 00:37:31
nit: EXPECT_TRUE
rptr
2014/04/22 05:43:18
Done.
| |
| 7075 | |
| 7076 // BeginQueryEXT should fail if id is not generated from GenQueriesEXT. | |
| 7077 begin_cmd.Init(GL_ANY_SAMPLES_PASSED_EXT, | |
| 7078 kInvalidClientId, | |
| 7079 kSharedMemoryId, | |
| 7080 kSharedMemoryOffset); | |
| 7081 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); | |
| 7082 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | |
| 7083 | |
| 7069 begin_cmd.Init( | 7084 begin_cmd.Init( |
| 7070 GL_ANY_SAMPLES_PASSED_EXT, kNewClientId, | 7085 GL_ANY_SAMPLES_PASSED_EXT, kNewClientId, |
| 7071 kSharedMemoryId, kSharedMemoryOffset); | 7086 kSharedMemoryId, kSharedMemoryOffset); |
| 7072 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); | 7087 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); |
| 7073 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 7088 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 7074 | 7089 |
| 7075 QueryManager* query_manager = decoder_->GetQueryManager(); | 7090 // After BeginQueriesEXT id name should have query object associated with it. |
| 7076 ASSERT_TRUE(query_manager != NULL); | 7091 query = query_manager->GetQuery(kNewClientId); |
| 7077 QueryManager::Query* query = query_manager->GetQuery(kNewClientId); | |
| 7078 ASSERT_TRUE(query != NULL); | 7092 ASSERT_TRUE(query != NULL); |
| 7079 EXPECT_FALSE(query->pending()); | 7093 EXPECT_FALSE(query->pending()); |
| 7080 | 7094 |
| 7081 // Test trying begin again fails | 7095 // Test trying begin again fails |
| 7082 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); | 7096 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); |
| 7083 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7097 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 7084 | 7098 |
| 7085 // Test end fails with different target | 7099 // Test end fails with different target |
| 7086 end_cmd.Init(GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, 1); | 7100 end_cmd.Init(GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, 1); |
| 7087 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); | 7101 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); |
| (...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9556 // TODO(gman): TexImage2DImmediate | 9570 // TODO(gman): TexImage2DImmediate |
| 9557 | 9571 |
| 9558 // TODO(gman): TexSubImage2DImmediate | 9572 // TODO(gman): TexSubImage2DImmediate |
| 9559 | 9573 |
| 9560 // TODO(gman): UseProgram | 9574 // TODO(gman): UseProgram |
| 9561 | 9575 |
| 9562 // TODO(gman): SwapBuffers | 9576 // TODO(gman): SwapBuffers |
| 9563 | 9577 |
| 9564 } // namespace gles2 | 9578 } // namespace gles2 |
| 9565 } // namespace gpu | 9579 } // namespace gpu |
| OLD | NEW |