diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /intern/cycles/render/tables.cpp | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/cycles/render/tables.cpp')
-rw-r--r-- | intern/cycles/render/tables.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/intern/cycles/render/tables.cpp b/intern/cycles/render/tables.cpp index ddbb138f059..d88925939e3 100644 --- a/intern/cycles/render/tables.cpp +++ b/intern/cycles/render/tables.cpp @@ -26,92 +26,92 @@ CCL_NAMESPACE_BEGIN LookupTables::LookupTables() { - need_update = true; + need_update = true; } LookupTables::~LookupTables() { - assert(lookup_tables.size() == 0); + assert(lookup_tables.size() == 0); } void LookupTables::device_update(Device *, DeviceScene *dscene) { - if(!need_update) - return; + if (!need_update) + return; - VLOG(1) << "Total " << lookup_tables.size() << " lookup tables."; + VLOG(1) << "Total " << lookup_tables.size() << " lookup tables."; - if(lookup_tables.size() > 0) - dscene->lookup_table.copy_to_device(); + if (lookup_tables.size() > 0) + dscene->lookup_table.copy_to_device(); - need_update = false; + need_update = false; } void LookupTables::device_free(Device *, DeviceScene *dscene) { - dscene->lookup_table.free(); + dscene->lookup_table.free(); } static size_t round_up_to_multiple(size_t size, size_t chunk) { - return ((size + chunk - 1)/chunk) * chunk; + return ((size + chunk - 1) / chunk) * chunk; } -size_t LookupTables::add_table(DeviceScene *dscene, vector<float>& data) +size_t LookupTables::add_table(DeviceScene *dscene, vector<float> &data) { - assert(data.size() > 0); + assert(data.size() > 0); - need_update = true; + need_update = true; - Table new_table; - new_table.offset = 0; - new_table.size = round_up_to_multiple(data.size(), TABLE_CHUNK_SIZE); + Table new_table; + new_table.offset = 0; + new_table.size = round_up_to_multiple(data.size(), TABLE_CHUNK_SIZE); - /* find space to put lookup table */ - list<Table>::iterator table; + /* find space to put lookup table */ + list<Table>::iterator table; - for(table = lookup_tables.begin(); table != lookup_tables.end(); table++) { - if(new_table.offset + new_table.size <= table->offset) { - lookup_tables.insert(table, new_table); - break; - } - else - new_table.offset = table->offset + table->size; - } + for (table = lookup_tables.begin(); table != lookup_tables.end(); table++) { + if (new_table.offset + new_table.size <= table->offset) { + lookup_tables.insert(table, new_table); + break; + } + else + new_table.offset = table->offset + table->size; + } - if(table == lookup_tables.end()) { - /* add at the end */ - lookup_tables.push_back(new_table); - dscene->lookup_table.resize(new_table.offset + new_table.size); - } + if (table == lookup_tables.end()) { + /* add at the end */ + lookup_tables.push_back(new_table); + dscene->lookup_table.resize(new_table.offset + new_table.size); + } - /* copy table data and return offset */ - float *dtable = dscene->lookup_table.data(); - memcpy(dtable + new_table.offset, &data[0], sizeof(float) * data.size()); + /* copy table data and return offset */ + float *dtable = dscene->lookup_table.data(); + memcpy(dtable + new_table.offset, &data[0], sizeof(float) * data.size()); - return new_table.offset; + return new_table.offset; } void LookupTables::remove_table(size_t *offset) { - if(*offset == TABLE_OFFSET_INVALID) { - /* The table isn't even allocated, so just return here. */ - return; - } + if (*offset == TABLE_OFFSET_INVALID) { + /* The table isn't even allocated, so just return here. */ + return; + } - need_update = true; + need_update = true; - list<Table>::iterator table; + list<Table>::iterator table; - for(table = lookup_tables.begin(); table != lookup_tables.end(); table++) { - if(table->offset == *offset) { - lookup_tables.erase(table); - *offset = TABLE_OFFSET_INVALID; - return; - } - } + for (table = lookup_tables.begin(); table != lookup_tables.end(); table++) { + if (table->offset == *offset) { + lookup_tables.erase(table); + *offset = TABLE_OFFSET_INVALID; + return; + } + } - assert(table != lookup_tables.end()); + assert(table != lookup_tables.end()); } CCL_NAMESPACE_END |