Cycles: solve compilation errors with OptiX 7.7
* User simpler API names that accept both PTX and OptiX-IR * New argument for optixProgramGroupGetStackSize, leave to default * Remove OptixPipelineLinkOptions::debugLevel that does nothing Pull Request: https://projects.blender.org/blender/blender/pulls/107450
This commit is contained in:

committed by
Brecht Van Lommel

parent
3f6912ece2
commit
d68ed238b9
@@ -352,7 +352,23 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
return false;
|
||||
}
|
||||
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
OptixTask task = nullptr;
|
||||
OptixResult result = optixModuleCreateWithTasks(context,
|
||||
&module_options,
|
||||
&pipeline_options,
|
||||
ptx_data.data(),
|
||||
ptx_data.size(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
&optix_module,
|
||||
&task);
|
||||
if (result == OPTIX_SUCCESS) {
|
||||
TaskPool pool;
|
||||
execute_optix_task(pool, task, result);
|
||||
pool.wait_work();
|
||||
}
|
||||
# elif OPTIX_ABI_VERSION >= 55
|
||||
OptixTask task = nullptr;
|
||||
OptixResult result = optixModuleCreateFromPTXWithTasks(context,
|
||||
&module_options,
|
||||
@@ -555,7 +571,11 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
memset(sbt_data.host_pointer, 0, sizeof(SbtRecord) * NUM_PROGRAM_GROUPS);
|
||||
for (int i = 0; i < NUM_PROGRAM_GROUPS; ++i) {
|
||||
optix_assert(optixSbtRecordPackHeader(groups[i], &sbt_data[i]));
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i], nullptr));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
sbt_data.copy_to_device(); /* Upload SBT to device. */
|
||||
|
||||
@@ -577,7 +597,9 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
|
||||
OptixPipelineLinkOptions link_options = {};
|
||||
link_options.maxTraceDepth = 1;
|
||||
# if OPTIX_ABI_VERSION < 84
|
||||
link_options.debugLevel = module_options.debugLevel;
|
||||
# endif
|
||||
|
||||
if (use_osl) {
|
||||
/* Re-create OSL pipeline in case kernels are reloaded after it has been created before. */
|
||||
@@ -768,6 +790,16 @@ bool OptiXDevice::load_osl_kernels()
|
||||
return false;
|
||||
}
|
||||
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
const OptixResult result = optixModuleCreate(context,
|
||||
&module_options,
|
||||
&pipeline_options,
|
||||
ptx_data.data(),
|
||||
ptx_data.size(),
|
||||
nullptr,
|
||||
0,
|
||||
&osl_modules.back());
|
||||
# else
|
||||
const OptixResult result = optixModuleCreateFromPTX(context,
|
||||
&module_options,
|
||||
&pipeline_options,
|
||||
@@ -776,6 +808,7 @@ bool OptiXDevice::load_osl_kernels()
|
||||
nullptr,
|
||||
0,
|
||||
&osl_modules.back());
|
||||
# endif
|
||||
if (result != OPTIX_SUCCESS) {
|
||||
set_error(string_printf("Failed to load OptiX OSL services kernel from '%s' (%s)",
|
||||
ptx_filename.c_str(),
|
||||
@@ -800,7 +833,21 @@ bool OptiXDevice::load_osl_kernels()
|
||||
continue;
|
||||
}
|
||||
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
OptixTask task = nullptr;
|
||||
results[i] = optixModuleCreateWithTasks(context,
|
||||
&module_options,
|
||||
&pipeline_options,
|
||||
osl_kernels[i].ptx.data(),
|
||||
osl_kernels[i].ptx.size(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
&osl_modules[i],
|
||||
&task);
|
||||
if (results[i] == OPTIX_SUCCESS) {
|
||||
execute_optix_task(pool, task, results[i]);
|
||||
}
|
||||
# elif OPTIX_ABI_VERSION >= 55
|
||||
OptixTask task = nullptr;
|
||||
results[i] = optixModuleCreateFromPTXWithTasks(context,
|
||||
&module_options,
|
||||
@@ -861,12 +908,20 @@ bool OptiXDevice::load_osl_kernels()
|
||||
sbt_data.alloc(NUM_PROGRAM_GROUPS + osl_groups.size());
|
||||
for (int i = 0; i < NUM_PROGRAM_GROUPS; ++i) {
|
||||
optix_assert(optixSbtRecordPackHeader(groups[i], &sbt_data[i]));
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i], nullptr));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
for (size_t i = 0; i < osl_groups.size(); ++i) {
|
||||
if (osl_groups[i] != NULL) {
|
||||
optix_assert(optixSbtRecordPackHeader(osl_groups[i], &sbt_data[NUM_PROGRAM_GROUPS + i]));
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i], nullptr));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
/* Default to "__direct_callable__dummy_services", so that OSL evaluation for empty
|
||||
@@ -878,7 +933,9 @@ bool OptiXDevice::load_osl_kernels()
|
||||
|
||||
OptixPipelineLinkOptions link_options = {};
|
||||
link_options.maxTraceDepth = 0;
|
||||
# if OPTIX_ABI_VERSION < 84
|
||||
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_NONE;
|
||||
# endif
|
||||
|
||||
{
|
||||
vector<OptixProgramGroup> pipeline_groups;
|
||||
|
Reference in New Issue
Block a user