浏览代码

Add stereo support to the light loop resolution-dependent buffers

Basically, use the 'screen' size for the tile gen, and then double if stereo exists
/main
Robert Srinivasiah 7 年前
当前提交
f603164d
共有 2 个文件被更改,包括 8 次插入7 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  2. 13
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


if (m_CurrentWidth > 0 && m_CurrentHeight > 0)
m_LightLoop.ReleaseResolutionDependentBuffers();
m_LightLoop.AllocResolutionDependentBuffers(hdCamera.actualWidth, hdCamera.actualHeight);
m_LightLoop.AllocResolutionDependentBuffers((int)hdCamera.screenSize.x, (int)hdCamera.screenSize.y, m_FrameSettings.enableStereo);
}
// Warning: (resolutionChanged == false) if you open a new Editor tab of the same size!

13
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


return 8 * (1 << k_Log2NumClusters); // total footprint for all layers of the tile (measured in light index entries)
}
// TODO: Add proper stereo support
public void AllocResolutionDependentBuffers(int width, int height)
public void AllocResolutionDependentBuffers(int width, int height, bool stereoEnabled)
var nrStereoLayers = stereoEnabled ? 2 : 1;
var nrTiles = nrTilesX * nrTilesY;
var nrTiles = nrTilesX * nrTilesY * nrStereoLayers;
s_TileFeatureFlags = new ComputeBuffer(nrTilesX * nrTilesY, sizeof(uint));
s_TileFeatureFlags = new ComputeBuffer(nrTiles, sizeof(uint));
var nrClusterTiles = nrClustersX * nrClustersY;
var nrClusterTiles = nrClustersX * nrClustersY * nrStereoLayers;
s_PerVoxelOffset = new ComputeBuffer((int)LightCategory.Count * (1 << k_Log2NumClusters) * nrClusterTiles, sizeof(uint));
s_PerVoxelLightLists = new ComputeBuffer(NumLightIndicesPerClusteredTile() * nrClusterTiles, sizeof(uint));

{
var nrBigTilesX = (width + 63) / 64;
var nrBigTilesY = (height + 63) / 64;
var nrBigTiles = nrBigTilesX * nrBigTilesY;
var nrBigTiles = nrBigTilesX * nrBigTilesY * nrStereoLayers;
s_BigTileLightList = new ComputeBuffer(LightDefinitions.s_MaxNrBigTileLightsPlusOne * nrBigTiles, sizeof(uint));
}
}

正在加载...
取消
保存