| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "command_buffer/client/cross/cmd_buffer_helper.h" | 36 #include "command_buffer/client/cross/cmd_buffer_helper.h" |
| 37 #include "command_buffer/client/cross/effect_helper.h" | 37 #include "command_buffer/client/cross/effect_helper.h" |
| 38 #include "command_buffer/client/cross/fenced_allocator.h" | 38 #include "command_buffer/client/cross/fenced_allocator.h" |
| 39 #include "command_buffer/client/cross/id_allocator.h" | 39 #include "command_buffer/client/cross/id_allocator.h" |
| 40 | 40 |
| 41 // TODO: write a unit test. | 41 // TODO: write a unit test. |
| 42 | 42 |
| 43 namespace o3d { | 43 namespace o3d { |
| 44 namespace command_buffer { | 44 namespace command_buffer { |
| 45 | 45 |
| 46 bool EffectHelper::CreateEffectParameters(ResourceID effect_id, | 46 bool EffectHelper::CreateEffectParameters(ResourceId effect_id, |
| 47 std::vector<EffectParamDesc> *descs) { | 47 std::vector<EffectParamDesc> *descs) { |
| 48 using effect_param::Desc; | 48 using effect_param::Desc; |
| 49 DCHECK_NE(effect_id, kInvalidResource); | 49 DCHECK_NE(effect_id, kInvalidResource); |
| 50 DCHECK(descs); | 50 DCHECK(descs); |
| 51 descs->clear(); | 51 descs->clear(); |
| 52 | 52 |
| 53 // Get the param count. | 53 // Get the param count. |
| 54 Uint32 *retval = shm_allocator_->AllocTyped<Uint32>(1); | 54 Uint32 *retval = shm_allocator_->AllocTyped<Uint32>(1); |
| 55 helper_->GetParamCount(effect_id, sizeof(*retval), | 55 helper_->GetParamCount(effect_id, sizeof(*retval), |
| 56 shm_id_, shm_allocator_->GetOffset(retval)); | 56 shm_id_, shm_allocator_->GetOffset(retval)); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 void EffectHelper::DestroyEffectParameters( | 191 void EffectHelper::DestroyEffectParameters( |
| 192 const std::vector<EffectParamDesc> &descs) { | 192 const std::vector<EffectParamDesc> &descs) { |
| 193 for (unsigned int i = 0; i < descs.size(); ++i) { | 193 for (unsigned int i = 0; i < descs.size(); ++i) { |
| 194 const EffectParamDesc &desc = descs[i]; | 194 const EffectParamDesc &desc = descs[i]; |
| 195 helper_->DestroyParam(desc.id); | 195 helper_->DestroyParam(desc.id); |
| 196 param_id_allocator_->FreeID(desc.id); | 196 param_id_allocator_->FreeID(desc.id); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool EffectHelper::GetEffectStreams(ResourceID effect_id, | 200 bool EffectHelper::GetEffectStreams(ResourceId effect_id, |
| 201 std::vector<EffectStreamDesc> *descs) { | 201 std::vector<EffectStreamDesc> *descs) { |
| 202 using effect_stream::Desc; | 202 using effect_stream::Desc; |
| 203 DCHECK_NE(effect_id, kInvalidResource); | 203 DCHECK_NE(effect_id, kInvalidResource); |
| 204 | 204 |
| 205 // Get the param count. | 205 // Get the param count. |
| 206 Uint32 *retval = shm_allocator_->AllocTyped<Uint32>(1); | 206 Uint32 *retval = shm_allocator_->AllocTyped<Uint32>(1); |
| 207 helper_->GetStreamCount(effect_id, sizeof(*retval), | 207 helper_->GetStreamCount(effect_id, sizeof(*retval), |
| 208 shm_id_, | 208 shm_id_, |
| 209 shm_allocator_->GetOffset(retval)); | 209 shm_allocator_->GetOffset(retval)); |
| 210 // Finish has to be called to get the result. | 210 // Finish has to be called to get the result. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 Desc *raw_desc = raw_descs + j; | 250 Desc *raw_desc = raw_descs + j; |
| 251 desc->semantic = static_cast<vertex_struct::Semantic>(raw_desc->semantic); | 251 desc->semantic = static_cast<vertex_struct::Semantic>(raw_desc->semantic); |
| 252 desc->semantic_index = raw_desc->semantic_index; | 252 desc->semantic_index = raw_desc->semantic_index; |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 shm_allocator_->Free(raw_descs); | 255 shm_allocator_->Free(raw_descs); |
| 256 return true; | 256 return true; |
| 257 } | 257 } |
| 258 } // namespace command_buffer | 258 } // namespace command_buffer |
| 259 } // namespace o3d | 259 } // namespace o3d |
| OLD | NEW |