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

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

Issue 10568003: Add support for GL_CHROMIUM_consistent_uniform_locations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 EXPECT_EQ(handle, kResult); 2286 EXPECT_EQ(handle, kResult);
2287 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); 2287 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError());
2288 } 2288 }
2289 2289
2290 TEST_F(GLES2ImplementationTest, GetString) { 2290 TEST_F(GLES2ImplementationTest, GetString) {
2291 const uint32 kBucketId = GLES2Implementation::kResultBucketId; 2291 const uint32 kBucketId = GLES2Implementation::kResultBucketId;
2292 const Str7 kString = {"foobar"}; 2292 const Str7 kString = {"foobar"};
2293 // GL_CHROMIUM_map_sub GL_CHROMIUM_flipy are hard coded into 2293 // GL_CHROMIUM_map_sub GL_CHROMIUM_flipy are hard coded into
2294 // GLES2Implementation. 2294 // GLES2Implementation.
2295 const char* expected_str = 2295 const char* expected_str =
2296 "foobar GL_CHROMIUM_map_sub GL_CHROMIUM_flipy GL_EXT_unpack_subimage"; 2296 "foobar "
2297 "GL_CHROMIUM_map_sub "
2298 "GL_CHROMIUM_flipy "
2299 "GL_CHROMIUM_consistent_uniform_locations "
2300 "GL_EXT_unpack_subimage";
2297 const char kBad = 0x12; 2301 const char kBad = 0x12;
2298 struct Cmds { 2302 struct Cmds {
2299 cmd::SetBucketSize set_bucket_size1; 2303 cmd::SetBucketSize set_bucket_size1;
2300 GetString get_string; 2304 GetString get_string;
2301 cmd::GetBucketStart get_bucket_start; 2305 cmd::GetBucketStart get_bucket_start;
2302 cmd::SetToken set_token1; 2306 cmd::SetToken set_token1;
2303 cmd::SetBucketSize set_bucket_size2; 2307 cmd::SetBucketSize set_bucket_size2;
2304 }; 2308 };
2305 ExpectedMemoryInfo mem1 = GetExpectedMemory(MaxTransferBufferSize()); 2309 ExpectedMemoryInfo mem1 = GetExpectedMemory(MaxTransferBufferSize());
2306 ExpectedMemoryInfo result1 = 2310 ExpectedMemoryInfo result1 =
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 EXPECT_EQ(0xBDu, available); 2551 EXPECT_EQ(0xBDu, available);
2548 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); 2552 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
2549 2553
2550 // Test GetQueryObjectuivEXT CheckResultsAvailable 2554 // Test GetQueryObjectuivEXT CheckResultsAvailable
2551 ClearCommands(); 2555 ClearCommands();
2552 gl_->GetQueryObjectuivEXT(id1, GL_QUERY_RESULT_AVAILABLE_EXT, &available); 2556 gl_->GetQueryObjectuivEXT(id1, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
2553 EXPECT_TRUE(NoCommandsWritten()); 2557 EXPECT_TRUE(NoCommandsWritten());
2554 EXPECT_EQ(0u, available); 2558 EXPECT_EQ(0u, available);
2555 } 2559 }
2556 2560
2561 TEST_F(GLES2ImplementationTest, GetUniformLocationsCHROMIUM) {
2562 static const GLUniformDefinitionCHROMIUM good_defs[] = {
2563 { GL_FLOAT_VEC4, 1, "moo", },
2564 { GL_FLOAT_VEC4, 4, "bar", },
2565 { GL_FLOAT_VEC4, 3, "foo", },
2566 };
2567
2568 static const GLUniformDefinitionCHROMIUM bad_defs[] = {
2569 { GL_FLOAT_VEC4, 1, "moo", },
2570 { GL_FLOAT_VEC4, 0, "bar", },
2571 { GL_FLOAT_VEC4, 3, "foo", },
2572 };
2573
2574 // Test bad count
2575 GLint locations[50] = { -1, };
2576 gl_->GetUniformLocationsCHROMIUM(bad_defs, 0, 1, locations);
2577 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2578 EXPECT_EQ(-1, locations[0]);
2579
2580 // Test bad size.
2581 gl_->GetUniformLocationsCHROMIUM(
2582 bad_defs, arraysize(bad_defs), 1, locations);
2583 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2584 EXPECT_EQ(-1, locations[0]);
2585
2586 // Test max_locations
2587 gl_->GetUniformLocationsCHROMIUM(
2588 good_defs, arraysize(good_defs), 3, locations);
2589 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(2, 0)),
2590 locations[0]);
2591 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(0, 0)),
2592 locations[1]);
2593 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(0, 1)),
2594 locations[2]);
2595 EXPECT_EQ(0, locations[3]);
2596
2597 // Test all.
2598 gl_->GetUniformLocationsCHROMIUM(
2599 good_defs, arraysize(good_defs), arraysize(locations), locations);
2600 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(2, 0)),
2601 locations[0]);
2602 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(0, 0)),
2603 locations[1]);
2604 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(0, 1)),
2605 locations[2]);
2606 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(0, 2)),
2607 locations[3]);
2608 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(0, 3)),
2609 locations[4]);
2610 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(1, 0)),
2611 locations[5]);
2612 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(1, 1)),
2613 locations[6]);
2614 EXPECT_EQ(GLES2Util::SwizzleLocation(GLES2Util::MakeFakeLocation(1, 2)),
2615 locations[7]);
2616 EXPECT_EQ(0, locations[8]);
2617 }
2618
2557 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 2619 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
2558 2620
2559 } // namespace gles2 2621 } // namespace gles2
2560 } // namespace gpu 2622 } // namespace gpu
2561 2623
2562 2624
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_autogen.h ('k') | gpu/command_buffer/cmd_buffer_functions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698