浏览代码

Minor improvements to light index buffer.

/main
Felipe Lira 7 年前
当前提交
7f179dc1
共有 2 个文件被更改,包括 17 次插入10 次删除
  1. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightConstantBuffer.cs
  2. 25
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightConstantBuffer.cs


public static int _AdditionalLightSpotDir;
public static int _AdditionalLightSpotAttenuation;
public static int _LightIndexBuffer;
public static int _ScaledScreenParams;
}

25
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


PerCameraBuffer._AdditionalLightDistanceAttenuation = Shader.PropertyToID("_AdditionalLightDistanceAttenuation");
PerCameraBuffer._AdditionalLightSpotDir = Shader.PropertyToID("_AdditionalLightSpotDir");
PerCameraBuffer._AdditionalLightSpotAttenuation = Shader.PropertyToID("_AdditionalLightSpotAttenuation");
PerCameraBuffer._LightIndexBuffer = Shader.PropertyToID("_LightIndexBuffer");
PerCameraBuffer._ScaledScreenParams = Shader.PropertyToID("_ScaledScreenParams");
CameraRenderTargetID.color = Shader.PropertyToID("_CameraColorRT");

if (m_UseComputeBuffer)
{
int lightIndicesCount = m_CullResults.GetLightIndicesCount();
if (m_LightIndicesBuffer == null)
{
m_LightIndicesBuffer = new ComputeBuffer(lightIndicesCount, sizeof(int));
}
else if (m_LightIndicesBuffer.count < lightIndicesCount)
if (lightIndicesCount > 0)
m_LightIndicesBuffer.Release();
m_LightIndicesBuffer = new ComputeBuffer(lightIndicesCount, sizeof(int));
}
if (m_LightIndicesBuffer == null)
{
m_LightIndicesBuffer = new ComputeBuffer(lightIndicesCount, sizeof(int));
}
else if (m_LightIndicesBuffer.count < lightIndicesCount)
{
m_LightIndicesBuffer.Release();
m_LightIndicesBuffer = new ComputeBuffer(lightIndicesCount, sizeof(int));
}
m_CullResults.FillLightIndices(m_LightIndicesBuffer);
cmd.SetGlobalBuffer("_LightIndexBuffer", m_LightIndicesBuffer);
m_CullResults.FillLightIndices(m_LightIndicesBuffer);
cmd.SetGlobalBuffer(PerCameraBuffer._LightIndexBuffer, m_LightIndicesBuffer);
}
}
}
else

正在加载...
取消
保存