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

Method commit

modules/cpu/ISPCDevice.cpp:207–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205#endif
206
207void ISPCDevice::commit()
208{
209 Device::commit();
210
211 // Check if SYCL context and device have been provided externally
212 void *appSyclCtxNew = getParam<void *>("syclContext", nullptr);
213 void *appSyclDeviceNew = getParam<void *>("syclDevice", nullptr);
214 if ((appSyclCtxNew && !appSyclDeviceNew)
215 || (!appSyclCtxNew && appSyclDeviceNew)) {
216 handleError(OSP_INVALID_OPERATION,
217 "OSPRay ISPCDevice invalid configuration: if providing a syclContext and syclDevice both must be provided");
218 return;
219 }
220
221 // Release all devices if user-provided parameters has changed
222 if ((appSyclCtxNew != appSyclCtx) || (appSyclDeviceNew != appSyclDevice)) {
223 // Release DRT device
224 drtDevice.reset();
225
226 // Release Embree device
227 if (embreeDevice) {
228 rtcReleaseDevice(embreeDevice);
229 embreeDevice = nullptr;
230 }
231#ifdef OSPRAY_ENABLE_VOLUMES
232 // Release VKL device
233 if (vklDevice) {
234 vklReleaseDevice(vklDevice);
235 vklDevice = nullptr;
236 }
237#endif
238 }
239
240 // Save user-provided parameters
241 appSyclCtx = appSyclCtxNew;
242 appSyclDevice = appSyclDeviceNew;
243
244 // We will create run-time device once only
245 if (!drtDevice) {
246 // Create DRT device
247 if (appSyclCtx && appSyclDevice)
248 drtDevice =
249 devicert::make_device_unique(appSyclDevice, appSyclCtx, debugMode);
250 else
251 drtDevice = devicert::make_device_unique(debugMode);
252 }
253
254 if (!embreeDevice) {
255#ifdef OSPRAY_TARGET_SYCL
256 embreeDevice = rtcNewSYCLDevice(
257 *static_cast<sycl::context *>(drtDevice->getSyclContextPtr()),
258 generateEmbreeDeviceCfg(*this).c_str());
259 rtcSetDeviceSYCLDevice(embreeDevice,
260 *static_cast<sycl::device *>(drtDevice->getSyclDevicePtr()));
261#else
262 embreeDevice = rtcNewDevice(generateEmbreeDeviceCfg(*this).c_str());
263#endif
264 rtcSetDeviceErrorFunction(embreeDevice, embreeErrorFunc, nullptr);

Callers

nothing calls this directly

Calls 9

handleErrorFunction · 0.85
make_device_uniqueFunction · 0.85
generateEmbreeDeviceCfgFunction · 0.85
postStatusMsgFunction · 0.85
resetMethod · 0.80
checkUnusedMethod · 0.80
commitFunction · 0.50
getSyclContextPtrMethod · 0.45
getSyclDevicePtrMethod · 0.45

Tested by

no test coverage detected