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_manager.h" | 5 #include "gpu/command_buffer/service/program_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 programs_.insert( | 1143 programs_.insert( |
1144 std::make_pair(client_id, | 1144 std::make_pair(client_id, |
1145 scoped_refptr<Program>( | 1145 scoped_refptr<Program>( |
1146 new Program(this, service_id)))); | 1146 new Program(this, service_id)))); |
1147 DCHECK(result.second); | 1147 DCHECK(result.second); |
1148 return result.first->second.get(); | 1148 return result.first->second.get(); |
1149 } | 1149 } |
1150 | 1150 |
1151 Program* ProgramManager::GetProgram(GLuint client_id) { | 1151 Program* ProgramManager::GetProgram(GLuint client_id) { |
1152 ProgramMap::iterator it = programs_.find(client_id); | 1152 ProgramMap::iterator it = programs_.find(client_id); |
1153 return it != programs_.end() ? it->second : NULL; | 1153 return it != programs_.end() ? it->second.get() : NULL; |
1154 } | 1154 } |
1155 | 1155 |
1156 bool ProgramManager::GetClientId(GLuint service_id, GLuint* client_id) const { | 1156 bool ProgramManager::GetClientId(GLuint service_id, GLuint* client_id) const { |
1157 // This doesn't need to be fast. It's only used during slow queries. | 1157 // This doesn't need to be fast. It's only used during slow queries. |
1158 for (ProgramMap::const_iterator it = programs_.begin(); | 1158 for (ProgramMap::const_iterator it = programs_.begin(); |
1159 it != programs_.end(); ++it) { | 1159 it != programs_.end(); ++it) { |
1160 if (it->second->service_id() == service_id) { | 1160 if (it->second->service_id() == service_id) { |
1161 *client_id = it->first; | 1161 *client_id = it->first; |
1162 return true; | 1162 return true; |
1163 } | 1163 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 program->ClearUniforms(&zero_); | 1230 program->ClearUniforms(&zero_); |
1231 } | 1231 } |
1232 } | 1232 } |
1233 | 1233 |
1234 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1234 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
1235 return index + element * 0x10000; | 1235 return index + element * 0x10000; |
1236 } | 1236 } |
1237 | 1237 |
1238 } // namespace gles2 | 1238 } // namespace gles2 |
1239 } // namespace gpu | 1239 } // namespace gpu |
OLD | NEW |