| 142 | } |
| 143 | |
| 144 | void NativeThreadIntersectionDevice::IntersectionThread(NativeThreadIntersectionDevice *renderDevice, const u_int threadIndex) { |
| 145 | //LR_LOG(renderDevice->deviceContext, "[NativeThread device::" << renderDevice->deviceName << "::" << threadIndex <<"] Rendering thread started"); |
| 146 | |
| 147 | try { |
| 148 | RayBufferQueue *queue = renderDevice->rayBufferQueue; |
| 149 | |
| 150 | const double startTime = WallClockTime(); |
| 151 | while (!boost::this_thread::interruption_requested()) { |
| 152 | const double t1 = WallClockTime(); |
| 153 | RayBuffer *rayBuffer = queue->PopToDo(); |
| 154 | renderDevice->threadDeviceIdleTime[threadIndex] += WallClockTime() - t1; |
| 155 | |
| 156 | // Trace rays |
| 157 | const Ray *rb = rayBuffer->GetRayBuffer(); |
| 158 | RayHit *hb = rayBuffer->GetHitBuffer(); |
| 159 | const size_t rayCount = rayBuffer->GetRayCount(); |
| 160 | for (unsigned int i = 0; i < rayCount; ++i) { |
| 161 | hb[i].SetMiss(); |
| 162 | renderDevice->accel->Intersect(&rb[i], &hb[i]); |
| 163 | } |
| 164 | renderDevice->threadTotalDataParallelRayCount[threadIndex] += rayCount; |
| 165 | queue->PushDone(rayBuffer); |
| 166 | |
| 167 | renderDevice->threadDeviceTotalTime[threadIndex] = WallClockTime() - startTime; |
| 168 | } |
| 169 | |
| 170 | //LR_LOG(renderDevice->deviceContext, "[NativeThread device::" << renderDevice->deviceName << "::" << threadIndex <<"] Rendering thread halted"); |
| 171 | } catch (boost::thread_interrupted) { |
| 172 | //LR_LOG(renderDevice->deviceContext, "[NativeThread device::" << renderDevice->deviceName << "::" << threadIndex <<"] Rendering thread halted"); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | //------------------------------------------------------------------------------ |
| 177 | // Statistics |
nothing calls this directly
no test coverage detected