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/program_cache.h" | 5 #include "gpu/command_buffer/service/program_cache.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "gpu/command_buffer/service/shader_manager.h" | 9 #include "gpu/command_buffer/service/shader_manager.h" |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 size_t current_pos = shader0_size + shader1_size; | 116 size_t current_pos = shader0_size + shader1_size; |
117 std::map<std::string, GLint>::const_iterator it; | 117 std::map<std::string, GLint>::const_iterator it; |
118 for (it = bind_attrib_location_map->begin(); | 118 for (it = bind_attrib_location_map->begin(); |
119 it != bind_attrib_location_map->end(); | 119 it != bind_attrib_location_map->end(); |
120 ++it) { | 120 ++it) { |
121 const size_t name_size = it->first.length(); | 121 const size_t name_size = it->first.length(); |
122 memcpy(&buffer.get()[current_pos], it->first.c_str(), name_size); | 122 memcpy(&buffer.get()[current_pos], it->first.c_str(), name_size); |
123 current_pos += name_size; | 123 current_pos += name_size; |
124 const GLint value = it->second; | 124 const GLint value = it->second; |
125 buffer[current_pos++] = value >> 24; | 125 buffer[current_pos++] = value >> 24; |
126 buffer[current_pos++] = value >> 16; | 126 buffer[current_pos++] = static_cast<unsigned char>(value >> 16); |
127 buffer[current_pos++] = value >> 8; | 127 buffer[current_pos++] = static_cast<unsigned char>(value >> 8); |
128 buffer[current_pos++] = value; | 128 buffer[current_pos++] = static_cast<unsigned char>(value); |
129 } | 129 } |
130 } | 130 } |
131 base::SHA1HashBytes(buffer.get(), | 131 base::SHA1HashBytes(buffer.get(), |
132 total_size, reinterpret_cast<unsigned char*>(result)); | 132 total_size, reinterpret_cast<unsigned char*>(result)); |
133 } | 133 } |
134 | 134 |
135 } // namespace gles2 | 135 } // namespace gles2 |
136 } // namespace gpu | 136 } // namespace gpu |
OLD | NEW |