RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
1.01k stars 182 forks source link

OSPRay 2.x doesn't always emit errors/warnings with mismatched data type enums on ospSetParam() #434

Closed tachyon-john closed 3 years ago

tachyon-john commented 4 years ago

This turned up when I was comparing the OSPRay 2.x ANARI back-end vs. Ingo's OWL back-end. Ingo's implementation hard-terminates on any invalid/unrecognized APIs, parameter names, or data type combinations. I found that I had mistakes in my original OSPRay 2.x code that (of course) made it into my ANARI code also. Some examples where I would have expected errors/warnings but got none from OSPRay 2.x are shown below:

ospSetParam(ospWorld, "instance", OSP_OBJECT, &instances);
ospSetParam(ospWorld, "light", OSP_OBJECT, &lights);
ospSetParam(group, "geometry", OSP_OBJECT, &geometricModels);
ospSetParam(model, "material", OSP_OBJECT, &materialcache[matindex].mat);
ospSetParam(sparray.geom, "sphere.position", OSP_OBJECT, &sparray.cents);

My OSPRay 2.x callback setup in VMD looks like this:

  OSPDevice dev = ospGetCurrentDevice();
  ospDeviceSetErrorFunc(dev, vmd_ospray2_error_callback);
  ospDeviceSetStatusFunc(dev, vmd_ospray2_status_callback);
  int loglevel = OSP_LOG_INFO;
  loglevel = OSP_LOG_DEBUG;
  ospDeviceSetParam(dev, "logLevel", OSP_INT, &loglevel);
  ospDeviceCommit(dev);

I believe I've corrected all of these issues that were in my code, but I wanted to bring awareness since having OSPRay 2.x warn about these things will likely benefit others, both those using OSPRay APIs directly, and via ANARI pass-through.

Best, John Stone