MCPcopy Create free account
hub / github.com/RenderKit/ospray / copy

Method copy

modules/cpu/common/Data.cpp:157–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void Data::copy(const Data &source, const vec3ul &destinationIndex)
158{
159 if (type != source.type
160 && !(type == OSP_OBJECT && isObjectType(source.type))) {
161 throw std::runtime_error(toString()
162 + "::copy: types must match (cannot copy '" + stringFor(source.type)
163 + "' into '" + stringFor(type) + "')");
164 }
165
166 if (shared && !source.shared) {
167 throw std::runtime_error(
168 "OSPData::copy: cannot copy opaque (non-shared) data into shared "
169 "data");
170 }
171
172 if (anyLessThan(numItems, destinationIndex + source.numItems)) {
173 throw std::out_of_range(
174 "OSPData::copy: source does not fit into destination");
175 }
176
177 if (byteStride == source.byteStride
178 && data(destinationIndex) == source.data()) {
179 // NoOP, no need to copy identical region
180 // TODO markDirty(destinationIndex, destinationIndex + source.numItems);
181 return;
182 }
183
184 index_sequence_3D srcIndices(source.numItems);
185
186 for (auto srcIdx : srcIndices) {
187 char *dst = data(srcIdx + destinationIndex);
188 const char *src = source.data(srcIdx);
189 if (isObjectType(type)) {
190 const ManagedObject **srcO = (const ManagedObject **)src;
191 if (*srcO)
192 (*srcO)->refInc();
193 const ManagedObject **dstO = (const ManagedObject **)dst;
194 if (*dstO)
195 (*dstO)->refDec();
196 *dstO = *srcO;
197 } else {
198 memcpy(dst, src, sizeOf(type));
199 }
200 }
201}
202
203#ifdef OSPRAY_TARGET_SYCL
204void Data::commit()

Callers 4

copyDataMethod · 0.80
commitMethod · 0.80
readParamsMethod · 0.80
commitMethod · 0.80

Calls 4

isObjectTypeFunction · 0.85
stringForFunction · 0.85
sizeOfFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected