浏览代码

Use common LogBaseBuffer index generator

Shared between clustered light list gen and lookup
/main
Robert Srinivasiah 6 年前
当前提交
ed1a2f00
共有 3 个文件被更改,包括 9 次插入3 次删除
  1. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/ClusteredUtils.hlsl
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoopDef.hlsl
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/ClusteredUtils.hlsl


return max(g_fClustBase, suggested_base);
}
uint GenerateLogBaseBufferIndex(uint2 tileIndex, uint numTilesX, uint numTilesY, uint eyeIndex)
{
uint eyeOffset = eyeIndex * numTilesX * numTilesY;
return (eyeOffset + (tileIndex.y * numTilesX) + tileIndex.x);
}
#endif

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoopDef.hlsl


if (g_isLogBaseBufferEnabled)
{
// XRTODO - DONE: Stereo-ize access to g_logBaseBuffer
const uint eyeOffset = unity_StereoEyeIndex * _NumTileClusteredX * _NumTileClusteredY;
logBase = g_logBaseBuffer[eyeOffset + (tileIndex.y * _NumTileClusteredX) + tileIndex.x];
const uint logBaseIndex = GenerateLogBaseBufferIndex(tileIndex, _NumTileClusteredX, _NumTileClusteredY, unity_StereoEyeIndex);
logBase = g_logBaseBuffer[logBaseIndex];
}
return SnapToClusterIdxFlex(linearDepth, logBase, g_isLogBaseBufferEnabled != 0);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute


#ifdef ENABLE_DEPTH_TEXTURE_BACKPLANE
// XRTODO - DONE: Stereo-ize this, as this is per-eye set of tiles
// Add eyeIndex*nrTilesY*nrTilesX to this index
uint logBaseIndex = (eyeIndex * nrTilesY * nrTilesX) + (tileIDX.y*nrTilesX) + tileIDX.x;
const uint logBaseIndex = GenerateLogBaseBufferIndex(tileIDX, nrTilesX, nrTilesY, eyeIndex);
if(threadID==0) g_logBaseBuffer[logBaseIndex] = suggestedBase;
#endif
}

正在加载...
取消
保存