32 lines
1.0 KiB
HLSL
32 lines
1.0 KiB
HLSL
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
// Returns the total data count
|
|
[numthreads(64, 1, 1)]
|
|
void PCGDataNumCS(uint3 GroupId : SV_GroupID, uint GroupIndex : SV_GroupIndex)
|
|
{
|
|
// Mark the kernel as having executed. Must run before we early out via thread index, because the kernel is still 'executed' even if the number of
|
|
// threads to iterate on is zero. Even if GetNumThreads() returns 0, the kernel will still have been dispatched on a single thread to set this flag.
|
|
if (all(GroupId == 0) && GroupIndex == 0)
|
|
{
|
|
Out_SetAsExecutedInternal();
|
|
}
|
|
|
|
const uint ThreadIndex = GetUnWrappedDispatchThreadId(GroupId, GroupIndex, 64);
|
|
if (ThreadIndex >= GetNumThreads().x) return;
|
|
|
|
uint InDataIndex, InElemIndex;
|
|
if (!In_GetThreadData(ThreadIndex, InDataIndex, InElemIndex))
|
|
{
|
|
return;
|
|
}
|
|
|
|
uint OutDataIndex, OutElemIndex;
|
|
if (!Out_GetThreadData(ThreadIndex, OutDataIndex, OutElemIndex))
|
|
{
|
|
return;
|
|
}
|
|
|
|
const int AttributeId = DataNum_GetOutputAttributeId();
|
|
Out_SetInt(OutDataIndex, OutElemIndex, AttributeId, (int)In_GetNumData());
|
|
}
|