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

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

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 <GLES2/gl2extchromium.h> 10 #include <GLES2/gl2extchromium.h>
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 transfer_buffer_.reset(new MockTransferBuffer( 360 transfer_buffer_.reset(new MockTransferBuffer(
361 command_buffer(), 361 command_buffer(),
362 kTransferBufferSize, 362 kTransferBufferSize,
363 GLES2Implementation::kStartingOffset, 363 GLES2Implementation::kStartingOffset,
364 GLES2Implementation::kAlignment)); 364 GLES2Implementation::kAlignment));
365 365
366 helper_.reset(new GLES2CmdHelper(command_buffer())); 366 helper_.reset(new GLES2CmdHelper(command_buffer()));
367 helper_->Initialize(kCommandBufferSizeBytes); 367 helper_->Initialize(kCommandBufferSizeBytes);
368 368
369 gpu_control_.reset(new StrictMock<MockClientGpuControl>());
370
369 GLES2Implementation::GLStaticState state; 371 GLES2Implementation::GLStaticState state;
370 GLES2Implementation::GLStaticState::IntState& int_state = state.int_state; 372 GLES2Implementation::GLStaticState::IntState& int_state = state.int_state;
371 int_state.max_combined_texture_image_units = kMaxCombinedTextureImageUnits; 373 int_state.max_combined_texture_image_units = kMaxCombinedTextureImageUnits;
372 int_state.max_cube_map_texture_size = kMaxCubeMapTextureSize; 374 int_state.max_cube_map_texture_size = kMaxCubeMapTextureSize;
373 int_state.max_fragment_uniform_vectors = kMaxFragmentUniformVectors; 375 int_state.max_fragment_uniform_vectors = kMaxFragmentUniformVectors;
374 int_state.max_renderbuffer_size = kMaxRenderbufferSize; 376 int_state.max_renderbuffer_size = kMaxRenderbufferSize;
375 int_state.max_texture_image_units = kMaxTextureImageUnits; 377 int_state.max_texture_image_units = kMaxTextureImageUnits;
376 int_state.max_texture_size = kMaxTextureSize; 378 int_state.max_texture_size = kMaxTextureSize;
377 int_state.max_varying_vectors = kMaxVaryingVectors; 379 int_state.max_varying_vectors = kMaxVaryingVectors;
378 int_state.max_vertex_attribs = kMaxVertexAttribs; 380 int_state.max_vertex_attribs = kMaxVertexAttribs;
(...skipping 15 matching lines...) Expand all
394 EXPECT_CALL(*command_buffer(), OnFlush()) 396 EXPECT_CALL(*command_buffer(), OnFlush())
395 .WillOnce(SetMemory(mem1.ptr + sizeof(int_state), int_state)) 397 .WillOnce(SetMemory(mem1.ptr + sizeof(int_state), int_state))
396 .RetiresOnSaturation(); 398 .RetiresOnSaturation();
397 GetNextToken(); // eat the token that starting up will use. 399 GetNextToken(); // eat the token that starting up will use.
398 400
399 gl_.reset(new GLES2Implementation( 401 gl_.reset(new GLES2Implementation(
400 helper_.get(), 402 helper_.get(),
401 NULL, 403 NULL,
402 transfer_buffer_.get(), 404 transfer_buffer_.get(),
403 bind_generates_resource, 405 bind_generates_resource,
404 NULL)); 406 gpu_control_.get()));
405 ASSERT_TRUE(gl_->Initialize( 407 ASSERT_TRUE(gl_->Initialize(
406 kTransferBufferSize, 408 kTransferBufferSize,
407 kTransferBufferSize, 409 kTransferBufferSize,
408 kTransferBufferSize)); 410 kTransferBufferSize));
409 } 411 }
410 412
411 EXPECT_CALL(*command_buffer(), OnFlush()) 413 EXPECT_CALL(*command_buffer(), OnFlush())
412 .Times(1) 414 .Times(1)
413 .RetiresOnSaturation(); 415 .RetiresOnSaturation();
414 helper_->CommandBufferHelper::Finish(); 416 helper_->CommandBufferHelper::Finish();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 .RetiresOnSaturation(); 468 .RetiresOnSaturation();
467 return gl_->GetError(); 469 return gl_->GetError();
468 } 470 }
469 471
470 bool GetBucketContents(uint32 bucket_id, std::vector<int8>* data) { 472 bool GetBucketContents(uint32 bucket_id, std::vector<int8>* data) {
471 return gl_->GetBucketContents(bucket_id, data); 473 return gl_->GetBucketContents(bucket_id, data);
472 } 474 }
473 475
474 Sequence sequence_; 476 Sequence sequence_;
475 scoped_ptr<MockClientCommandBuffer> command_buffer_; 477 scoped_ptr<MockClientCommandBuffer> command_buffer_;
478 scoped_ptr<MockClientGpuControl> gpu_control_;
476 scoped_ptr<GLES2CmdHelper> helper_; 479 scoped_ptr<GLES2CmdHelper> helper_;
477 scoped_ptr<MockTransferBuffer> transfer_buffer_; 480 scoped_ptr<MockTransferBuffer> transfer_buffer_;
478 scoped_ptr<GLES2Implementation> gl_; 481 scoped_ptr<GLES2Implementation> gl_;
479 CommandBufferEntry* commands_; 482 CommandBufferEntry* commands_;
480 int token_; 483 int token_;
481 }; 484 };
482 485
483 void GLES2ImplementationTest::SetUp() { 486 void GLES2ImplementationTest::SetUp() {
484 Initialize(true); 487 Initialize(true);
485 } 488 }
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 TEST_F(GLES2ImplementationTest, GetString) { 2472 TEST_F(GLES2ImplementationTest, GetString) {
2470 const uint32 kBucketId = GLES2Implementation::kResultBucketId; 2473 const uint32 kBucketId = GLES2Implementation::kResultBucketId;
2471 const Str7 kString = {"foobar"}; 2474 const Str7 kString = {"foobar"};
2472 // GL_CHROMIUM_map_sub GL_CHROMIUM_flipy are hard coded into 2475 // GL_CHROMIUM_map_sub GL_CHROMIUM_flipy are hard coded into
2473 // GLES2Implementation. 2476 // GLES2Implementation.
2474 const char* expected_str = 2477 const char* expected_str =
2475 "foobar " 2478 "foobar "
2476 "GL_CHROMIUM_flipy " 2479 "GL_CHROMIUM_flipy "
2477 "GL_CHROMIUM_map_sub " 2480 "GL_CHROMIUM_map_sub "
2478 "GL_CHROMIUM_shallow_flush " 2481 "GL_CHROMIUM_shallow_flush "
2479 "GL_EXT_unpack_subimage"; 2482 "GL_EXT_unpack_subimage "
2483 "GL_CHROMIUM_map_image";
2480 const char kBad = 0x12; 2484 const char kBad = 0x12;
2481 struct Cmds { 2485 struct Cmds {
2482 cmd::SetBucketSize set_bucket_size1; 2486 cmd::SetBucketSize set_bucket_size1;
2483 cmds::GetString get_string; 2487 cmds::GetString get_string;
2484 cmd::GetBucketStart get_bucket_start; 2488 cmd::GetBucketStart get_bucket_start;
2485 cmd::SetToken set_token1; 2489 cmd::SetToken set_token1;
2486 cmd::SetBucketSize set_bucket_size2; 2490 cmd::SetBucketSize set_bucket_size2;
2487 }; 2491 };
2488 ExpectedMemoryInfo mem1 = GetExpectedMemory(MaxTransferBufferSize()); 2492 ExpectedMemoryInfo mem1 = GetExpectedMemory(MaxTransferBufferSize());
2489 ExpectedMemoryInfo result1 = 2493 ExpectedMemoryInfo result1 =
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 ClearCommands(); 2871 ClearCommands();
2868 gl_->Enable(GL_BLEND); 2872 gl_->Enable(GL_BLEND);
2869 EXPECT_TRUE(NoCommandsWritten()); 2873 EXPECT_TRUE(NoCommandsWritten());
2870 } 2874 }
2871 2875
2872 2876
2873 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 2877 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
2874 2878
2875 } // namespace gles2 2879 } // namespace gles2
2876 } // namespace gpu 2880 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/gpu_memory_buffer_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698