void RayCast(uint3 ThreadIndex : SV_DispatchThreadID)
{
RayStruct Ray = GenerateCameraRay(ThreadIndex.xy);
RaySceneResultStruct RaySceneResult = GetRaySceneResult(Ray);
uint PixelIndex = ThreadIndex.x + ThreadIndex.y * ResWidthDiv2 * 2;
if(RaySceneResult.DoesMeet)
{
RayHits[PixelIndex].Direction = Ray.Direction;
RayHits[PixelIndex].Position = RaySceneResult.Position;
RayHits[PixelIndex].Normal = RaySceneResult.Normal;
RayHits[PixelIndex].ObjectType = RaySceneResult.ObjectType;
RayHits[PixelIndex].ObjectIndex = RaySceneResult.ObjectIndex;
}
}
(where RayHits is a UAV) and I get the following warning:
warning X4714: sum of temp registers and indexable temp registers times 1024 threads exceeds the recommended total 16384. Performance may be reduced.[/quote]
Performance is significantly reduced.
Simply commenting out the line "RayHits[PixelIndex].Normal = RaySceneResult.Normal;" gets rid of the warning, but, confusingly for me, removing all other lines inside the if statement except that one does not get rid of the warning...
It might be of interest that the asm output shows that 13 r# registers are used without the specified line, and 19 are used with that line (16 being the limit specified by 16384/1024), regardless of whether all the other lines in the if statement are present.
WTF. What makes that line so special, and how can I fix this?