| 531 | |
| 532 | /* called by the C++ code to render */ |
| 533 | extern "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 */ |
| 559 | extern "C" void device_cleanup () |
nothing calls this directly
no test coverage detected