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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 public: | 70 public: |
71 static const size_t kCacheSizeBytes = 1024; | 71 static const size_t kCacheSizeBytes = 1024; |
72 static const bool kDisableGpuDiskCache = false; | 72 static const bool kDisableGpuDiskCache = false; |
73 static const GLuint kVertexShaderClientId = 90; | 73 static const GLuint kVertexShaderClientId = 90; |
74 static const GLuint kVertexShaderServiceId = 100; | 74 static const GLuint kVertexShaderServiceId = 100; |
75 static const GLuint kFragmentShaderClientId = 91; | 75 static const GLuint kFragmentShaderClientId = 91; |
76 static const GLuint kFragmentShaderServiceId = 100; | 76 static const GLuint kFragmentShaderServiceId = 100; |
77 | 77 |
78 MemoryProgramCacheTest() | 78 MemoryProgramCacheTest() |
79 : cache_(new MemoryProgramCache(kCacheSizeBytes, kDisableGpuDiskCache)), | 79 : cache_(new MemoryProgramCache(kCacheSizeBytes, kDisableGpuDiskCache)), |
80 vertex_shader_(NULL), | 80 shader_manager_(nullptr), |
81 fragment_shader_(NULL), | 81 vertex_shader_(nullptr), |
82 shader_cache_count_(0) { | 82 fragment_shader_(nullptr), |
83 } | 83 shader_cache_count_(0) {} |
84 ~MemoryProgramCacheTest() override { shader_manager_.Destroy(false); } | 84 ~MemoryProgramCacheTest() override { shader_manager_.Destroy(false); } |
85 | 85 |
86 void ShaderCacheCb(const std::string& key, const std::string& shader) { | 86 void ShaderCacheCb(const std::string& key, const std::string& shader) { |
87 shader_cache_count_++; | 87 shader_cache_count_++; |
88 shader_cache_shader_ = shader; | 88 shader_cache_shader_ = shader; |
89 } | 89 } |
90 | 90 |
91 int32_t shader_cache_count() { return shader_cache_count_; } | 91 int32_t shader_cache_count() { return shader_cache_count_; } |
92 const std::string& shader_cache_shader() { return shader_cache_shader_; } | 92 const std::string& shader_cache_shader() { return shader_cache_shader_; } |
93 | 93 |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 fragment_shader_, | 684 fragment_shader_, |
685 NULL, | 685 NULL, |
686 varyings_, | 686 varyings_, |
687 GL_NONE, | 687 GL_NONE, |
688 base::Bind(&MemoryProgramCacheTest::ShaderCacheCb, | 688 base::Bind(&MemoryProgramCacheTest::ShaderCacheCb, |
689 base::Unretained(this)))); | 689 base::Unretained(this)))); |
690 } | 690 } |
691 | 691 |
692 } // namespace gles2 | 692 } // namespace gles2 |
693 } // namespace gpu | 693 } // namespace gpu |
OLD | NEW |