45 OptixModuleCompileOptions moduleCompileOptions = {};
46 moduleCompileOptions.maxRegisterCount =
47 OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT;
48 moduleCompileOptions.optLevel = OPTIX_COMPILE_OPTIMIZATION_DEFAULT;
49 moduleCompileOptions.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_MINIMAL;
50 moduleCompileOptions.numPayloadTypes = 0;
51 moduleCompileOptions.payloadTypes =
nullptr;
56 OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS;
66 OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE;
70 size_t logStringSize = 2048;
73 (
const char *)shader_code, shader_length,
80 const std::string &prgName = std::get<0>(
programInfos[t]);
81 const std::string raygenName = std::string(
"__raygen__") + prgName;
82 const std::string anyhitName = std::string(
"__anyhit__") + prgName;
83 const std::string closesthitName =
84 std::string(
"__closesthit__") + prgName;
85 const std::string intersectionName =
86 std::string(
"__intersection__") + prgName;
87 const std::string missName = std::string(
"__miss__") + prgName;
91 OptixProgramGroupDesc pgDescs[3] = {};
93 pgDescs[0].kind = OPTIX_PROGRAM_GROUP_KIND_RAYGEN;
95 pgDescs[0].raygen.entryFunctionName = raygenName.c_str();
97 pgDescs[1].kind = OPTIX_PROGRAM_GROUP_KIND_HITGROUP;
100 pgDescs[1].hitgroup.entryFunctionNameAH = anyhitName.c_str();
104 pgDescs[1].hitgroup.entryFunctionNameCH = closesthitName.c_str();
108 pgDescs[1].hitgroup.entryFunctionNameIS = intersectionName.c_str();
111 pgDescs[2].kind = OPTIX_PROGRAM_GROUP_KIND_MISS;
114 pgDescs[2].miss.entryFunctionName = missName.c_str();
117 OptixProgramGroupOptions pgOptions[3] = {};
119 char logString[2048];
120 size_t logStringSize = 2048;
123 logString, &logStringSize, pg));
125 OptixPipelineLinkOptions pipelineLinkOptions = {};
126 pipelineLinkOptions.maxTraceDepth = 1;
129 &pipelineLinkOptions, pg, 3, logString,
148 OptixShaderBindingTable &sbt =
sbts[t];
149 sbt.raygenRecord = rgRecDevice.
d_pointer();
150 sbt.hitgroupRecordBase = hgRecDevice.
d_pointer();
151 sbt.hitgroupRecordCount = 1;
153 sbt.missRecordBase = msRecDevice.
d_pointer();
154 sbt.missRecordCount = 1;