Chromium Code Reviews| 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 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 proto->set_interpolation(varying.interpolation); | 57 proto->set_interpolation(varying.interpolation); |
| 58 proto->set_is_invariant(varying.isInvariant); | 58 proto->set_is_invariant(varying.isInvariant); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void FillShaderOutputVariableProto(ShaderOutputVariableProto* proto, | 61 void FillShaderOutputVariableProto(ShaderOutputVariableProto* proto, |
| 62 const sh::OutputVariable& attrib) { | 62 const sh::OutputVariable& attrib) { |
| 63 FillShaderVariableProto(proto->mutable_basic(), attrib); | 63 FillShaderVariableProto(proto->mutable_basic(), attrib); |
| 64 proto->set_location(attrib.location); | 64 proto->set_location(attrib.location); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void FillShaderInterfaceBlockFieldProto( | |
| 68 ShaderInterfaceBlockFieldProto* proto, | |
| 69 const sh::InterfaceBlockField& interfaceBlockField) { | |
| 70 FillShaderVariableProto(proto->mutable_basic(), interfaceBlockField); | |
| 71 proto->set_is_row_major_layout(interfaceBlockField.isRowMajorLayout); | |
| 72 } | |
| 73 | |
| 74 void FillShaderInterfaceBlockProto(ShaderInterfaceBlockProto* proto, | |
| 75 const sh::InterfaceBlock& interfaceBlock) { | |
| 76 proto->set_name(interfaceBlock.name); | |
| 77 proto->set_mapped_name(interfaceBlock.mappedName); | |
| 78 proto->set_instance_name(interfaceBlock.instanceName); | |
| 79 proto->set_array_size(interfaceBlock.arraySize); | |
| 80 proto->set_layout(interfaceBlock.layout); | |
| 81 proto->set_is_row_major_layout(interfaceBlock.isRowMajorLayout); | |
| 82 proto->set_static_use(interfaceBlock.staticUse); | |
| 83 for (size_t ii = 0; ii < interfaceBlock.fields.size(); ++ii) { | |
| 84 ShaderInterfaceBlockFieldProto* field = proto->add_fields(); | |
| 85 FillShaderInterfaceBlockFieldProto(field, interfaceBlock.fields[ii]); | |
| 86 } | |
| 87 } | |
| 88 | |
| 67 void FillShaderProto(ShaderProto* proto, const char* sha, | 89 void FillShaderProto(ShaderProto* proto, const char* sha, |
| 68 const Shader* shader) { | 90 const Shader* shader) { |
| 69 proto->set_sha(sha, gpu::gles2::ProgramCache::kHashLength); | 91 proto->set_sha(sha, gpu::gles2::ProgramCache::kHashLength); |
| 70 for (AttributeMap::const_iterator iter = shader->attrib_map().begin(); | 92 for (AttributeMap::const_iterator iter = shader->attrib_map().begin(); |
| 71 iter != shader->attrib_map().end(); ++iter) { | 93 iter != shader->attrib_map().end(); ++iter) { |
| 72 ShaderAttributeProto* info = proto->add_attribs(); | 94 ShaderAttributeProto* info = proto->add_attribs(); |
| 73 FillShaderAttributeProto(info, iter->second); | 95 FillShaderAttributeProto(info, iter->second); |
| 74 } | 96 } |
| 75 for (UniformMap::const_iterator iter = shader->uniform_map().begin(); | 97 for (UniformMap::const_iterator iter = shader->uniform_map().begin(); |
| 76 iter != shader->uniform_map().end(); ++iter) { | 98 iter != shader->uniform_map().end(); ++iter) { |
| 77 ShaderUniformProto* info = proto->add_uniforms(); | 99 ShaderUniformProto* info = proto->add_uniforms(); |
| 78 FillShaderUniformProto(info, iter->second); | 100 FillShaderUniformProto(info, iter->second); |
| 79 } | 101 } |
| 80 for (VaryingMap::const_iterator iter = shader->varying_map().begin(); | 102 for (VaryingMap::const_iterator iter = shader->varying_map().begin(); |
| 81 iter != shader->varying_map().end(); ++iter) { | 103 iter != shader->varying_map().end(); ++iter) { |
| 82 ShaderVaryingProto* info = proto->add_varyings(); | 104 ShaderVaryingProto* info = proto->add_varyings(); |
| 83 FillShaderVaryingProto(info, iter->second); | 105 FillShaderVaryingProto(info, iter->second); |
| 84 } | 106 } |
| 85 for (auto iter = shader->output_variable_list().begin(); | 107 for (auto iter = shader->output_variable_list().begin(); |
| 86 iter != shader->output_variable_list().end(); ++iter) { | 108 iter != shader->output_variable_list().end(); ++iter) { |
| 87 ShaderOutputVariableProto* info = proto->add_output_variables(); | 109 ShaderOutputVariableProto* info = proto->add_output_variables(); |
| 88 FillShaderOutputVariableProto(info, *iter); | 110 FillShaderOutputVariableProto(info, *iter); |
| 89 } | 111 } |
| 112 for (InterfaceBlockMap::const_iterator iter = | |
| 113 shader->interface_block_map().begin(); | |
| 114 iter != shader->interface_block_map().end(); ++iter) { | |
| 115 ShaderInterfaceBlockProto* info = proto->add_interface_blocks(); | |
| 116 FillShaderInterfaceBlockProto(info, iter->second); | |
| 117 } | |
| 90 } | 118 } |
| 91 | 119 |
| 92 void RetrieveShaderVariableInfo( | 120 void RetrieveShaderVariableInfo( |
| 93 const ShaderVariableProto& proto, sh::ShaderVariable* variable) { | 121 const ShaderVariableProto& proto, sh::ShaderVariable* variable) { |
| 94 variable->type = proto.type(); | 122 variable->type = proto.type(); |
| 95 variable->precision = proto.precision(); | 123 variable->precision = proto.precision(); |
| 96 variable->name = proto.name(); | 124 variable->name = proto.name(); |
| 97 variable->mappedName = proto.mapped_name(); | 125 variable->mappedName = proto.mapped_name(); |
| 98 variable->arraySize = proto.array_size(); | 126 variable->arraySize = proto.array_size(); |
| 99 variable->staticUse = proto.static_use(); | 127 variable->staticUse = proto.static_use(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 129 } | 157 } |
| 130 | 158 |
| 131 void RetrieveShaderOutputVariableInfo(const ShaderOutputVariableProto& proto, | 159 void RetrieveShaderOutputVariableInfo(const ShaderOutputVariableProto& proto, |
| 132 OutputVariableList* list) { | 160 OutputVariableList* list) { |
| 133 sh::OutputVariable output_variable; | 161 sh::OutputVariable output_variable; |
| 134 RetrieveShaderVariableInfo(proto.basic(), &output_variable); | 162 RetrieveShaderVariableInfo(proto.basic(), &output_variable); |
| 135 output_variable.location = proto.location(); | 163 output_variable.location = proto.location(); |
| 136 list->push_back(output_variable); | 164 list->push_back(output_variable); |
| 137 } | 165 } |
| 138 | 166 |
| 167 void RetrieveShaderInterfaceBlockFieldInfo( | |
| 168 const ShaderInterfaceBlockFieldProto& proto, | |
| 169 sh::InterfaceBlockField* interface_block_field) { | |
| 170 RetrieveShaderVariableInfo(proto.basic(), interface_block_field); | |
| 171 interface_block_field->isRowMajorLayout = proto.is_row_major_layout(); | |
| 172 } | |
| 173 | |
| 174 void RetrieveShaderInterfaceBlockInfo(const ShaderInterfaceBlockProto& proto, | |
| 175 InterfaceBlockMap* map) { | |
| 176 sh::InterfaceBlock interface_block; | |
| 177 interface_block.name = proto.name(); | |
| 178 interface_block.mappedName = proto.mapped_name(); | |
| 179 interface_block.instanceName = proto.instance_name(); | |
| 180 interface_block.arraySize = proto.array_size(); | |
| 181 interface_block.layout = (sh::BlockLayoutType) proto.layout(); | |
|
Zhenyao Mo
2016/05/31 16:31:00
This is against chromium coding style. Please use
xinghua.cao
2016/06/01 03:10:58
Done.
| |
| 182 interface_block.isRowMajorLayout = proto.is_row_major_layout(); | |
| 183 interface_block.staticUse = proto.static_use(); | |
| 184 interface_block.fields.resize(proto.fields_size()); | |
| 185 for (int ii = 0; ii < proto.fields_size(); ++ii) { | |
| 186 RetrieveShaderInterfaceBlockFieldInfo(proto.fields(ii), | |
| 187 &(interface_block.fields[ii])); | |
|
Zhenyao Mo
2016/05/31 16:31:00
nit: wrong indent.
xinghua.cao
2016/06/01 03:10:58
Done.
| |
| 188 } | |
| 189 (*map)[proto.mapped_name()] = interface_block; | |
| 190 } | |
| 191 | |
| 139 void RunShaderCallback(const ShaderCacheCallback& callback, | 192 void RunShaderCallback(const ShaderCacheCallback& callback, |
| 140 GpuProgramProto* proto, | 193 GpuProgramProto* proto, |
| 141 std::string sha_string) { | 194 std::string sha_string) { |
| 142 std::string shader; | 195 std::string shader; |
| 143 proto->SerializeToString(&shader); | 196 proto->SerializeToString(&shader); |
| 144 | 197 |
| 145 std::string key; | 198 std::string key; |
| 146 base::Base64Encode(sha_string, &key); | 199 base::Base64Encode(sha_string, &key); |
| 147 callback.Run(key, shader); | 200 callback.Run(key, shader); |
| 148 } | 201 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 value->length()); | 254 value->length()); |
| 202 GLint success = 0; | 255 GLint success = 0; |
| 203 glGetProgramiv(program, GL_LINK_STATUS, &success); | 256 glGetProgramiv(program, GL_LINK_STATUS, &success); |
| 204 if (success == GL_FALSE) { | 257 if (success == GL_FALSE) { |
| 205 return PROGRAM_LOAD_FAILURE; | 258 return PROGRAM_LOAD_FAILURE; |
| 206 } | 259 } |
| 207 shader_a->set_attrib_map(value->attrib_map_0()); | 260 shader_a->set_attrib_map(value->attrib_map_0()); |
| 208 shader_a->set_uniform_map(value->uniform_map_0()); | 261 shader_a->set_uniform_map(value->uniform_map_0()); |
| 209 shader_a->set_varying_map(value->varying_map_0()); | 262 shader_a->set_varying_map(value->varying_map_0()); |
| 210 shader_a->set_output_variable_list(value->output_variable_list_0()); | 263 shader_a->set_output_variable_list(value->output_variable_list_0()); |
| 264 shader_a->set_interface_block_map(value->interface_block_map_0()); | |
| 211 shader_b->set_attrib_map(value->attrib_map_1()); | 265 shader_b->set_attrib_map(value->attrib_map_1()); |
| 212 shader_b->set_uniform_map(value->uniform_map_1()); | 266 shader_b->set_uniform_map(value->uniform_map_1()); |
| 213 shader_b->set_varying_map(value->varying_map_1()); | 267 shader_b->set_varying_map(value->varying_map_1()); |
| 214 shader_b->set_output_variable_list(value->output_variable_list_1()); | 268 shader_b->set_output_variable_list(value->output_variable_list_1()); |
| 269 shader_b->set_interface_block_map(value->interface_block_map_1()); | |
| 215 | 270 |
| 216 if (!shader_callback.is_null() && !disable_gpu_shader_disk_cache_) { | 271 if (!shader_callback.is_null() && !disable_gpu_shader_disk_cache_) { |
| 217 std::unique_ptr<GpuProgramProto> proto( | 272 std::unique_ptr<GpuProgramProto> proto( |
| 218 GpuProgramProto::default_instance().New()); | 273 GpuProgramProto::default_instance().New()); |
| 219 proto->set_sha(sha, kHashLength); | 274 proto->set_sha(sha, kHashLength); |
| 220 proto->set_format(value->format()); | 275 proto->set_format(value->format()); |
| 221 proto->set_program(value->data(), value->length()); | 276 proto->set_program(value->data(), value->length()); |
| 222 | 277 |
| 223 FillShaderProto(proto->mutable_vertex_shader(), a_sha, shader_a); | 278 FillShaderProto(proto->mutable_vertex_shader(), a_sha, shader_a); |
| 224 FillShaderProto(proto->mutable_fragment_shader(), b_sha, shader_b); | 279 FillShaderProto(proto->mutable_fragment_shader(), b_sha, shader_b); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 FillShaderProto(proto->mutable_vertex_shader(), a_sha, shader_a); | 347 FillShaderProto(proto->mutable_vertex_shader(), a_sha, shader_a); |
| 293 FillShaderProto(proto->mutable_fragment_shader(), b_sha, shader_b); | 348 FillShaderProto(proto->mutable_fragment_shader(), b_sha, shader_b); |
| 294 RunShaderCallback(shader_callback, proto.get(), sha_string); | 349 RunShaderCallback(shader_callback, proto.get(), sha_string); |
| 295 } | 350 } |
| 296 | 351 |
| 297 store_.Put( | 352 store_.Put( |
| 298 sha_string, | 353 sha_string, |
| 299 new ProgramCacheValue( | 354 new ProgramCacheValue( |
| 300 length, format, binary.release(), sha_string, a_sha, | 355 length, format, binary.release(), sha_string, a_sha, |
| 301 shader_a->attrib_map(), shader_a->uniform_map(), | 356 shader_a->attrib_map(), shader_a->uniform_map(), |
| 302 shader_a->varying_map(), shader_a->output_variable_list(), b_sha, | 357 shader_a->varying_map(), shader_a->output_variable_list(), |
| 358 shader_a->interface_block_map(), b_sha, | |
| 303 shader_b->attrib_map(), shader_b->uniform_map(), | 359 shader_b->attrib_map(), shader_b->uniform_map(), |
| 304 shader_b->varying_map(), shader_b->output_variable_list(), this)); | 360 shader_b->varying_map(), shader_b->output_variable_list(), |
| 361 shader_b->interface_block_map(), this)); | |
| 305 | 362 |
| 306 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeAfterKb", | 363 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeAfterKb", |
| 307 curr_size_bytes_ / 1024); | 364 curr_size_bytes_ / 1024); |
| 308 } | 365 } |
| 309 | 366 |
| 310 void MemoryProgramCache::LoadProgram(const std::string& program) { | 367 void MemoryProgramCache::LoadProgram(const std::string& program) { |
| 311 std::unique_ptr<GpuProgramProto> proto( | 368 std::unique_ptr<GpuProgramProto> proto( |
| 312 GpuProgramProto::default_instance().New()); | 369 GpuProgramProto::default_instance().New()); |
| 313 if (proto->ParseFromString(program)) { | 370 if (proto->ParseFromString(program)) { |
| 314 AttributeMap vertex_attribs; | 371 AttributeMap vertex_attribs; |
| 315 UniformMap vertex_uniforms; | 372 UniformMap vertex_uniforms; |
| 316 VaryingMap vertex_varyings; | 373 VaryingMap vertex_varyings; |
| 317 OutputVariableList vertex_output_variables; | 374 OutputVariableList vertex_output_variables; |
| 375 InterfaceBlockMap vertex_interface_blocks; | |
| 318 for (int i = 0; i < proto->vertex_shader().attribs_size(); i++) { | 376 for (int i = 0; i < proto->vertex_shader().attribs_size(); i++) { |
| 319 RetrieveShaderAttributeInfo(proto->vertex_shader().attribs(i), | 377 RetrieveShaderAttributeInfo(proto->vertex_shader().attribs(i), |
| 320 &vertex_attribs); | 378 &vertex_attribs); |
| 321 } | 379 } |
| 322 for (int i = 0; i < proto->vertex_shader().uniforms_size(); i++) { | 380 for (int i = 0; i < proto->vertex_shader().uniforms_size(); i++) { |
| 323 RetrieveShaderUniformInfo(proto->vertex_shader().uniforms(i), | 381 RetrieveShaderUniformInfo(proto->vertex_shader().uniforms(i), |
| 324 &vertex_uniforms); | 382 &vertex_uniforms); |
| 325 } | 383 } |
| 326 for (int i = 0; i < proto->vertex_shader().varyings_size(); i++) { | 384 for (int i = 0; i < proto->vertex_shader().varyings_size(); i++) { |
| 327 RetrieveShaderVaryingInfo(proto->vertex_shader().varyings(i), | 385 RetrieveShaderVaryingInfo(proto->vertex_shader().varyings(i), |
| 328 &vertex_varyings); | 386 &vertex_varyings); |
| 329 } | 387 } |
| 330 for (int i = 0; i < proto->vertex_shader().output_variables_size(); i++) { | 388 for (int i = 0; i < proto->vertex_shader().output_variables_size(); i++) { |
| 331 RetrieveShaderOutputVariableInfo( | 389 RetrieveShaderOutputVariableInfo( |
| 332 proto->vertex_shader().output_variables(i), &vertex_output_variables); | 390 proto->vertex_shader().output_variables(i), &vertex_output_variables); |
| 333 } | 391 } |
| 392 for (int i = 0; i < proto->vertex_shader().interface_blocks_size(); i++) { | |
| 393 RetrieveShaderInterfaceBlockInfo( | |
| 394 proto->vertex_shader().interface_blocks(i), &vertex_interface_blocks); | |
| 395 } | |
| 334 | 396 |
| 335 AttributeMap fragment_attribs; | 397 AttributeMap fragment_attribs; |
| 336 UniformMap fragment_uniforms; | 398 UniformMap fragment_uniforms; |
| 337 VaryingMap fragment_varyings; | 399 VaryingMap fragment_varyings; |
| 338 OutputVariableList fragment_output_variables; | 400 OutputVariableList fragment_output_variables; |
| 401 InterfaceBlockMap fragment_interface_blocks; | |
| 339 for (int i = 0; i < proto->fragment_shader().attribs_size(); i++) { | 402 for (int i = 0; i < proto->fragment_shader().attribs_size(); i++) { |
| 340 RetrieveShaderAttributeInfo(proto->fragment_shader().attribs(i), | 403 RetrieveShaderAttributeInfo(proto->fragment_shader().attribs(i), |
| 341 &fragment_attribs); | 404 &fragment_attribs); |
| 342 } | 405 } |
| 343 for (int i = 0; i < proto->fragment_shader().uniforms_size(); i++) { | 406 for (int i = 0; i < proto->fragment_shader().uniforms_size(); i++) { |
| 344 RetrieveShaderUniformInfo(proto->fragment_shader().uniforms(i), | 407 RetrieveShaderUniformInfo(proto->fragment_shader().uniforms(i), |
| 345 &fragment_uniforms); | 408 &fragment_uniforms); |
| 346 } | 409 } |
| 347 for (int i = 0; i < proto->fragment_shader().varyings_size(); i++) { | 410 for (int i = 0; i < proto->fragment_shader().varyings_size(); i++) { |
| 348 RetrieveShaderVaryingInfo(proto->fragment_shader().varyings(i), | 411 RetrieveShaderVaryingInfo(proto->fragment_shader().varyings(i), |
| 349 &fragment_varyings); | 412 &fragment_varyings); |
| 350 } | 413 } |
| 351 for (int i = 0; i < proto->fragment_shader().output_variables_size(); i++) { | 414 for (int i = 0; i < proto->fragment_shader().output_variables_size(); i++) { |
| 352 RetrieveShaderOutputVariableInfo( | 415 RetrieveShaderOutputVariableInfo( |
| 353 proto->fragment_shader().output_variables(i), | 416 proto->fragment_shader().output_variables(i), |
| 354 &fragment_output_variables); | 417 &fragment_output_variables); |
| 355 } | 418 } |
| 419 for (int i = 0; i < proto->fragment_shader().interface_blocks_size(); i++) { | |
| 420 RetrieveShaderInterfaceBlockInfo( | |
| 421 proto->fragment_shader().interface_blocks(i), | |
| 422 &fragment_interface_blocks); | |
| 423 } | |
| 356 | 424 |
| 357 std::unique_ptr<char[]> binary(new char[proto->program().length()]); | 425 std::unique_ptr<char[]> binary(new char[proto->program().length()]); |
| 358 memcpy(binary.get(), proto->program().c_str(), proto->program().length()); | 426 memcpy(binary.get(), proto->program().c_str(), proto->program().length()); |
| 359 | 427 |
| 360 store_.Put( | 428 store_.Put( |
| 361 proto->sha(), | 429 proto->sha(), |
| 362 new ProgramCacheValue( | 430 new ProgramCacheValue( |
| 363 proto->program().length(), proto->format(), binary.release(), | 431 proto->program().length(), proto->format(), binary.release(), |
| 364 proto->sha(), proto->vertex_shader().sha().c_str(), vertex_attribs, | 432 proto->sha(), proto->vertex_shader().sha().c_str(), vertex_attribs, |
| 365 vertex_uniforms, vertex_varyings, vertex_output_variables, | 433 vertex_uniforms, vertex_varyings, vertex_output_variables, |
| 366 proto->fragment_shader().sha().c_str(), fragment_attribs, | 434 vertex_interface_blocks, proto->fragment_shader().sha().c_str(), |
| 367 fragment_uniforms, fragment_varyings, fragment_output_variables, | 435 fragment_attribs, fragment_uniforms, fragment_varyings, |
| 368 this)); | 436 fragment_output_variables, fragment_interface_blocks, this)); |
| 369 | 437 |
| 370 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeAfterKb", | 438 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeAfterKb", |
| 371 curr_size_bytes_ / 1024); | 439 curr_size_bytes_ / 1024); |
| 372 } else { | 440 } else { |
| 373 LOG(ERROR) << "Failed to parse proto file."; | 441 LOG(ERROR) << "Failed to parse proto file."; |
| 374 } | 442 } |
| 375 } | 443 } |
| 376 | 444 |
| 377 MemoryProgramCache::ProgramCacheValue::ProgramCacheValue( | 445 MemoryProgramCache::ProgramCacheValue::ProgramCacheValue( |
| 378 GLsizei length, | 446 GLsizei length, |
| 379 GLenum format, | 447 GLenum format, |
| 380 const char* data, | 448 const char* data, |
| 381 const std::string& program_hash, | 449 const std::string& program_hash, |
| 382 const char* shader_0_hash, | 450 const char* shader_0_hash, |
| 383 const AttributeMap& attrib_map_0, | 451 const AttributeMap& attrib_map_0, |
| 384 const UniformMap& uniform_map_0, | 452 const UniformMap& uniform_map_0, |
| 385 const VaryingMap& varying_map_0, | 453 const VaryingMap& varying_map_0, |
| 386 const OutputVariableList& output_variable_list_0, | 454 const OutputVariableList& output_variable_list_0, |
| 455 const InterfaceBlockMap& interface_block_map_0, | |
| 387 const char* shader_1_hash, | 456 const char* shader_1_hash, |
| 388 const AttributeMap& attrib_map_1, | 457 const AttributeMap& attrib_map_1, |
| 389 const UniformMap& uniform_map_1, | 458 const UniformMap& uniform_map_1, |
| 390 const VaryingMap& varying_map_1, | 459 const VaryingMap& varying_map_1, |
| 391 const OutputVariableList& output_variable_list_1, | 460 const OutputVariableList& output_variable_list_1, |
| 461 const InterfaceBlockMap& interface_block_map_1, | |
| 392 MemoryProgramCache* program_cache) | 462 MemoryProgramCache* program_cache) |
| 393 : length_(length), | 463 : length_(length), |
| 394 format_(format), | 464 format_(format), |
| 395 data_(data), | 465 data_(data), |
| 396 program_hash_(program_hash), | 466 program_hash_(program_hash), |
| 397 shader_0_hash_(shader_0_hash, kHashLength), | 467 shader_0_hash_(shader_0_hash, kHashLength), |
| 398 attrib_map_0_(attrib_map_0), | 468 attrib_map_0_(attrib_map_0), |
| 399 uniform_map_0_(uniform_map_0), | 469 uniform_map_0_(uniform_map_0), |
| 400 varying_map_0_(varying_map_0), | 470 varying_map_0_(varying_map_0), |
| 401 output_variable_list_0_(output_variable_list_0), | 471 output_variable_list_0_(output_variable_list_0), |
| 472 interface_block_map_0_(interface_block_map_0), | |
| 402 shader_1_hash_(shader_1_hash, kHashLength), | 473 shader_1_hash_(shader_1_hash, kHashLength), |
| 403 attrib_map_1_(attrib_map_1), | 474 attrib_map_1_(attrib_map_1), |
| 404 uniform_map_1_(uniform_map_1), | 475 uniform_map_1_(uniform_map_1), |
| 405 varying_map_1_(varying_map_1), | 476 varying_map_1_(varying_map_1), |
| 406 output_variable_list_1_(output_variable_list_1), | 477 output_variable_list_1_(output_variable_list_1), |
| 478 interface_block_map_1_(interface_block_map_1), | |
| 407 program_cache_(program_cache) { | 479 program_cache_(program_cache) { |
| 408 program_cache_->curr_size_bytes_ += length_; | 480 program_cache_->curr_size_bytes_ += length_; |
| 409 program_cache_->LinkedProgramCacheSuccess(program_hash); | 481 program_cache_->LinkedProgramCacheSuccess(program_hash); |
| 410 } | 482 } |
| 411 | 483 |
| 412 MemoryProgramCache::ProgramCacheValue::~ProgramCacheValue() { | 484 MemoryProgramCache::ProgramCacheValue::~ProgramCacheValue() { |
| 413 program_cache_->curr_size_bytes_ -= length_; | 485 program_cache_->curr_size_bytes_ -= length_; |
| 414 program_cache_->Evict(program_hash_); | 486 program_cache_->Evict(program_hash_); |
| 415 } | 487 } |
| 416 | 488 |
| 417 } // namespace gles2 | 489 } // namespace gles2 |
| 418 } // namespace gpu | 490 } // namespace gpu |
| OLD | NEW |