| 81 | } |
| 82 | |
| 83 | void PathOCLNativeRenderThread::RenderThreadImpl() { |
| 84 | //SLG_LOG("[PathOCLRenderEngine::" << threadIndex << "] Rendering thread started"); |
| 85 | |
| 86 | // Boost barriers (used in PhotonGICache::Update()) are supposed to be not |
| 87 | // interruptible but they are and seem to be missing a way to reset them. So |
| 88 | // better to disable interruptions. |
| 89 | boost::this_thread::disable_interruption di; |
| 90 | |
| 91 | //-------------------------------------------------------------------------- |
| 92 | // Initialization |
| 93 | //-------------------------------------------------------------------------- |
| 94 | |
| 95 | PathOCLRenderEngine *engine = (PathOCLRenderEngine *)renderEngine; |
| 96 | const PathTracer &pathTracer = engine->pathTracer; |
| 97 | // (engine->seedBase + 1) seed is used for sharedRndGen |
| 98 | RandomGenerator *rndGen = new RandomGenerator(engine->seedBase + 1 + threadIndex); |
| 99 | |
| 100 | // All threads use the film allocated by the first thread |
| 101 | Film *film = ((PathOCLNativeRenderThread *)(engine->renderNativeThreads[0]))->threadFilm; |
| 102 | |
| 103 | // Setup the sampler(s) |
| 104 | |
| 105 | Sampler *eyeSampler = nullptr; |
| 106 | Sampler *lightSampler = nullptr; |
| 107 | |
| 108 | eyeSampler = engine->renderConfig->AllocSampler(rndGen, film, |
| 109 | nullptr, engine->eyeSamplerSharedData, Properties()); |
| 110 | eyeSampler->RequestSamples(PIXEL_NORMALIZED_ONLY, pathTracer.eyeSampleSize); |
| 111 | |
| 112 | if (pathTracer.hybridBackForwardEnable) { |
| 113 | // Light path sampler is always Metropolis |
| 114 | Properties props; |
| 115 | props << |
| 116 | Property("sampler.type")("METROPOLIS") << |
| 117 | // Disable image plane meaning for samples 0 and 1 |
| 118 | Property("sampler.imagesamples.enable")(false); |
| 119 | |
| 120 | lightSampler = Sampler::FromProperties(props, rndGen, film, nullptr, |
| 121 | engine->lightSamplerSharedData); |
| 122 | |
| 123 | lightSampler->RequestSamples(SCREEN_NORMALIZED_ONLY, pathTracer.lightSampleSize); |
| 124 | } |
| 125 | |
| 126 | VarianceClamping varianceClamping(pathTracer.sqrtVarianceClampMaxValue); |
| 127 | |
| 128 | // Initialize SampleResults |
| 129 | vector<SampleResult> eyeSampleResults(1); |
| 130 | pathTracer.InitEyeSampleResults(engine->film, eyeSampleResults); |
| 131 | |
| 132 | vector<SampleResult> lightSampleResults; |
| 133 | |
| 134 | //-------------------------------------------------------------------------- |
| 135 | // Trace paths |
| 136 | //-------------------------------------------------------------------------- |
| 137 | |
| 138 | // I can not use engine->renderConfig->GetProperty() here because the |
| 139 | // RenderConfig properties cache is not thread safe |
| 140 | const u_int filmWidth = film->GetWidth(); |
nothing calls this directly
no test coverage detected