|
|
|
|
|
|
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 |
|
|
|