Files
UnrealEngineUWP/Engine/Shaders/Private/NiagaraCopyIntBuffer.usf
uriel doyon 3cfa037304 Added particle GPU sorting for GPU niagara simulation when using sprites and meshes.
Console variables:
- Niagara.GPUSorting : controls whether GPU sorting is enabled.
- Niagara.GPUSorting.CPUToGPUThreshold : controls if CPU particles should be sorted through the GPU path.
- Niagara.GPUSorting.BufferSlack : controls the slack when increasing/decreasing the GPU sort buffers.
- Niagara.GPUSorting.MinBufferSize : minimum size for the GPU sort buffers.
- Niagara.GPUSorting.FrameCountBeforeShrinking : controls how many frame before shrinking GPU sort buffers.
#rb matt.collins
#jira none

#ROBOMERGE-OWNER: ryan.vance
#ROBOMERGE-AUTHOR: uriel.doyon
#ROBOMERGE-SOURCE: CL 5049288 in //UE4/Main/...
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 5133932 by uriel doyon in Dev-VR branch]
2019-02-22 02:58:51 -05:00

53 lines
1.4 KiB
Plaintext

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
/*==============================================================================
NiagaraCopyIntBuffer.usf: Shader to copy sorted index buffers.
==============================================================================*/
/*------------------------------------------------------------------------------
Compile time parameters:
THREAD_COUNT - The number of threads to launch per workgroup.
SORT_VIEW_DEPTH
SORT_VIEW_DISTANCE
SORT_CUSTOM_ASCENDING
SORT_CUSTOM_DESCENDING
------------------------------------------------------------------------------*/
#include "Common.ush"
// (StartingIndex, UsedIndexCount0, UsedIndexCount1, UsedIndexCount2)
uint4 CopyParams;
Buffer<int> SourceData;
RWBuffer<int> DestData0;
RWBuffer<int> DestData1;
RWBuffer<int> DestData2;
[numthreads(THREAD_COUNT,1,1)]
void MainCS(uint IndexOffset : SV_DispatchThreadID)
{
const uint StartingIndex = CopyParams.x;
const uint UsedIndexCount0 = CopyParams.y;
const uint UsedIndexCount1 = CopyParams.z;
const uint UsedIndexCount2 = CopyParams.w;
uint Index = StartingIndex + IndexOffset;
// The source buffer copy is splitted between the destination buffers.
if (Index < UsedIndexCount0)
{
DestData0[Index] = SourceData[Index];
}
else if (Index < UsedIndexCount1)
{
DestData1[Index] = SourceData[Index];
}
else if (Index < UsedIndexCount2)
{
DestData2[Index] = SourceData[Index];
}
}