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/memory_program_cache.h" | 5 #include "gpu/command_buffer/service/memory_program_cache.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/service/gl_utils.h" | 9 #include "gpu/command_buffer/service/gl_utils.h" |
10 #include "gpu/command_buffer/service/shader_manager.h" | 10 #include "gpu/command_buffer/service/shader_manager.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 const int kEvictingProgramId = 11; | 440 const int kEvictingProgramId = 11; |
441 const GLuint kEvictingBinaryLength = kCacheSizeBytes - kBinaryLength + 1; | 441 const GLuint kEvictingBinaryLength = kCacheSizeBytes - kBinaryLength + 1; |
442 | 442 |
443 // save old source and modify for new program | 443 // save old source and modify for new program |
444 const std::string old_source = | 444 const std::string old_source = |
445 *fragment_shader_->deferred_compilation_source(); | 445 *fragment_shader_->deferred_compilation_source(); |
446 fragment_shader_->UpdateSource("al sdfkjdk"); | 446 fragment_shader_->UpdateSource("al sdfkjdk"); |
447 fragment_shader_->FlagSourceAsCompiled(true); | 447 fragment_shader_->FlagSourceAsCompiled(true); |
448 | 448 |
449 scoped_array<char> bigTestBinary = | 449 scoped_ptr<char[]> bigTestBinary = |
450 scoped_array<char>(new char[kEvictingBinaryLength]); | 450 scoped_ptr<char[]>(new char[kEvictingBinaryLength]); |
451 for (size_t i = 0; i < kEvictingBinaryLength; ++i) { | 451 for (size_t i = 0; i < kEvictingBinaryLength; ++i) { |
452 bigTestBinary[i] = i % 250; | 452 bigTestBinary[i] = i % 250; |
453 } | 453 } |
454 ProgramBinaryEmulator emulator2(kEvictingBinaryLength, | 454 ProgramBinaryEmulator emulator2(kEvictingBinaryLength, |
455 kFormat, | 455 kFormat, |
456 bigTestBinary.get()); | 456 bigTestBinary.get()); |
457 | 457 |
458 SetExpectationsForSaveLinkedProgram(kEvictingProgramId, &emulator2); | 458 SetExpectationsForSaveLinkedProgram(kEvictingProgramId, &emulator2); |
459 cache_->SaveLinkedProgram(kEvictingProgramId, | 459 cache_->SaveLinkedProgram(kEvictingProgramId, |
460 vertex_shader_, | 460 vertex_shader_, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 SetExpectationsForLoadLinkedProgram(kProgramId, &emulator2); | 554 SetExpectationsForLoadLinkedProgram(kProgramId, &emulator2); |
555 EXPECT_EQ(ProgramCache::PROGRAM_LOAD_SUCCESS, cache_->LoadLinkedProgram( | 555 EXPECT_EQ(ProgramCache::PROGRAM_LOAD_SUCCESS, cache_->LoadLinkedProgram( |
556 kProgramId, | 556 kProgramId, |
557 vertex_shader_, | 557 vertex_shader_, |
558 fragment_shader_, | 558 fragment_shader_, |
559 NULL)); | 559 NULL)); |
560 } | 560 } |
561 | 561 |
562 } // namespace gles2 | 562 } // namespace gles2 |
563 } // namespace gpu | 563 } // namespace gpu |
OLD | NEW |