33#ifndef OPTIX_OPTIX_STACK_SIZE_H
34#define OPTIX_OPTIX_STACK_SIZE_H
64 stackSizes->
cssRG = std::max( stackSizes->
cssRG, localStackSizes.
cssRG );
65 stackSizes->
cssMS = std::max( stackSizes->
cssMS, localStackSizes.
cssMS );
66 stackSizes->
cssCH = std::max( stackSizes->
cssCH, localStackSizes.
cssCH );
67 stackSizes->
cssAH = std::max( stackSizes->
cssAH, localStackSizes.
cssAH );
68 stackSizes->
cssIS = std::max( stackSizes->
cssIS, localStackSizes.
cssIS );
69 stackSizes->
cssCC = std::max( stackSizes->
cssCC, localStackSizes.
cssCC );
70 stackSizes->
dssDC = std::max( stackSizes->
dssDC, localStackSizes.
dssDC );
89 unsigned int maxTraceDepth,
90 unsigned int maxCCDepth,
91 unsigned int maxDCDepth,
92 unsigned int* directCallableStackSizeFromTraversal,
93 unsigned int* directCallableStackSizeFromState,
94 unsigned int* continuationStackSize )
99 const unsigned int cssRG = stackSizes->
cssRG;
100 const unsigned int cssMS = stackSizes->
cssMS;
101 const unsigned int cssCH = stackSizes->
cssCH;
102 const unsigned int cssAH = stackSizes->
cssAH;
103 const unsigned int cssIS = stackSizes->
cssIS;
104 const unsigned int cssCC = stackSizes->
cssCC;
105 const unsigned int dssDC = stackSizes->
dssDC;
107 if( directCallableStackSizeFromTraversal )
108 *directCallableStackSizeFromTraversal = maxDCDepth * dssDC;
109 if( directCallableStackSizeFromState )
110 *directCallableStackSizeFromState = maxDCDepth * dssDC;
113 unsigned int cssCCTree = maxCCDepth * cssCC;
117 unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree;
120 if( continuationStackSize )
121 *continuationStackSize
123 + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree
124 + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH );
154 unsigned int dssDCFromTraversal,
155 unsigned int dssDCFromState,
156 unsigned int maxTraceDepth,
157 unsigned int maxCCDepth,
158 unsigned int maxDCDepthFromTraversal,
159 unsigned int maxDCDepthFromState,
160 unsigned int* directCallableStackSizeFromTraversal,
161 unsigned int* directCallableStackSizeFromState,
162 unsigned int* continuationStackSize )
167 const unsigned int cssRG = stackSizes->
cssRG;
168 const unsigned int cssMS = stackSizes->
cssMS;
169 const unsigned int cssCH = stackSizes->
cssCH;
170 const unsigned int cssAH = stackSizes->
cssAH;
171 const unsigned int cssIS = stackSizes->
cssIS;
172 const unsigned int cssCC = stackSizes->
cssCC;
175 if( directCallableStackSizeFromTraversal )
176 *directCallableStackSizeFromTraversal = maxDCDepthFromTraversal * dssDCFromTraversal;
177 if( directCallableStackSizeFromState )
178 *directCallableStackSizeFromState = maxDCDepthFromState * dssDCFromState;
181 unsigned int cssCCTree = maxCCDepth * cssCC;
185 unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree;
188 if( continuationStackSize )
189 *continuationStackSize
191 + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree
192 + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH );
215 unsigned int cssCCTree,
216 unsigned int maxTraceDepth,
217 unsigned int maxDCDepth,
218 unsigned int* directCallableStackSizeFromTraversal,
219 unsigned int* directCallableStackSizeFromState,
220 unsigned int* continuationStackSize )
225 const unsigned int cssRG = stackSizes->
cssRG;
226 const unsigned int cssMS = stackSizes->
cssMS;
227 const unsigned int cssCH = stackSizes->
cssCH;
228 const unsigned int cssAH = stackSizes->
cssAH;
229 const unsigned int cssIS = stackSizes->
cssIS;
231 const unsigned int dssDC = stackSizes->
dssDC;
233 if( directCallableStackSizeFromTraversal )
234 *directCallableStackSizeFromTraversal = maxDCDepth * dssDC;
235 if( directCallableStackSizeFromState )
236 *directCallableStackSizeFromState = maxDCDepth * dssDC;
240 unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree;
243 if( continuationStackSize )
244 *continuationStackSize
246 + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree
247 + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH );
271 unsigned int programGroupCH1Count,
274 unsigned int programGroupCH2Count,
275 unsigned int* directCallableStackSizeFromTraversal,
276 unsigned int* directCallableStackSizeFromState,
277 unsigned int* continuationStackSize,
280 if( !programGroupCH1 && ( programGroupCH1Count > 0 ) )
282 if( !programGroupCH2 && ( programGroupCH2Count > 0 ) )
298 for(
unsigned int i = 0; i < programGroupCH1Count; ++i )
312 for(
unsigned int i = 0; i < programGroupCH2Count; ++i )
319 const unsigned int cssRG = stackSizesRG.
cssRG;
320 const unsigned int cssMS1 = stackSizesMS1.
cssMS;
321 const unsigned int cssCH1 = stackSizesCH1.
cssCH;
322 const unsigned int cssMS2 = stackSizesMS2.
cssMS;
323 const unsigned int cssCH2 = stackSizesCH2.
cssCH;
326 if( directCallableStackSizeFromTraversal )
327 *directCallableStackSizeFromTraversal = 0;
328 if( directCallableStackSizeFromState )
329 *directCallableStackSizeFromState = 0;
331 if( continuationStackSize )
332 *continuationStackSize = cssRG + std::max( cssMS1, cssCH1 + std::max( cssMS2, cssCH2 ) );
struct OptixProgramGroup_t * OptixProgramGroup
Opaque type representing a program group.
Definition: optix_types.h:65
OptixResult
Result codes returned from API functions.
Definition: optix_types.h:152
struct OptixPipeline_t * OptixPipeline
Opaque type representing a pipeline.
Definition: optix_types.h:68
@ OPTIX_SUCCESS
Definition: optix_types.h:153
@ OPTIX_ERROR_INVALID_VALUE
Definition: optix_types.h:154
OptixResult optixUtilComputeStackSizesSimplePathTracer(OptixProgramGroup programGroupRG, OptixProgramGroup programGroupMS1, const OptixProgramGroup *programGroupCH1, unsigned int programGroupCH1Count, OptixProgramGroup programGroupMS2, const OptixProgramGroup *programGroupCH2, unsigned int programGroupCH2Count, unsigned int *directCallableStackSizeFromTraversal, unsigned int *directCallableStackSizeFromState, unsigned int *continuationStackSize, OptixPipeline pipeline)
Computes the stack size values needed to configure a pipeline.
Definition: optix_stack_size.h:268
OptixResult optixUtilComputeStackSizes(const OptixStackSizes *stackSizes, unsigned int maxTraceDepth, unsigned int maxCCDepth, unsigned int maxDCDepth, unsigned int *directCallableStackSizeFromTraversal, unsigned int *directCallableStackSizeFromState, unsigned int *continuationStackSize)
Computes the stack size values needed to configure a pipeline.
Definition: optix_stack_size.h:88
OptixResult optixUtilComputeStackSizesCssCCTree(const OptixStackSizes *stackSizes, unsigned int cssCCTree, unsigned int maxTraceDepth, unsigned int maxDCDepth, unsigned int *directCallableStackSizeFromTraversal, unsigned int *directCallableStackSizeFromState, unsigned int *continuationStackSize)
Computes the stack size values needed to configure a pipeline.
Definition: optix_stack_size.h:214
OptixResult optixUtilAccumulateStackSizes(OptixProgramGroup programGroup, OptixStackSizes *stackSizes, OptixPipeline pipeline)
Retrieves direct and continuation stack sizes for each program in the program group and accumulates t...
Definition: optix_stack_size.h:54
OptixResult optixUtilComputeStackSizesDCSplit(const OptixStackSizes *stackSizes, unsigned int dssDCFromTraversal, unsigned int dssDCFromState, unsigned int maxTraceDepth, unsigned int maxCCDepth, unsigned int maxDCDepthFromTraversal, unsigned int maxDCDepthFromState, unsigned int *directCallableStackSizeFromTraversal, unsigned int *directCallableStackSizeFromState, unsigned int *continuationStackSize)
Computes the stack size values needed to configure a pipeline.
Definition: optix_stack_size.h:153
OptixResult optixProgramGroupGetStackSize(OptixProgramGroup programGroup, OptixStackSizes *stackSizes, OptixPipeline pipeline)
Returns the stack sizes for the given program group. When programs in this programGroup are relying o...
Describes the stack size requirements of a program group.
Definition: optix_types.h:2395
unsigned int cssRG
Continuation stack size of RG programs in bytes.
Definition: optix_types.h:2397
unsigned int cssAH
Continuation stack size of AH programs in bytes.
Definition: optix_types.h:2403
unsigned int cssCH
Continuation stack size of CH programs in bytes.
Definition: optix_types.h:2401
unsigned int cssCC
Continuation stack size of CC programs in bytes.
Definition: optix_types.h:2407
unsigned int cssIS
Continuation stack size of IS programs in bytes.
Definition: optix_types.h:2405
unsigned int dssDC
Direct stack size of DC programs in bytes.
Definition: optix_types.h:2409
unsigned int cssMS
Continuation stack size of MS programs in bytes.
Definition: optix_types.h:2399