|
|
|
|
|
|
uint lightIndices[2]; |
|
|
|
|
|
|
|
// Fetch two initial indices from both clusters. |
|
|
|
if (i < lightCounts[0]) |
|
|
|
{ |
|
|
|
lightIndices[0] = FetchIndex(lightStarts[0], i); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lightIndices[0] = UINT_MAX; |
|
|
|
} |
|
|
|
|
|
|
|
if (j < lightCounts[1]) |
|
|
|
{ |
|
|
|
lightIndices[1] = FetchIndex(lightStarts[1], j); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lightIndices[1] = UINT_MAX; |
|
|
|
} |
|
|
|
lightIndices[0] = FetchIndexWithBoundsCheck(lightStarts[0], lightCounts[0], i); |
|
|
|
lightIndices[1] = FetchIndexWithBoundsCheck(lightStarts[1], lightCounts[1], j); |
|
|
|
|
|
|
|
// Process all punctual lights except for box lights (which are technically not even punctual). |
|
|
|
do |
|
|
|
|
|
|
if (lightIndex == lightIndices[0]) |
|
|
|
{ |
|
|
|
i++; |
|
|
|
|
|
|
|
if (i < lightCounts[0]) |
|
|
|
{ |
|
|
|
lightIndices[0] = FetchIndex(lightStarts[0], i); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lightIndices[0] = UINT_MAX; |
|
|
|
} |
|
|
|
lightIndices[0] = FetchIndexWithBoundsCheck(lightStarts[0], lightCounts[0], i); |
|
|
|
|
|
|
|
if (j < lightCounts[1]) |
|
|
|
{ |
|
|
|
lightIndices[1] = FetchIndex(lightStarts[1], j); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lightIndices[1] = UINT_MAX; |
|
|
|
} |
|
|
|
lightIndices[1] = FetchIndexWithBoundsCheck(lightStarts[1], lightCounts[1], j); |
|
|
|
} |
|
|
|
} while (i < lightCounts[0] || j < lightCounts[1]); |
|
|
|
|
|
|
|
|
|
|
if (lightIndex == lightIndices[0]) |
|
|
|
{ |
|
|
|
i++; |
|
|
|
|
|
|
|
if (i < lightCounts[0]) |
|
|
|
{ |
|
|
|
lightIndices[0] = FetchIndex(lightStarts[0], i); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lightIndices[0] = UINT_MAX; |
|
|
|
} |
|
|
|
lightIndices[0] = FetchIndexWithBoundsCheck(lightStarts[0], lightCounts[0], i); |
|
|
|
|
|
|
|
if (j < lightCounts[1]) |
|
|
|
{ |
|
|
|
lightIndices[1] = FetchIndex(lightStarts[1], j); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
lightIndices[1] = UINT_MAX; |
|
|
|
} |
|
|
|
lightIndices[1] = FetchIndexWithBoundsCheck(lightStarts[1], lightCounts[1], j); |
|
|
|
} |
|
|
|
#endif // USE_CLUSTERED_LIGHTLIST |
|
|
|
} |
|
|
|