|
|
|
|
|
|
// TODO: Profile performance of using ComputeBuffer on mobiles that support it
|
|
|
|
public bool useComputeBufferForPerObjectLightIndices |
|
|
|
{ |
|
|
|
get { return SystemInfo.supportsComputeShaders && |
|
|
|
!Application.isMobilePlatform && Application.platform != RuntimePlatform.WebGLPlayer; } |
|
|
|
get |
|
|
|
{ |
|
|
|
return SystemInfo.supportsComputeShaders && |
|
|
|
!Application.isMobilePlatform && Application.platform != RuntimePlatform.WebGLPlayer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public int maxVisibleLocalLights { get { return k_MaxVisibleLocalLights; } } |
|
|
|
|
|
|
RegisterSurface("_DirectionalShadowmapTexture", out RenderTargetHandles.DirectionalShadowmap); |
|
|
|
RegisterSurface("_LocalShadowmapTexture", out RenderTargetHandles.LocalShadowmap); |
|
|
|
RegisterSurface("_ScreenSpaceShadowMapTexture", out RenderTargetHandles.ScreenSpaceShadowmap); |
|
|
|
|
|
|
|
|
|
|
|
m_Materials = new Material[(int)MaterialHandles.Count] |
|
|
|
{ |
|
|
|
CoreUtils.CreateEngineMaterial("Hidden/InternalErrorShader"), |
|
|
|
|
|
|
CoreUtils.CreateEngineMaterial(pipelineAsset.ScreenSpaceShadowShader), |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
m_RenderPassSet = new ScriptableRenderPass[(int)RenderPassHandles.Count] |
|
|
|
{ |
|
|
|
|
|
|
new ScreenSpaceShadowResolvePass(this), |
|
|
|
new ForwardLitPass(this), |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
postProcessRenderContext = new PostProcessRenderContext(); |
|
|
|
|
|
|
|
opaqueFilterSettings = new FilterRenderersSettings(true) |
|
|
|
|
|
|
public void Setup(ref ScriptableRenderContext context, ref CullResults cullResults, ref RenderingData renderingData) |
|
|
|
{ |
|
|
|
Clear(); |
|
|
|
|
|
|
|
|
|
|
|
SetupPerObjectLightIndices(ref cullResults, ref renderingData.lightData); |
|
|
|
RenderTextureDescriptor baseDescriptor = CreateRTDesc(ref renderingData.cameraData); |
|
|
|
|
|
|
|
|
|
|
Debug.LogError(string.Format("Handle {0} has not any surface registered to it.", handle)); |
|
|
|
return new RenderTargetIdentifier(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return renderTargetID; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
if (handleID >= m_Materials.Length) |
|
|
|
{ |
|
|
|
Debug.LogError(string.Format("Material {0} is not registered.", |
|
|
|
Enum.GetName(typeof(MaterialHandles), handleID))); |
|
|
|
Enum.GetName(typeof(MaterialHandles), handleID))); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
int handleID = (int)handle; |
|
|
|
if (handleID >= m_RenderPassSet.Length) |
|
|
|
{ |
|
|
|
Debug.LogError(string.Format("Render Pass {0} is not registered.", |
|
|
|
Enum.GetName(typeof(RenderPassHandles), handleID))); |
|
|
|
Debug.LogError(string.Format("Render Pass {0} is not registered.", |
|
|
|
Enum.GetName(typeof(RenderPassHandles), handleID))); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|