提交 d1ad0d16 编写于 作者: M Matt Pharr

Fix crash with --wavefront integrator running on CPU.

Issue #170.
上级 b40ea102
...@@ -234,10 +234,13 @@ WavefrontPathIntegrator::WavefrontPathIntegrator( ...@@ -234,10 +234,13 @@ WavefrontPathIntegrator::WavefrontPathIntegrator(
// Allocate storage for all of the queues/buffers... // Allocate storage for all of the queues/buffers...
#ifdef PBRT_BUILD_GPU_RENDERER #ifdef PBRT_BUILD_GPU_RENDERER
CUDATrackedMemoryResource *mr = size_t startSize = 0;
dynamic_cast<CUDATrackedMemoryResource *>(memoryResource); if (Options->useGPU) {
CHECK(mr); CUDATrackedMemoryResource *mr =
size_t startSize = mr->BytesAllocated(); dynamic_cast<CUDATrackedMemoryResource *>(memoryResource);
CHECK(mr);
startSize = mr->BytesAllocated();
}
#endif // PBRT_BUILD_GPU_RENDERER #endif // PBRT_BUILD_GPU_RENDERER
// Compute number of scanlines to render per pass // Compute number of scanlines to render per pass
...@@ -292,8 +295,13 @@ WavefrontPathIntegrator::WavefrontPathIntegrator( ...@@ -292,8 +295,13 @@ WavefrontPathIntegrator::WavefrontPathIntegrator(
stats = alloc.new_object<Stats>(maxDepth, alloc); stats = alloc.new_object<Stats>(maxDepth, alloc);
#ifdef PBRT_BUILD_GPU_RENDERER #ifdef PBRT_BUILD_GPU_RENDERER
size_t endSize = mr->BytesAllocated(); if (Options->useGPU) {
pathIntegratorBytes += endSize - startSize; CUDATrackedMemoryResource *mr =
dynamic_cast<CUDATrackedMemoryResource *>(memoryResource);
CHECK(mr);
size_t endSize = mr->BytesAllocated();
pathIntegratorBytes += endSize - startSize;
}
#endif // PBRT_BUILD_GPU_RENDERER #endif // PBRT_BUILD_GPU_RENDERER
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册