You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB
Plaintext

#include "Include/PlatformDefines.compute"
#pragma kernel CSInstancedRenderingVisibilityKernelLOD0
#pragma kernel CSInstancedRenderingVisibilityKernelLOD1
#pragma kernel CSInstancedRenderingVisibilityKernelLOD2
RWStructuredBuffer<uint4> gpuiInstanceLODData; // lodNo - shadowLodNo - cfLodNo - cfLevel
AppendStructuredBuffer<uint> gpuiTransformationMatrix_LOD0;
AppendStructuredBuffer<uint> gpuiTransformationMatrix_LOD1;
AppendStructuredBuffer<uint> gpuiTransformationMatrix_LOD2;
uniform uint bufferSize;
uniform uint lodShift;
uniform uint lodAppendIndex;
[numthreads(GPUI_THREADS, 1, 1)]
void CSInstancedRenderingVisibilityKernelLOD0(uint3 id : SV_DispatchThreadID)
{
if (id.x >= bufferSize)
return;
uint lodNo = gpuiInstanceLODData[id.x][lodAppendIndex];
if (lodNo == lodShift)
gpuiTransformationMatrix_LOD0.Append(id.x);
}
[numthreads(GPUI_THREADS, 1, 1)]
void CSInstancedRenderingVisibilityKernelLOD1(uint3 id : SV_DispatchThreadID)
{
if (id.x >= bufferSize)
return;
uint lodNo = gpuiInstanceLODData[id.x][lodAppendIndex];
if (lodNo == lodShift)
gpuiTransformationMatrix_LOD0.Append(id.x);
else if (lodNo == lodShift + 1)
gpuiTransformationMatrix_LOD1.Append(id.x);
}
[numthreads(GPUI_THREADS, 1, 1)]
void CSInstancedRenderingVisibilityKernelLOD2(uint3 id : SV_DispatchThreadID)
{
if (id.x >= bufferSize)
return;
uint lodNo = gpuiInstanceLODData[id.x][lodAppendIndex];
if (lodNo == lodShift)
gpuiTransformationMatrix_LOD0.Append(id.x);
else if (lodNo == lodShift + 1)
gpuiTransformationMatrix_LOD1.Append(id.x);
else if (lodNo == lodShift + 2)
gpuiTransformationMatrix_LOD2.Append(id.x);
}