| 32 | std::atomic<bool> ReflectionBaker::sBakeInProgress(false); |
| 33 | |
| 34 | void ReflectionBaker::bake(const IScene& scene, |
| 35 | IReflectionSimulator& simulator, |
| 36 | const BakedDataIdentifier& identifier, |
| 37 | bool bakeConvolution, |
| 38 | bool bakeParametric, |
| 39 | int numRays, |
| 40 | int numBounces, |
| 41 | float simDuration, |
| 42 | float bakeDuration, |
| 43 | int order, |
| 44 | float irradianceMinDistance, |
| 45 | int numThreads, |
| 46 | int bakeBatchSize, |
| 47 | SceneType sceneType, |
| 48 | shared_ptr<OpenCLDevice> openCL, |
| 49 | ProbeBatch& probeBatch, |
| 50 | ProgressCallback callback, |
| 51 | void* userData) |
| 52 | { |
| 53 | PROFILE_FUNCTION(); |
| 54 | |
| 55 | assert(bakeConvolution || bakeParametric); |
| 56 | assert(identifier.type == BakedDataType::Reflections); |
| 57 | assert(identifier.variation != BakedDataVariation::Dynamic); |
| 58 | |
| 59 | sBakeInProgress = true; |
| 60 | |
| 61 | if (sceneType != SceneType::RadeonRays && identifier.variation != BakedDataVariation::StaticListener) |
| 62 | { |
| 63 | bakeBatchSize = 1; |
| 64 | } |
| 65 | |
| 66 | BakedReflectionsData* reflectionsData = nullptr; |
| 67 | |
| 68 | if (!probeBatch.hasData(identifier)) |
| 69 | { |
| 70 | probeBatch.addData(identifier, make_unique<BakedReflectionsData>(identifier, probeBatch.numProbes(), bakeConvolution, bakeParametric)); |
| 71 | } |
| 72 | |
| 73 | reflectionsData = static_cast<BakedReflectionsData*>(&probeBatch[identifier]); |
| 74 | |
| 75 | reflectionsData->setHasConvolution(bakeConvolution); |
| 76 | reflectionsData->setHasParametric(bakeParametric); |
| 77 | |
| 78 | JobGraph jobGraph; |
| 79 | ThreadPool threadPool(numThreads); |
| 80 | |
| 81 | AirAbsorptionModel airAbsorption{}; |
| 82 | Array<CoordinateSpace3f> sources(bakeBatchSize); |
| 83 | Array<CoordinateSpace3f> listeners(bakeBatchSize); |
| 84 | Array<Directivity> directivities(bakeBatchSize); |
| 85 | Array<unique_ptr<EnergyField>> energyFields(bakeBatchSize); |
| 86 | Array<EnergyField*> energyFieldPtrs(bakeBatchSize); |
| 87 | Array<int> indices(bakeBatchSize); |
| 88 | auto numValidInBatch = 0; |
| 89 | |
| 90 | for (auto i = 0; i < probeBatch.numProbes(); ++i) |
| 91 | { |
nothing calls this directly
no test coverage detected