|
|
|
|
|
|
|
|
|
|
// Tweak parameters. |
|
|
|
#define SSS_BILATERAL_FILTER 1 |
|
|
|
#define SSS_USE_LDS_CACHE 1 |
|
|
|
#define SSS_USE_TANGENT_PLANE 0 |
|
|
|
#define SSS_CLAMP_ARTIFACT 0 |
|
|
|
#define SSS_DEBUG_LOD 0 |
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
// 6656 bytes used. It appears that the reserved LDS space must be a multiple of 512 bytes. |
|
|
|
#if SSS_USE_LDS_CACHE != 0 |
|
|
|
#endif |
|
|
|
groupshared bool processGroup; |
|
|
|
|
|
|
|
bool StencilTest(int2 pixelCoord, float stencilRef) |
|
|
|
|
|
|
return passedStencilTest; |
|
|
|
} |
|
|
|
|
|
|
|
#if SSS_USE_LDS_CACHE != 0 |
|
|
|
#endif |
|
|
|
|
|
|
|
float4 LoadSampleFromVideoMemory(int2 pixelCoord) |
|
|
|
{ |
|
|
|
|
|
|
bool isInCache = cacheCoord.x >= 0 && cacheCoord.x < TEXTURE_CACHE_SIZE_1D && |
|
|
|
cacheCoord.y >= 0 && cacheCoord.y < TEXTURE_CACHE_SIZE_1D; |
|
|
|
|
|
|
|
#if SSS_USE_LDS_CACHE != 0 |
|
|
|
#endif |
|
|
|
{ |
|
|
|
float stencilRef = STENCILLIGHTINGUSAGE_SPLIT_LIGHTING; |
|
|
|
|
|
|
|
|
|
|
cachedValue = float4(centerIrradiance, LinearEyeDepth(centerDepth, _ZBufferParams)); |
|
|
|
} |
|
|
|
|
|
|
|
#if SSS_USE_LDS_CACHE != 0 |
|
|
|
// Populate the central region of the LDS cache. |
|
|
|
textureCache[cacheCoord.x][cacheCoord.y] = cachedValue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Wait for the LDS. |
|
|
|
GroupMemoryBarrierWithGroupSync(); |
|
|
|
#endif |
|
|
|
|
|
|
|
bool isOffScreen = pixelCoord.x >= (uint)_ScreenSize.x || pixelCoord.y >= (uint)_ScreenSize.y; |
|
|
|
|
|
|
|