Hello everyone. I met a problem when trying to build multiple pipelines to control the render process.
So I wrote two __raygen __ kernels, and I tried to bind each of the kernel into a different pipeline, here is the code:
raygenPGs.resize(RENDERER_TYPE_COUNT);
char log[2048];
size_t sizeof_log = sizeof(log);
OptixProgramGroupOptions pgOptions = {};
OptixProgramGroupDesc pgDesc = {};
pgDesc.kind = OPTIX_PROGRAM_GROUP_KIND_RAYGEN;
pgDesc.raygen.module = module["rayLaunch"];
// Fast renderer;
pgDesc.raygen.entryFunctionName = "__raygen__fastRenderer";
OPTIX_CHECK(optixProgramGroupCreate(optixContext,
&pgDesc,
1,
&pgOptions,
log, &sizeof_log,
&raygenPGs[FAST]));
if (sizeof_log > 1)
PRINT(log);
// Classic renderer;
pgDesc.raygen.entryFunctionName = "__raygen__classicRenderer";
OPTIX_CHECK(optixProgramGroupCreate(optixContext,
&pgDesc,
1,
&pgOptions,
log, &sizeof_log,
&raygenPGs[CLASSIC]));
if (sizeof_log > 1)
PRINT(log);
And finally create two piplelines like this:
for (int i = 0; i < RENDERER_TYPE_COUNT; i++)
{
std::vector<OptixProgramGroup> programGroups;
programGroups.push_back(raygenPGs[i]);
for (auto pg : missPGs)
programGroups.push_back(pg);
for (auto pg : hitgroupPGs)
programGroups.push_back(pg);
for (auto pg : callablePGs)
programGroups.push_back(pg);
char log[2048];
size_t sizeof_log = sizeof(log);
PING;
PRINT(programGroups.size());
OPTIX_CHECK(optixPipelineCreate(optixContext,
&pipelineCompileOptions,
&pipelineLinkOptions,
programGroups.data(),
(int)programGroups.size(),
log, &sizeof_log,
&pipelines[i]));
if (sizeof_log > 1)
PRINT(log);
However, wired things happened that, both pipelines behaved exactly the same. More specifically, both optixLaunch(pipelines[FAST],...
and optixLaunch(pipelines[CLASSIC],...
triggered
__raygen__fastRenderer
kernel, but __raygen__classicRenderer
was never triggered.
And if I exchange the program position inside of raygenPGs, this time only __raygen__classicRenderer
is triggered.
I checked many times and can’t solve the problem. Now I switch to continuation callables to do similar things however, may impact the performance a little. I would be glad if anyone can find where the problem is, thanks.