提交 0dec8bb6 编写于 作者: M Matt Pharr

Update from book source. No functional changes.

上级 1e51ecbb
......@@ -167,8 +167,9 @@ int main(int argc, char *argv[]) {
onError) ||
ParseArg(&iter, args.end(), "format", &format, onError) ||
ParseArg(&iter, args.end(), "log-level", &logLevel, onError) ||
ParseArg(&iter, args.end(), "log-utilization", &options.logUtilization,
onError) ||
ParseArg(&iter, args.end(), "log-file", &options.logFile, onError) ||
ParseArg(&iter, args.end(), "log-utilization", &options.logUtilization, onError) ||
ParseArg(&iter, args.end(), "mse-reference-image", &options.mseReferenceImage,
onError) ||
ParseArg(&iter, args.end(), "mse-reference-out", &options.mseReferenceOutput,
......
......@@ -153,9 +153,11 @@ BVHAggregate::BVHAggregate(std::vector<Primitive> prims, int maxPrimsInNode,
// Declare _Allocator_s used for BVH construction
pstd::pmr::monotonic_buffer_resource resource;
Allocator alloc(&resource);
std::vector<std::unique_ptr<pstd::pmr::monotonic_buffer_resource>> threadBufferResources;
std::vector<std::unique_ptr<pstd::pmr::monotonic_buffer_resource>>
threadBufferResources;
ThreadLocal<Allocator> threadAllocators([&threadBufferResources]() {
threadBufferResources.push_back(std::make_unique<pstd::pmr::monotonic_buffer_resource>());
threadBufferResources.push_back(
std::make_unique<pstd::pmr::monotonic_buffer_resource>());
auto ptr = threadBufferResources.back().get();
return Allocator(ptr);
});
......
......@@ -94,7 +94,8 @@ void ImageTileIntegrator::Render() {
});
// Declare common variables for rendering image in tiles
ThreadLocal<ScratchBuffer> scratchBuffers([]() { return ScratchBuffer(65536); } );
ThreadLocal<ScratchBuffer> scratchBuffers([]() { return ScratchBuffer(65536); });
ThreadLocal<Sampler> samplers([this]() { return samplerPrototype.Clone(); });
Bounds2i pixelBounds = camera.GetFilm().PixelBounds();
......@@ -2539,7 +2540,8 @@ void MLTIntegrator::Render() {
int nBootstrapSamples = nBootstrap * (maxDepth + 1);
std::vector<Float> bootstrapWeights(nBootstrapSamples, 0);
// Allocate scratch buffers for MLT samples
ThreadLocal<ScratchBuffer> threadScratchBuffers([]() { return ScratchBuffer(65536); });
ThreadLocal<ScratchBuffer> threadScratchBuffers(
[]() { return ScratchBuffer(65536); });
// Generate bootstrap samples in parallel
ProgressReporter progress(nBootstrap, "Generating bootstrap paths", Options->quiet);
......@@ -2795,9 +2797,8 @@ void SPPMIntegrator::Render() {
});
// Allocate samplers for SPPM rendering
ThreadLocal<Sampler> threadSamplers([this]() {
return samplerPrototype.Clone(Allocator());
});
ThreadLocal<Sampler> threadSamplers(
[this]() { return samplerPrototype.Clone(Allocator()); });
pstd::vector<DigitPermutation> *digitPermutations(
ComputeRadicalInversePermutations(digitPermutationsSeed));
......@@ -3013,7 +3014,8 @@ void SPPMIntegrator::Render() {
// Trace photons and accumulate contributions
// Create per-thread scratch buffers for photon shooting
ThreadLocal<ScratchBuffer> photonShootScratchBuffers([]() { return ScratchBuffer(65536); });
ThreadLocal<ScratchBuffer> photonShootScratchBuffers(
[]() { return ScratchBuffer(65536); });
ParallelFor(0, photonsPerIteration, [&](int64_t start, int64_t end) {
// Follow photon paths for photon index range _start_ - _end_
......@@ -3141,9 +3143,7 @@ void SPPMIntegrator::Render() {
}
});
// Reset _threadScratchBuffers_ after tracing photons
threadScratchBuffers.ForAll([](ScratchBuffer &buffer) {
buffer.Reset();
});
threadScratchBuffers.ForAll([](ScratchBuffer &buffer) { buffer.Reset(); });
progress.Update();
photonPaths += photonsPerIteration;
......
......@@ -88,8 +88,8 @@ void RenderCPU(ParsedScene &parsedScene) {
parsedScene.CreateMaterials(textures, threadAllocators, &namedMaterials, &materials);
LOG_VERBOSE("Finished materials");
Primitive accel = parsedScene.CreateAggregate(textures, shapeIndexToAreaLights,
media, namedMaterials, materials);
Primitive accel = parsedScene.CreateAggregate(textures, shapeIndexToAreaLights, media,
namedMaterials, materials);
// Integrator
const RGBColorSpace *integratorColorSpace = parsedScene.film.parameters.ColorSpace();
......
......@@ -27,18 +27,19 @@ std::string ToString(const RenderingCoordinateSystem &r) {
std::string PBRTOptions::ToString() const {
return StringPrintf(
"[ PBRTOptions seed: %s quiet: %s disablePixelJitter: %s disableWavelengthJitter: %s "
"forceDiffuse: %s useGPU: %s wavefront: %s renderingSpace: %s nThreads: %s "
"logLevel: %s logFile: %s logUtilization: %s writePartialImages: %s recordPixelStatistics: %s "
"printStatistics: %s pixelSamples: %s gpuDevice: %s quickRender: %s upgrade: %s "
"imageFile: %s mseReferenceImage: %s mseReferenceOutput: %s debugStart: %s "
"displayServer: %s cropWindow: %s pixelBounds: %s pixelMaterial: %s "
"displacementEdgeScale: %f ]",
"[ PBRTOptions seed: %s quiet: %s disablePixelJitter: %s "
"disableWavelengthJitter: %s forceDiffuse: %s useGPU: %s wavefront: %s "
"renderingSpace: %s nThreads: %s logLevel: %s logFile: %s logUtilization: %s "
"writePartialImages: %s recordPixelStatistics: %s printStatistics: %s "
"pixelSamples: %s gpuDevice: %s quickRender: %s upgrade: %s imageFile: %s "
"mseReferenceImage: %s mseReferenceOutput: %s debugStart: %s displayServer: %s "
"cropWindow: %s pixelBounds: %s pixelMaterial: %s displacementEdgeScale: %f ]",
seed, quiet, disablePixelJitter, disableWavelengthJitter, forceDiffuse, useGPU,
wavefront, renderingSpace, nThreads, logLevel, logFile, logUtilization, writePartialImages,
recordPixelStatistics, printStatistics, pixelSamples, gpuDevice, quickRender,
upgrade, imageFile, mseReferenceImage, mseReferenceOutput, debugStart,
displayServer, cropWindow, pixelBounds, pixelMaterial, displacementEdgeScale);
wavefront, renderingSpace, nThreads, logLevel, logFile, logUtilization,
writePartialImages, recordPixelStatistics, printStatistics, pixelSamples,
gpuDevice, quickRender, upgrade, imageFile, mseReferenceImage, mseReferenceOutput,
debugStart, displayServer, cropWindow, pixelBounds, pixelMaterial,
displacementEdgeScale);
}
} // namespace pbrt
......@@ -808,9 +808,8 @@ void ParsedScene::CreateMaterials(
std::map<std::string, Image *> normalMapCache;
std::mutex mutex;
ParallelFor(0, normalMapFilenameVector.size(), [&](int64_t index) {
std::string filename = normalMapFilenameVector[index];
Allocator alloc = threadAllocators.Get();
std::string filename = normalMapFilenameVector[index];
ImageAndMetadata immeta =
Image::Read(filename, Allocator(), ColorEncoding::Linear);
Image &image = immeta.image;
......@@ -829,9 +828,10 @@ void ParsedScene::CreateMaterials(
// Named materials
for (const auto &nm : namedMaterials) {
Allocator alloc = threadAllocators.Get();
const std::string &name = nm.first;
const SceneEntity &mtl = nm.second;
Allocator alloc = threadAllocators.Get();
if (namedMaterialsOut->find(name) != namedMaterialsOut->end()) {
ErrorExitDeferred(&mtl.loc, "%s: trying to redefine named material.", name);
continue;
......@@ -950,8 +950,8 @@ NamedTextures ParsedScene::CreateTextures(ThreadLocal<Allocator> &threadAllocato
std::mutex mutex;
ParallelFor(0, parallelFloatTextures.size(), [&](int64_t i) {
const auto &tex = floatTextures[parallelFloatTextures[i]];
Allocator alloc = threadAllocators.Get();
const auto &tex = floatTextures[parallelFloatTextures[i]];
pbrt::Transform renderFromTexture = tex.second.renderFromObject.startTransform;
// Pass nullptr for the textures, since they shouldn't be accessed
......@@ -964,8 +964,8 @@ NamedTextures ParsedScene::CreateTextures(ThreadLocal<Allocator> &threadAllocato
});
ParallelFor(0, parallelSpectrumTextures.size(), [&](int64_t i) {
const auto &tex = spectrumTextures[parallelSpectrumTextures[i]];
Allocator alloc = threadAllocators.Get();
const auto &tex = spectrumTextures[parallelSpectrumTextures[i]];
pbrt::Transform renderFromTexture = tex.second.renderFromObject.startTransform;
// nullptr for the textures, as above.
......@@ -990,8 +990,8 @@ NamedTextures ParsedScene::CreateTextures(ThreadLocal<Allocator> &threadAllocato
LOG_VERBOSE("Loading serial textures");
// And do the rest serially
for (size_t index : serialFloatTextures) {
const auto &tex = floatTextures[index];
Allocator alloc = threadAllocators.Get();
const auto &tex = floatTextures[index];
pbrt::Transform renderFromTexture = tex.second.renderFromObject.startTransform;
TextureParameterDictionary texDict(&tex.second.parameters, &textures);
......@@ -1000,8 +1000,8 @@ NamedTextures ParsedScene::CreateTextures(ThreadLocal<Allocator> &threadAllocato
textures.floatTextures[tex.first] = t;
}
for (size_t index : serialSpectrumTextures) {
const auto &tex = spectrumTextures[index];
Allocator alloc = threadAllocators.Get();
const auto &tex = spectrumTextures[index];
if (tex.second.renderFromObject.IsAnimated())
Warning(&tex.second.loc, "Animated world to texture transform not supported. "
......
......@@ -61,11 +61,11 @@ void InitPBRT(const PBRTOptions &opt) {
CUDA_CHECK(cudaMemcpyToSymbol(OptionsGPU, Options, sizeof(OptionsGPU)));
// Leak so things aren't freed
pstd::pmr::monotonic_buffer_resource *bufferResource = new
pstd::pmr::monotonic_buffer_resource(1024*1024, &CUDATrackedMemoryResource::singleton);
// Leak this so memory it allocates isn't freed
pstd::pmr::monotonic_buffer_resource *bufferResource =
new pstd::pmr::monotonic_buffer_resource(
1024 * 1024, &CUDATrackedMemoryResource::singleton);
Allocator alloc(bufferResource);
ColorEncoding::Init(alloc);
Spectra::Init(alloc);
RGBToSpectrumTable::Init(alloc);
......
......@@ -52,9 +52,7 @@ HaltonSampler::HaltonSampler(int samplesPerPixel, Point2i fullRes,
}
Sampler HaltonSampler::Clone(Allocator alloc) {
HaltonSampler *s = (HaltonSampler *)alloc.allocate_object<HaltonSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<HaltonSampler>(*this);
}
std::string HaltonSampler::ToString() const {
......@@ -95,9 +93,7 @@ HaltonSampler *HaltonSampler::Create(const ParameterDictionary &parameters,
}
Sampler SobolSampler::Clone(Allocator alloc) {
SobolSampler *s = (SobolSampler *)alloc.allocate_object<SobolSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<SobolSampler>(*this);
}
std::string PaddedSobolSampler::ToString() const {
......@@ -107,9 +103,7 @@ std::string PaddedSobolSampler::ToString() const {
}
Sampler PaddedSobolSampler::Clone(Allocator alloc) {
PaddedSobolSampler *s = (PaddedSobolSampler *)alloc.allocate_object<PaddedSobolSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<PaddedSobolSampler>(*this);
}
PaddedSobolSampler *PaddedSobolSampler::Create(const ParameterDictionary &parameters,
......@@ -140,9 +134,7 @@ PaddedSobolSampler *PaddedSobolSampler::Create(const ParameterDictionary &parame
// ZSobolSampler Method Definitions
Sampler ZSobolSampler::Clone(Allocator alloc) {
ZSobolSampler *s = (ZSobolSampler *)alloc.allocate_object<ZSobolSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<ZSobolSampler>(*this);
}
std::string ZSobolSampler::ToString() const {
......@@ -227,9 +219,7 @@ PMJ02BNSampler *PMJ02BNSampler::Create(const ParameterDictionary &parameters,
}
Sampler PMJ02BNSampler::Clone(Allocator alloc) {
PMJ02BNSampler *s = (PMJ02BNSampler *)alloc.allocate_object<PMJ02BNSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<PMJ02BNSampler>(*this);
}
std::string PMJ02BNSampler::ToString() const {
......@@ -245,9 +235,7 @@ std::string IndependentSampler::ToString() const {
}
Sampler IndependentSampler::Clone(Allocator alloc) {
IndependentSampler *s = (IndependentSampler *)alloc.allocate_object<IndependentSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<IndependentSampler>(*this);
}
IndependentSampler *IndependentSampler::Create(const ParameterDictionary &parameters,
......@@ -304,9 +292,7 @@ std::string StratifiedSampler::ToString() const {
}
Sampler StratifiedSampler::Clone(Allocator alloc) {
StratifiedSampler *s = (StratifiedSampler *)alloc.allocate_object<StratifiedSampler>();
alloc.construct(s, *this);
return s;
return alloc.new_object<StratifiedSampler>(*this);
}
StratifiedSampler *StratifiedSampler::Create(const ParameterDictionary &parameters,
......@@ -348,7 +334,7 @@ Point2f MLTSampler::GetPixel2D() {
}
Sampler MLTSampler::Clone(Allocator alloc) {
LOG_FATAL("MLTSampler::Clone() mplemented");
LOG_FATAL("MLTSampler::Clone() is not implemented");
return {};
}
......
......@@ -1292,8 +1292,10 @@ GPUSpectrumImageTexture *GPUSpectrumImageTexture::Create(
texDesc.maxAnisotropy = Clamp(maxAniso, 1, 16);
texDesc.maxMipmapLevelClamp = nMIPMapLevels - 1;
texDesc.minMipmapLevelClamp = 0;
texDesc.mipmapFilterMode = (filter == "trilinear" || filter == "ewa" || filter == "EWA") ?
cudaFilterModeLinear : cudaFilterModePoint;
texDesc.mipmapFilterMode =
(filter == "trilinear" || filter == "ewa" || filter == "EWA")
? cudaFilterModeLinear
: cudaFilterModePoint;
texDesc.borderColor[0] = texDesc.borderColor[1] = texDesc.borderColor[2] =
texDesc.borderColor[3] = 0.f;
texDesc.sRGB = 1;
......@@ -1415,8 +1417,10 @@ GPUFloatImageTexture *GPUFloatImageTexture::Create(
texDesc.maxAnisotropy = Clamp(maxAniso, 1, 16);
texDesc.maxMipmapLevelClamp = nMIPMapLevels - 1;
texDesc.minMipmapLevelClamp = 0;
texDesc.mipmapFilterMode = (filter == "trilinear" || filter == "ewa" || filter == "EWA") ?
cudaFilterModeLinear : cudaFilterModePoint;
texDesc.mipmapFilterMode =
(filter == "trilinear" || filter == "ewa" || filter == "EWA")
? cudaFilterModeLinear
: cudaFilterModePoint;
texDesc.borderColor[0] = texDesc.borderColor[1] = texDesc.borderColor[2] =
texDesc.borderColor[3] = 0.f;
texDesc.sRGB = 1;
......
......@@ -33,40 +33,36 @@ class BufferCache {
++nBufferCacheLookups;
// Return pointer to data if _buf_ contents is already in the cache
Buffer lookupBuffer(buf.data(), buf.size());
int shardIndex = uint32_t(lookupBuffer.hash) >> (32 - logShards);
CHECK(shardIndex >= 0 && shardIndex < nShards);
DCHECK(shardIndex >= 0 && shardIndex < nShards);
mutex[shardIndex].lock_shared();
if (auto iter = cache[shardIndex].find(lookupBuffer); iter != cache[shardIndex].end()) {
DCHECK(std::memcmp(buf.data(), iter->ptr, buf.size() * sizeof(T)) == 0);
if (auto iter = cache[shardIndex].find(lookupBuffer);
iter != cache[shardIndex].end()) {
const T *ptr = iter->ptr;
mutex[shardIndex].unlock_shared();
DCHECK(std::memcmp(buf.data(), iter->ptr, buf.size() * sizeof(T)) == 0);
++nBufferCacheHits;
redundantBufferBytes += buf.size() * sizeof(T);
return ptr;
}
mutex[shardIndex].unlock_shared();
// Add _buf_ contents to cache and return pointer to cached copy
mutex[shardIndex].unlock_shared();
T *ptr = alloc.allocate_object<T>(buf.size());
std::copy(buf.begin(), buf.end(), ptr);
bytesUsed += buf.size() * sizeof(T);
mutex[shardIndex].lock();
if (auto iter = cache[shardIndex].find(lookupBuffer); iter != cache[shardIndex].end()) {
// Someone else got it in there in the meantime...
alloc.deallocate_object(ptr, buf.size());
const T *ptr = iter->ptr;
// Handle the case of another thread adding the buffer first
if (auto iter = cache[shardIndex].find(lookupBuffer);
iter != cache[shardIndex].end()) {
const T *cachePtr = iter->ptr;
mutex[shardIndex].unlock();
alloc.deallocate_object(ptr, buf.size());
++nBufferCacheHits;
redundantBufferBytes += buf.size() * sizeof(T);
return ptr;
return cachePtr;
}
cache[shardIndex].insert(Buffer(ptr, buf.size()));
mutex[shardIndex].unlock();
return ptr;
......@@ -88,8 +84,7 @@ class BufferCache {
}
const T *ptr = nullptr;
size_t size = 0;
size_t hash;
size_t size = 0, hash;
};
// BufferCache::BufferHasher Definition
......
......@@ -838,14 +838,13 @@ class SampledGrid {
Vector3f d = pSamples - (Point3f)pi;
// Return trilinearly interpolated voxel values
auto d00 =
Lerp(d.x, Lookup(pi), Lookup(pi + Vector3i(1, 0, 0)));
auto d10 = Lerp(d.x, Lookup(pi + Vector3i(0, 1, 0)),
Lookup(pi + Vector3i(1, 1, 0)));
auto d01 = Lerp(d.x, Lookup(pi + Vector3i(0, 0, 1)),
Lookup(pi + Vector3i(1, 0, 1)));
auto d11 = Lerp(d.x, Lookup(pi + Vector3i(0, 1, 1)),
Lookup(pi + Vector3i(1, 1, 1)));
auto d00 = Lerp(d.x, Lookup(pi), Lookup(pi + Vector3i(1, 0, 0)));
auto d10 =
Lerp(d.x, Lookup(pi + Vector3i(0, 1, 0)), Lookup(pi + Vector3i(1, 1, 0)));
auto d01 =
Lerp(d.x, Lookup(pi + Vector3i(0, 0, 1)), Lookup(pi + Vector3i(1, 0, 1)));
auto d11 =
Lerp(d.x, Lookup(pi + Vector3i(0, 1, 1)), Lookup(pi + Vector3i(1, 1, 1)));
return Lerp(d.z, Lerp(d.y, d00, d10), Lerp(d.y, d01, d11));
}
......
......@@ -197,7 +197,8 @@ pstd::vector<Image> Image::GeneratePyramid(Image image, WrapMode2D wrapMode,
}
bool Image::HasAnyInfinitePixels() const {
if (format == PixelFormat::U256) return false;
if (format == PixelFormat::U256)
return false;
for (int y = 0; y < resolution.y; ++y)
for (int x = 0; x < resolution.x; ++x)
......@@ -208,7 +209,8 @@ bool Image::HasAnyInfinitePixels() const {
}
bool Image::HasAnyNaNPixels() const {
if (format == PixelFormat::U256) return false;
if (format == PixelFormat::U256)
return false;
for (int y = 0; y < resolution.y; ++y)
for (int x = 0; x < resolution.x; ++x)
......@@ -1339,7 +1341,10 @@ Image Image::SelectChannels(const ImageChannelDesc &desc, Allocator alloc) const
dst[i] = src[desc.offset[i]];
}
break;
default:
LOG_FATAL("Unhandled PixelFormat");
}
return image;
}
......
......@@ -18,9 +18,8 @@ enum class LogLevel { Verbose, Error, Fatal, Invalid };
std::string ToString(LogLevel level);
LogLevel LogLevelFromString(const std::string &s);
void InitLogging(LogLevel level, std::string logFile, bool logUtilization,
bool useGPU);
void ShutdownLogging();
void InitLogging(LogLevel level, std::string logFile, bool logUtilization, bool useGPU);
#ifdef PBRT_BUILD_GPU_RENDERER
......
......@@ -27,8 +27,7 @@ class TriangleMesh {
TriangleMesh(const Transform &renderFromObject, bool reverseOrientation,
std::vector<int> vertexIndices, std::vector<Point3f> p,
std::vector<Vector3f> S, std::vector<Normal3f> N,
std::vector<Point2f> uv, std::vector<int> faceIndices,
Allocator alloc);
std::vector<Point2f> uv, std::vector<int> faceIndices, Allocator alloc);
std::string ToString() const;
......
......@@ -23,13 +23,12 @@
namespace pbrt {
// ThreadLocal Definition
template <typename T, int maxThreads = 256>
class ThreadLocal {
public:
ThreadLocal()
: hashTable(maxThreads), create([]() { return T(); }) {}
ThreadLocal(std::function<T(void)> &&c)
: hashTable(maxThreads), create(c) {}
public:
ThreadLocal() : hashTable(maxThreads), create([]() { return T(); }) {}
ThreadLocal(std::function<T(void)> &&c) : hashTable(maxThreads), create(c) {}
T &Get() {
std::thread::id tid = std::this_thread::get_id();
......@@ -86,7 +85,7 @@ public:
mutex.unlock();
}
private:
private:
struct Entry {
std::thread::id tid;
T value;
......
......@@ -75,12 +75,12 @@ static void updateMaterialNeeds(
(*haveUniversalEvalMaterial)[m.Tag()] = true;
}
WavefrontPathIntegrator::WavefrontPathIntegrator(pstd::pmr::memory_resource *memoryResource,
ParsedScene &scene)
WavefrontPathIntegrator::WavefrontPathIntegrator(
pstd::pmr::memory_resource *memoryResource, ParsedScene &scene)
: memoryResource(memoryResource) {
ThreadLocal<Allocator> threadAllocators([memoryResource]() {
pstd::pmr::monotonic_buffer_resource *resource =
new pstd::pmr::monotonic_buffer_resource(1024*1024, memoryResource);
new pstd::pmr::monotonic_buffer_resource(1024 * 1024, memoryResource);
return Allocator(resource);
});
......@@ -149,6 +149,7 @@ WavefrontPathIntegrator::WavefrontPathIntegrator(pstd::pmr::memory_resource *mem
LOG_VERBOSE("Starting to create lights");
pstd::vector<Light> allLights;
infiniteLights = alloc.new_object<pstd::vector<Light>>(alloc);
for (const auto &light : scene.lights) {
Medium outsideMedium = findMedium(light.medium, &light.loc);
......@@ -171,11 +172,10 @@ WavefrontPathIntegrator::WavefrontPathIntegrator(pstd::pmr::memory_resource *mem
std::map<int, pstd::vector<Light> *> shapeIndexToAreaLights;
std::set<std::string> namedMaterialsThatAreInterfaces;
for (auto iter = scene.namedMaterials.begin();
iter != scene.namedMaterials.end(); ++iter) {
for (auto iter = scene.namedMaterials.begin(); iter != scene.namedMaterials.end();
++iter) {
std::string materialName = iter->second.parameters.GetOneString("type", "");
if (materialName == "interface" || materialName == "none" ||
materialName.empty())
if (materialName == "interface" || materialName == "none" || materialName.empty())
namedMaterialsThatAreInterfaces.insert(iter->first);
}
......@@ -263,14 +263,14 @@ WavefrontPathIntegrator::WavefrontPathIntegrator(pstd::pmr::memory_resource *mem
CUDATrackedMemoryResource *mr =
dynamic_cast<CUDATrackedMemoryResource *>(memoryResource);
CHECK(mr);
aggregate = new OptiXAggregate(scene, mr, textures, shapeIndexToAreaLights,
media, namedMaterials, materials);
aggregate = new OptiXAggregate(scene, mr, textures, shapeIndexToAreaLights, media,
namedMaterials, materials);
#else
LOG_FATAL("Options->useGPU was set without PBRT_BUILD_GPU_RENDERER enabled");
#endif
} else
aggregate = new CPUAggregate(scene, textures, shapeIndexToAreaLights,
media, namedMaterials, materials);
aggregate = new CPUAggregate(scene, textures, shapeIndexToAreaLights, media,
namedMaterials, materials);
// Preprocess the light sources
for (Light light : allLights)
......
......@@ -118,7 +118,6 @@ class WavefrontPathIntegrator {
}
// WavefrontPathIntegrator Member Variables
pstd::pmr::memory_resource *memoryResource;
bool initializeVisibleSurface;
bool haveSubsurface;
bool haveMedia;
......@@ -136,6 +135,8 @@ class WavefrontPathIntegrator {
};
Stats *stats;
pstd::pmr::memory_resource *memoryResource;
Filter filter;
Film film;
Sampler sampler;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册