浏览代码

Fixed format and line endings.

/main
Felipe Lira 7 年前
当前提交
2c09ec14
共有 6 个文件被更改,包括 21 次插入19 次删除
  1. 23
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightForwardRenderer.cs
  2. 5
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  3. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/DirectionalShadowsPass.cs
  4. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/ForwardLitPass.cs
  5. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/LocalShadowsPass.cs
  6. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/ScreenSpaceShadowResolvePass.cs

23
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightForwardRenderer.cs


// 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;
}

5
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


// Sort cameras array by camera depth
Array.Sort(cameras, m_CameraComparer);
foreach (Camera camera in cameras)
{
BeginCameraRendering(camera);

InitializeCameraData(camera, out cameraData);
SetupPerCameraShaderConstants(cameraData);
ScriptableCullingParameters cullingParameters;
if (!CullResults.GetCullingParameters(camera, cameraData.isStereoEnabled, out cullingParameters))
continue;

m_IsCameraRendering = false;
}
}
void InitializeCameraData(Camera camera, out CameraData cameraData)

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/DirectionalShadowsPass.cs


var settings = new DrawShadowsSettings(cullResults, shadowLightIndex);
m_DirectionalShadowmapTexture = RenderTexture.GetTemporary(shadowData.directionalShadowAtlasWidth,
shadowData.directionalShadowAtlasHeight, k_ShadowmapBufferBits, m_ShadowmapFormat);
shadowData.directionalShadowAtlasHeight, k_ShadowmapBufferBits, m_ShadowmapFormat);
m_DirectionalShadowmapTexture.filterMode = FilterMode.Bilinear;
m_DirectionalShadowmapTexture.wrapMode = TextureWrapMode.Clamp;
SetRenderTarget(cmd, m_DirectionalShadowmapTexture, RenderBufferLoadAction.DontCare,

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/ForwardLitPass.cs


if (renderingData.cameraData.postProcessEnabled)
PostProcessPass(ref context, ref renderingData.cameraData);
else if (!renderingData.cameraData.isOffscreenRender && colorAttachmentHandle != -1)
else if (!renderingData.cameraData.isOffscreenRender && colorAttachmentHandle != -1)
FinalBlitPass(ref context, ref renderingData.cameraData);
if (renderingData.cameraData.isStereoEnabled)

CommandBuffer cmd = CommandBufferPool.Get("Final Blit Pass");
cmd.SetGlobalTexture("_BlitTex", sourceRT);
if (!cameraData.isDefaultViewport)
{
SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, ClearFlag.All, Color.black);

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/LocalShadowsPass.cs


int shadowSampling = 0;
m_LocalShadowmapTexture = RenderTexture.GetTemporary(shadowData.localShadowAtlasWidth,
shadowData.localShadowAtlasHeight, k_ShadowmapBufferBits, m_LocalShadowmapFormat);
shadowData.localShadowAtlasHeight, k_ShadowmapBufferBits, m_LocalShadowmapFormat);
m_LocalShadowmapTexture.filterMode = FilterMode.Bilinear;
m_LocalShadowmapTexture.wrapMode = TextureWrapMode.Clamp;

CommandBufferPool.Release(cmd);
// TODO: We should have RenderingData as a readonly but currently we need this to pass shadow rendering to litpass
shadowData.renderedLocalShadowQuality = (shadowData.supportsSoftShadows) ? (LightShadows)shadowSampling : LightShadows.Hard; ;
shadowData.renderedLocalShadowQuality = (shadowData.supportsSoftShadows) ? (LightShadows)shadowSampling : LightShadows.Hard;
}
void SetupLocalLightsShadowReceiverConstants(ref ScriptableRenderContext context, CommandBuffer cmd, ref ShadowData shadowData)

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/ScreenSpaceShadowResolvePass.cs


cmd.Blit(screenSpaceOcclusionTexture, screenSpaceOcclusionTexture, m_ScreenSpaceShadowsMaterial);
if (renderingData.cameraData.isStereoEnabled)
{
{
Camera camera = renderingData.cameraData.camera;
context.StartMultiEye(camera);
context.ExecuteCommandBuffer(cmd);

正在加载...
取消
保存