Skip to content

Commit

Permalink
Merge pull request #391 from Mike-Leo-Smith/optix8-compat
Browse files Browse the repository at this point in the history
Compatibility with OptiX 8
  • Loading branch information
mmp committed Oct 18, 2023
2 parents b5be145 + 43c8eab commit ba6b095
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/pbrt/gpu/aggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,11 @@ OptixPipelineCompileOptions OptiXAggregate::getPipelineCompileOptions() {
pipelineCompileOptions.numAttributeValues = 4;
// OPTIX_EXCEPTION_FLAG_NONE;
pipelineCompileOptions.exceptionFlags =
(OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW | OPTIX_EXCEPTION_FLAG_TRACE_DEPTH |
OPTIX_EXCEPTION_FLAG_DEBUG);
(OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW | OPTIX_EXCEPTION_FLAG_TRACE_DEPTH);
#if (OPTIX_VERSION < 80000)
// This flag is removed since OptiX 8.0.0
pipelineCompileOptions.exceptionFlags |= OPTIX_EXCEPTION_FLAG_DEBUG;
#endif
pipelineCompileOptions.pipelineLaunchParamsVariableName = "params";

return pipelineCompileOptions;
Expand Down
8 changes: 6 additions & 2 deletions src/pbrt/gpu/denoiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ Denoiser::Denoiser(Vector2i resolution, bool haveAlbedoAndNormal)
OPTIX_CHECK(optixDeviceContextCreate(cudaContext, 0, &optixContext));

OptixDenoiserOptions options = {};
#if (OPTIX_VERSION >= 70300)
#if (OPTIX_VERSION >= 80000)
options.denoiseAlpha = OPTIX_DENOISER_ALPHA_MODE_COPY;
#elif (OPTIX_VERSION >= 70300)
if (haveAlbedoAndNormal)
options.guideAlbedo = options.guideNormal = 1;

Expand Down Expand Up @@ -101,7 +103,9 @@ void Denoiser::Denoise(RGB *rgb, Normal3f *n, RGB *albedo, RGB *result) {
CUdeviceptr(scratchBuffer), memorySizes.withoutOverlapScratchSizeInBytes));

OptixDenoiserParams params = {};
#if (OPTIX_VERSION >= 70500)
#if (OPTIX_VERSION >= 80000)
// denoiseAlpha is moved to OptixDenoiserOptions in OptiX 8.0
#elif (OPTIX_VERSION >= 70500)
params.denoiseAlpha = OPTIX_DENOISER_ALPHA_MODE_COPY;
#else
params.denoiseAlpha = 0;
Expand Down

0 comments on commit ba6b095

Please sign in to comment.