Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 10577037: Add GL_CHROMIUM_get_error_query (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "gpu/command_buffer/client/client_test_helper.h" 10 #include "gpu/command_buffer/client/client_test_helper.h"
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 EXPECT_EQ(0xBDu, available); 2557 EXPECT_EQ(0xBDu, available);
2558 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); 2558 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
2559 2559
2560 // Test GetQueryObjectuivEXT CheckResultsAvailable 2560 // Test GetQueryObjectuivEXT CheckResultsAvailable
2561 ClearCommands(); 2561 ClearCommands();
2562 gl_->GetQueryObjectuivEXT(id1, GL_QUERY_RESULT_AVAILABLE_EXT, &available); 2562 gl_->GetQueryObjectuivEXT(id1, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
2563 EXPECT_TRUE(NoCommandsWritten()); 2563 EXPECT_TRUE(NoCommandsWritten());
2564 EXPECT_EQ(0u, available); 2564 EXPECT_EQ(0u, available);
2565 } 2565 }
2566 2566
2567 TEST_F(GLES2ImplementationTest, ErrorQuery) {
2568 GLuint id = 0;
2569 gl_->GenQueriesEXT(1, &id);
2570 ClearCommands();
2571
2572 // Test BeginQueryEXT does NOT insert commands.
2573 gl_->BeginQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM, id);
2574 EXPECT_TRUE(NoCommandsWritten());
2575 QueryTracker::Query* query = GetQuery(id);
2576 ASSERT_TRUE(query != NULL);
2577
2578 // Test EndQueryEXT sends both begin and end command
2579 struct EndCmds {
2580 BeginQueryEXT begin_query;
2581 EndQueryEXT end_query;
2582 };
2583 EndCmds expected_end_cmds;
2584 expected_end_cmds.begin_query.Init(
2585 GL_GET_ERROR_QUERY_CHROMIUM, id, query->shm_id(), query->shm_offset());
2586 expected_end_cmds.end_query.Init(
2587 GL_GET_ERROR_QUERY_CHROMIUM, query->submit_count());
2588 const void* commands = GetPut();
2589 gl_->EndQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM);
2590 EXPECT_EQ(0, memcmp(
2591 &expected_end_cmds, commands, sizeof(expected_end_cmds)));
2592 ClearCommands();
2593
2594 // Check result is not yet available.
2595 GLuint available = 0xBDu;
2596 gl_->GetQueryObjectuivEXT(id, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
2597 EXPECT_TRUE(NoCommandsWritten());
2598 EXPECT_EQ(0u, available);
2599
2600 // Test no commands are sent if there is a client side error.
2601
2602 // Generate a client side error
2603 gl_->ActiveTexture(GL_TEXTURE0 - 1);
2604
2605 gl_->BeginQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM, id);
2606 gl_->EndQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM);
2607 EXPECT_TRUE(NoCommandsWritten());
2608
2609 // Check result is available.
2610 gl_->GetQueryObjectuivEXT(id, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
2611 EXPECT_TRUE(NoCommandsWritten());
2612 EXPECT_NE(0u, available);
2613
2614 // Check result.
2615 GLuint result = 0xBDu;
2616 gl_->GetQueryObjectuivEXT(id, GL_QUERY_RESULT_EXT, &result);
2617 EXPECT_TRUE(NoCommandsWritten());
2618 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), result);
2619 }
2620
2567 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 2621 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
2568 2622
2569 } // namespace gles2 2623 } // namespace gles2
2570 } // namespace gpu 2624 } // namespace gpu
2571 2625
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/query_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698