From 44a61fad814de0a95a4d582f0b0db20e89394360 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 17 Oct 2023 13:17:24 +0800 Subject: [PATCH 1/2] compatibility with optix 8 --- src/pbrt/gpu/aggregate.cpp | 7 +++++-- src/pbrt/gpu/denoiser.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pbrt/gpu/aggregate.cpp b/src/pbrt/gpu/aggregate.cpp index 92026d6af..b86e514ac 100644 --- a/src/pbrt/gpu/aggregate.cpp +++ b/src/pbrt/gpu/aggregate.cpp @@ -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 remove since OptiX 8.0.0 + pipelineCompileOptions.exceptionFlags |= OPTIX_EXCEPTION_FLAG_DEBUG; +#endif pipelineCompileOptions.pipelineLaunchParamsVariableName = "params"; return pipelineCompileOptions; diff --git a/src/pbrt/gpu/denoiser.cpp b/src/pbrt/gpu/denoiser.cpp index c593c207e..021d61d64 100644 --- a/src/pbrt/gpu/denoiser.cpp +++ b/src/pbrt/gpu/denoiser.cpp @@ -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; @@ -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; From 43c8eab8a237f6a10caee50aa7a34d161199c296 Mon Sep 17 00:00:00 2001 From: Zheng Shaokun Date: Tue, 17 Oct 2023 13:25:23 +0800 Subject: [PATCH 2/2] fix typo --- src/pbrt/gpu/aggregate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pbrt/gpu/aggregate.cpp b/src/pbrt/gpu/aggregate.cpp index b86e514ac..0c6ee6ce3 100644 --- a/src/pbrt/gpu/aggregate.cpp +++ b/src/pbrt/gpu/aggregate.cpp @@ -1055,7 +1055,7 @@ OptixPipelineCompileOptions OptiXAggregate::getPipelineCompileOptions() { pipelineCompileOptions.exceptionFlags = (OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW | OPTIX_EXCEPTION_FLAG_TRACE_DEPTH); #if (OPTIX_VERSION < 80000) - // This flag is remove since OptiX 8.0.0 + // This flag is removed since OptiX 8.0.0 pipelineCompileOptions.exceptionFlags |= OPTIX_EXCEPTION_FLAG_DEBUG; #endif pipelineCompileOptions.pipelineLaunchParamsVariableName = "params";