57 lines
1.7 KiB
Plaintext
57 lines
1.7 KiB
Plaintext
|
|
|||
|
#include "Include/PlatformDefines.hlsl"
|
|||
|
|
|||
|
#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);
|
|||
|
}
|