MCPcopy Create free account
hub / github.com/RenderKit/embree / device_render

Function device_render

tutorials/next_hit/next_hit_device.cpp:533–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531
532/* called by the C++ code to render */
533extern "C" void device_render (unsigned* pixels,
534 const unsigned int width,
535 const unsigned int height,
536 const float time,
537 const ISPCCamera& camera)
538{
539 /* create scene */
540 if (g_scene == nullptr) {
541 g_scene = data.scene = convertScene(g_ispc_scene);
542 rtcCommitScene (g_scene);
543 data.traversable = rtcGetSceneTraversable(data.scene);
544 }
545
546 /* create buffer to remember previous number of hits found */
547 if (!data.num_prev_hits || data.num_prev_hits_width != width || data.num_prev_hits_height != height)
548 {
549 alignedUSMFree(data.num_prev_hits);
550 data.num_prev_hits = (int*) alignedUSMMalloc(width*height*sizeof(int),16,EmbreeUSMMode::DEVICE_READ_WRITE);
551 data.num_prev_hits_width = width;
552 data.num_prev_hits_height = height;
553 for (unsigned int i=0; i<width*height; i++)
554 data.num_prev_hits[i] = 1;
555 }
556}
557
558/* called by the C++ code for cleanup */
559extern "C" void device_cleanup ()

Callers

nothing calls this directly

Calls 4

rtcCommitSceneFunction · 0.85
alignedUSMFreeFunction · 0.85
alignedUSMMallocFunction · 0.85
convertSceneFunction · 0.70

Tested by

no test coverage detected