| 198 | } |
| 199 | |
| 200 | void InstanceArray::convertToDeviceRepresentation(size_t offset, char* data_host, char* data_device) const { |
| 201 | InstanceArray* iarray = (InstanceArray*)(data_host + offset); |
| 202 | std::memcpy(data_host + offset, (void*)this, sizeof(InstanceArray)); |
| 203 | offset += sizeof(InstanceArray); |
| 204 | |
| 205 | const size_t offsetObjects = offset; |
| 206 | Accel** objects_host = (Accel**)(data_host + offsetObjects); |
| 207 | for (size_t i = 0; i < numObjects; ++i) { |
| 208 | objects_host[i] = (Accel*)((Scene*)objects[i])->getTraversable(); |
| 209 | } |
| 210 | |
| 211 | offset += numObjects * sizeof(Accel*); |
| 212 | iarray->objects = (Accel**)(data_device + offsetObjects); |
| 213 | |
| 214 | if (l2w_buf.size() > 0) { |
| 215 | const size_t offsetBuffer = offset; |
| 216 | for (size_t t = 0; t < numTimeSteps; ++t) { |
| 217 | std::memcpy(data_host + offset, &(l2w_buf[t]), sizeof(RawBufferView)); |
| 218 | offset += sizeof(RawBufferView); |
| 219 | } |
| 220 | iarray->l2w_buf.setDataPtr((RawBufferView*)(data_device + offsetBuffer)); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | // TODO InstanceArray: merge this with scene_array.cpp |
| 225 | namespace { |
nothing calls this directly
no test coverage detected