|
|
|
|
|
|
|
|
|
|
#include "LightingConvexHullUtils.hlsl" |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
#include "SortingComputeUtils.hlsl" |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
InterlockedMax(ldsZMax, asuint(dpt_ma) ); |
|
|
|
|
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
dpt_ma = asfloat(ldsZMax); |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
// sort lights (gives a more efficient execution in both deferred and tiled forward lighting). |
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
SORTLIST(coarseList, iNrCoarseLights, MAX_NR_COARSE_ENTRIES, t, NR_THREADS); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
int p = i>>2; |
|
|
|
int m = i&3; |
|
|
|
if(i<24) lightPlanes[6*m+p] = FetchPlane(min(iNrCoarseLights-1,ll+m), p); |
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
coarseList[l]=0xffffffff; |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
lightOffsSph = offs; |
|
|
|
} |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
if(threadID==0) ldsIsLightInvisible=0; |
|
|
|
|
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
const int idxCoarse = coarseList[l]; |
|
|
|
|
|
|
if(bFoundSepPlane) InterlockedOr(ldsIsLightInvisible, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
if(threadID==0 && ldsIsLightInvisible==0) |
|
|
|
|
|
|
} |
|
|
|
#if !defined(XBONE) && !defined(PLAYSTATION4) |
|
|
|
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL) |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
return lightOffs2; |
|
|
|