@@ -2453,23 +2453,10 @@ void legalizeRayTracingEntryPointParameterForGLSL(
2453
2453
GLSLLegalizationContext* context,
2454
2454
IRFunc* func,
2455
2455
IRParam* pp,
2456
- IRVarLayout* paramLayout)
2456
+ IRVarLayout* paramLayout,
2457
+ bool hasSingleOutOrInOutParam)
2457
2458
{
2458
- auto firstBlock = func->getFirstBlock ();
2459
-
2460
- // Count the number of inout or out parameters
2461
- int inoutOrOutParamCount = 0 ;
2462
- for (auto _param = firstBlock->getFirstParam (); _param; _param = _param->getNextParam ())
2463
- {
2464
- auto _paramType = _param->getDataType ();
2465
- if (as<IROutType>(_paramType) || as<IRInOutType>(_paramType))
2466
- {
2467
- inoutOrOutParamCount++;
2468
- }
2469
- }
2470
-
2471
- // If we have just one inout or out param, we don't need consolidation.
2472
- if (inoutOrOutParamCount <= 1 )
2459
+ if (hasSingleOutOrInOutParam)
2473
2460
{
2474
2461
handleSingleParam (context, func, pp, paramLayout);
2475
2462
return ;
@@ -3165,7 +3152,6 @@ void legalizeEntryPointParameterForGLSL(
3165
3152
}
3166
3153
}
3167
3154
3168
-
3169
3155
// We need to create a global variable that will replace the parameter.
3170
3156
// It seems superficially obvious that the variable should have
3171
3157
// the same type as the parameter.
@@ -3322,7 +3308,23 @@ void legalizeEntryPointParameterForGLSL(
3322
3308
case Stage::Intersection:
3323
3309
case Stage::Miss:
3324
3310
case Stage::RayGeneration:
3325
- legalizeRayTracingEntryPointParameterForGLSL (context, func, pp, paramLayout);
3311
+ {
3312
+ // Count the number of inout or out parameters
3313
+ int inoutOrOutParamCount = 0 ;
3314
+ auto firstBlock = func->getFirstBlock ();
3315
+ for (auto _param = firstBlock->getFirstParam (); _param; _param = _param->getNextParam ())
3316
+ {
3317
+ auto _paramType = _param->getDataType ();
3318
+ if (as<IROutType>(_paramType) || as<IRInOutType>(_paramType))
3319
+ {
3320
+ inoutOrOutParamCount++;
3321
+ }
3322
+ }
3323
+
3324
+ // If we have just one inout or out param, we don't need consolidation.
3325
+ bool hasSingleOutOrInOutParam = inoutOrOutParamCount <= 1 ;
3326
+ legalizeRayTracingEntryPointParameterForGLSL (context, func, pp, paramLayout, hasSingleOutOrInOutParam);
3327
+ }
3326
3328
return ;
3327
3329
}
3328
3330
0 commit comments