Evgenii Golubev 8 年前
当前提交
4c335811
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 10
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/Resources/lightlistbuild.compute
  2. 1
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs

10
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/Resources/lightlistbuild.compute


uniform int g_iNrVisibLights;
uniform int _PunctualLightCount;
uniform uint2 g_viDimensions;
uniform float4x4 g_mInvScrProjection;
uniform float4x4 g_mScrProjection;

// write lights to global buffers
int localOffs=0;
int offs = tileIDX.y*nrTilesX + tileIDX.x;
// This should thow a warning if NR_LIGHT_MODELS change
int indicesShift[NR_LIGHT_MODELS] = {0, _PunctualLightCount};
for(int m=0; m<NR_LIGHT_MODELS; m++)
{
int nrLightsFinal = ldsModelListCount[ m ];

const int nrDWords = ((nrLightsFinalClamped+1)+1)>>1;
for(int l=(int) t; l<(int) nrDWords; l += NR_THREADS)
{
uint uLow = l==0 ? nrLightsFinalClamped : prunedList[2*l-1+localOffs];
uint uHigh = prunedList[2*l+0+localOffs];
uint uLow = l==0 ? nrLightsFinalClamped : prunedList[2*l-1+localOffs] - indicesShift[m];
uint uHigh = prunedList[2*l+0+localOffs] - indicesShift[m];
g_vLightList[16*offs + l] = (uLow&0xffff) | (uHigh<<16);
}

}
}

1
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs


{
cmd.SetComputeIntParams(buildPerTileLightListShader, "g_viDimensions", new int[2] { w, h });
cmd.SetComputeIntParam(buildPerTileLightListShader, "g_iNrVisibLights", m_lightCount);
cmd.SetComputeIntParam(buildPerTileLightListShader, "_PunctualLightCount", lightList.punctualLights.Count);
Utilities.SetMatrixCS(cmd, buildPerTileLightListShader, "g_mScrProjection", projscr);
Utilities.SetMatrixCS(cmd, buildPerTileLightListShader, "g_mInvScrProjection", invProjscr);
cmd.SetComputeTextureParam(buildPerTileLightListShader, s_GenListPerTileKernel, "g_depth_tex", cameraDepthBufferRT);

正在加载...
取消
保存