/* called by the C++ code to render */ extern "C" void device_render (int* pixels, const int width, const int height, const float time, const Vec3f& vx, const Vec3f& vy, const Vec3f& vz, const Vec3f& p) { /* move instances */ float t = 0.7f*time; g_instance0->local2world.p = mul(2.0f,Vec3f(+cos(t),0.0f,+sin(t))); g_instance1->local2world.p = mul(2.0f,Vec3f(-cos(t),0.0f,-sin(t))); g_instance2->local2world.p = mul(2.0f,Vec3f(-sin(t),0.0f,+cos(t))); g_instance3->local2world.p = mul(2.0f,Vec3f(+sin(t),0.0f,-cos(t))); updateInstance(g_scene,g_instance0); updateInstance(g_scene,g_instance1); updateInstance(g_scene,g_instance2); updateInstance(g_scene,g_instance3); rtcCommit (g_scene); /* render all pixels */ const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; launch_renderTile(numTilesX*numTilesY,pixels,width,height,time,vx,vy,vz,p,numTilesX,numTilesY); rtcDebug(); }
/* called by the C++ code to render */ extern "C" void device_render (int* pixels, const int width, const int height, const float time, const Vec3fa& vx, const Vec3fa& vy, const Vec3fa& vz, const Vec3fa& p) { /* recompute levels */ updateEdgeLevelBuffer(g_scene,0,p); /* rebuild scene */ #if !defined(PARALLEL_COMMIT) rtcCommit (g_scene); #else launch[ getNumHWThreads() ] parallelCommit(g_scene); #endif /* render image */ const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; launch_renderTile(numTilesX*numTilesY,pixels,width,height,time,vx,vy,vz,p,numTilesX,numTilesY); rtcDebug(); }
/* called by the C++ code to render */ extern "C" void device_render (int* pixels, const int width, const int height, const float time, const Vec3fa& vx, const Vec3fa& vy, const Vec3fa& vz, const Vec3fa& p) { /* animate sphere */ for (int i=0; i<numSpheres; i++) animateSphere(i,time+i); /* commit changes to scene */ #if !defined(PARALLEL_COMMIT) rtcCommit (g_scene); #else launch[ getNumHWThreads() ] parallelCommit(g_scene); #endif /* render all pixels */ const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; launch_renderTile(numTilesX*numTilesY,pixels,width,height,time,vx,vy,vz,p,numTilesX,numTilesY); rtcDebug(); }
void DebugRenderer::RenderJob::finish(size_t threadIndex, size_t threadCount, TaskScheduler::Event* event) { double dt = getSeconds()-t0; std::cout.precision(3); std::cout << "render " << rcp(dt) << " fps, " << dt*1000.0f << " ms, " << atomicNumRays/dt*1E-6 << " Mrps" << std::endl; rtcDebug(); delete this; }
/* called by the C++ code to render */ extern "C" void device_render (int* pixels, const int width, const int height, const float time, const Vec3f& vx, const Vec3f& vy, const Vec3f& vz, const Vec3f& p) { const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; launch_renderTile(numTilesX*numTilesY,pixels,width,height,time,vx,vy,vz,p,numTilesX,numTilesY); rtcDebug(); }
/* called by the C++ code to render */ extern "C" void device_render (int* pixels, const int width, const int height, const float time, const Vec3fa& vx, const Vec3fa& vy, const Vec3fa& vz, const Vec3fa& p) { /* create scene */ if (g_scene == NULL) g_scene = convertScene(g_ispc_scene); /* create accumulator */ if (g_accu_width != width || g_accu_height != height) { //g_accu = new Vec3fa[width*height]; g_accu = (Vec3fa*)alignedMalloc(width*height*sizeof(Vec3fa)); g_accu_width = width; g_accu_height = height; memset(g_accu,0,width*height*sizeof(Vec3fa)); } /* reset accumulator */ bool camera_changed = g_changed; g_changed = false; camera_changed |= ne(g_accu_vx,vx); g_accu_vx = vx; // FIXME: use != operator camera_changed |= ne(g_accu_vy,vy); g_accu_vy = vy; // FIXME: use != operator camera_changed |= ne(g_accu_vz,vz); g_accu_vz = vz; // FIXME: use != operator camera_changed |= ne(g_accu_p, p); g_accu_p = p; // FIXME: use != operator g_accu_count++; if (camera_changed) { g_accu_count=0; memset(g_accu,0,width*height*sizeof(Vec3fa)); } /* render frame */ const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; enableFilterDispatch = renderPixel == renderPixelStandard; launch_renderTile(numTilesX*numTilesY,pixels,width,height,time,vx,vy,vz,p,numTilesX,numTilesY); enableFilterDispatch = false; rtcDebug(); }
/* called by the C++ code to render */ extern "C" void device_render (int* pixels, const int width, const int height, const float time, const Vec3fa& vx, const Vec3fa& vy, const Vec3fa& vz, const Vec3fa& p) { /* animate sphere */ for (int i=0; i<numSpheres; i++) animateSphere(i,time+i); /* commit changes to scene */ rtcCommit (g_scene); /* render all pixels */ const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; launch_renderTile(numTilesX*numTilesY,pixels,width,height,time,vx,vy,vz,p,numTilesX,numTilesY); rtcDebug(); }
extern "C" void ispcDebug() { rtcDebug(); }