浏览代码

Add finer grained callbacks to LW render pipeline to allow effects to be added (#1863)

*Add callbacks to LWRP that can be attached to a camera.
**IBeforeCameraRender
**IAfterDepthPrePass
**IAfterOpaquePass
**IAfterOpaquePostProcess
**IAfterSkyboxPass
**IAfterTransparentPass
**IAfterRender
*Add test for callbacks
*Clean up LWRP creation of render textures. If we are not going straight to screen ensure that we create both depth and color targets.

https://katana.bf.unity3d.com/projects/com.unity.render-pipelines/builders?automation-tools_branch=add-platform-filter&ScriptableRenderLoop_branch=tim%2Flwrefactor&unity_branch=trunk
/main
GitHub 6 年前
当前提交
3c5ef0eb
共有 37 个文件被更改,包括 2268 次插入145 次删除
  1. 3
      TestProjects/LWGraphicsTest/ProjectSettings/EditorBuildSettings.asset
  2. 6
      com.unity.render-pipelines.lightweight/CHANGELOG.md
  3. 81
      com.unity.render-pipelines.lightweight/LWRP/DefaultRendererSetup.cs
  4. 2
      com.unity.render-pipelines.lightweight/LWRP/IRendererSetup.cs
  5. 1
      com.unity.render-pipelines.lightweight/LWRP/LightweightAdditionalCameraData.cs
  6. 229
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs
  7. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/BeginXRRenderingPass.cs
  8. 4
      com.unity.render-pipelines.lightweight/LWRP/Passes/CopyDepthPass.cs
  9. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/CreateLightweightRenderTexturesPass.cs
  10. 4
      com.unity.render-pipelines.lightweight/LWRP/Passes/DepthOnlyPass.cs
  11. 21
      com.unity.render-pipelines.lightweight/LWRP/Passes/DrawSkyboxPass.cs
  12. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/EndXRRenderingPass.cs
  13. 12
      com.unity.render-pipelines.lightweight/LWRP/Passes/LightweightForwardPass.cs
  14. 8
      com.unity.render-pipelines.lightweight/LWRP/Passes/TransparentPostProcessPass.cs
  15. 11
      com.unity.render-pipelines.lightweight/LWRP/ScriptableRenderer.cs
  16. 2
      com.unity.render-pipelines.lightweight/LWRP/ScriptableRenderer.cs.meta
  17. 26
      com.unity.testing.srp.lightweight/Tests/Scenes/028_PostProcessing_Custom/Scripts/InvertOpaque.cs
  18. 7
      com.unity.render-pipelines.lightweight/LWRP/IAfterDepthPrePass.cs
  19. 11
      com.unity.render-pipelines.lightweight/LWRP/IAfterDepthPrePass.cs.meta
  20. 10
      com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePass.cs
  21. 11
      com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePass.cs.meta
  22. 8
      com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePostProcess.cs
  23. 11
      com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePostProcess.cs.meta
  24. 7
      com.unity.render-pipelines.lightweight/LWRP/IAfterRender.cs
  25. 11
      com.unity.render-pipelines.lightweight/LWRP/IAfterRender.cs.meta
  26. 7
      com.unity.render-pipelines.lightweight/LWRP/IAfterSkyboxPass.cs
  27. 11
      com.unity.render-pipelines.lightweight/LWRP/IAfterSkyboxPass.cs.meta
  28. 7
      com.unity.render-pipelines.lightweight/LWRP/IAfterTransparentPass.cs
  29. 11
      com.unity.render-pipelines.lightweight/LWRP/IAfterTransparentPass.cs.meta
  30. 8
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.meta
  31. 681
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.unity
  32. 7
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.unity.meta
  33. 169
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/CameraCallbackTests.cs
  34. 11
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/CameraCallbackTests.cs.meta
  35. 1001
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/testPost.asset
  36. 8
      com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/testPost.asset.meta

3
TestProjects/LWGraphicsTest/ProjectSettings/EditorBuildSettings.asset


- enabled: 1
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/050_Shader_Graphs.unity
guid: 6e7a83866a1e446b3becf7972371c5d0
- enabled: 0
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.unity
guid: 58d22e8497ba91141b3ae7abd7b0bb41
m_configObjects: {}

6
com.unity.render-pipelines.lightweight/CHANGELOG.md


## [3.3.0-preview]
### Added
- Add callbacks to LWRP that can be attached to a camera (IBeforeCameraRender, IAfterDepthPrePass, IAfterOpaquePass, IAfterOpaquePostProcess, IAfterSkyboxPass, IAfterTransparentPass, IAfterRender)
###Changed
- Clean up LWRP creation of render textures. If we are not going straight to screen ensure that we create both depth and color targets.
### Changed
- Renamed LightweightForwardRenderer to ScriptableRenderer.
- Moved all light constants to _LightBuffer CBUFFER. Now _PerCamera CBUFFER contains all other per camera constants.

81
com.unity.render-pipelines.lightweight/LWRP/DefaultRendererSetup.cs


private TransparentPostProcessPass m_TransparentPostProcessPass;
private FinalBlitPass m_FinalBlitPass;
private EndXRRenderingPass m_EndXrRenderingPass;
#if UNITY_EDITOR
#if UNITY_EDITOR
#endif
#endif
private RenderTargetHandle Color;
private RenderTargetHandle ColorAttachment;
private RenderTargetHandle DepthAttachment;
private RenderTargetHandle DepthTexture;
private RenderTargetHandle OpaqueColor;

m_TransparentPostProcessPass = new TransparentPostProcessPass();
m_FinalBlitPass = new FinalBlitPass();
m_EndXrRenderingPass = new EndXRRenderingPass();
#if UNITY_EDITOR
#if UNITY_EDITOR
#endif
#endif
Color.Init("_CameraColorTexture");
ColorAttachment.Init("_CameraColorTexture");
DepthAttachment.Init("_CameraDepthAttachment");
DepthTexture.Init("_CameraDepthTexture");
OpaqueColor.Init("_CameraOpaqueTexture");

m_Initialized = true;
}
public void Setup(ScriptableRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults, ref RenderingData renderingData)
{

Camera camera = renderingData.cameraData.camera;
renderer.SetupPerObjectLightIndices(ref cullResults, ref renderingData.lightData);
RenderTextureDescriptor baseDescriptor = ScriptableRenderer.CreateRTDesc(ref renderingData.cameraData);

bool requiresCameraDepth = renderingData.cameraData.requiresDepthTexture;
bool requiresDepthPrepass = renderingData.shadowData.requiresScreenSpaceShadowResolve ||
renderingData.cameraData.isSceneViewCamera ||
(requiresCameraDepth &&
!ScriptableRenderer.CanCopyDepth(ref renderingData.cameraData));
bool requiresDepthPrepass = renderingData.shadowData.requiresScreenSpaceShadowResolve
|| renderingData.cameraData.isSceneViewCamera
|| (requiresCameraDepth && !ScriptableRenderer.CanCopyDepth(ref renderingData.cameraData));
// For now VR requires a depth prepass until we figure out how to properly resolve texture2DMS in stereo
requiresDepthPrepass |= renderingData.cameraData.isStereoEnabled;

if (renderingData.shadowData.renderLocalShadows)
{
m_LocalShadowPass.Setup(LocalShadowmap, renderer.maxVisibleLocalLights);
renderer.EnqueuePass(m_LocalShadowPass);
}

{
m_DepthOnlyPass.Setup(baseDescriptor, DepthTexture, SampleCount.One);
renderer.EnqueuePass(m_DepthOnlyPass);
foreach (var pass in camera.GetComponents<IAfterDepthPrePass>())
renderer.EnqueuePass(pass.GetPassToEnqueue(m_DepthOnlyPass.descriptor, DepthTexture));
}
if (renderingData.shadowData.renderDirectionalShadows &&

renderer.EnqueuePass(m_ScreenSpaceShadowResolvePass);
}
bool requiresDepthAttachment = requiresCameraDepth && !requiresDepthPrepass;
bool requiresColorAttachment =
bool requiresRenderToTexture =
baseDescriptor,
requiresDepthAttachment);
RenderTargetHandle colorHandle = (requiresColorAttachment) ? Color : RenderTargetHandle.CameraTarget;
RenderTargetHandle depthHandle = (requiresDepthAttachment) ? DepthAttachment : RenderTargetHandle.CameraTarget;
baseDescriptor);
RenderTargetHandle colorHandle = RenderTargetHandle.CameraTarget;
RenderTargetHandle depthHandle = RenderTargetHandle.CameraTarget;
var sampleCount = (SampleCount) renderingData.cameraData.msaaSamples;
m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount);
renderer.EnqueuePass(m_CreateLightweightRenderTexturesPass);
if (requiresRenderToTexture)
{
colorHandle = ColorAttachment;
depthHandle = DepthAttachment;
var sampleCount = (SampleCount)renderingData.cameraData.msaaSamples;
m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount);
renderer.EnqueuePass(m_CreateLightweightRenderTexturesPass);
}
Camera camera = renderingData.cameraData.camera;
bool dynamicBatching = renderingData.supportsDynamicBatching;
RendererConfiguration rendererConfiguration = ScriptableRenderer.GetRendererConfiguration(renderingData.lightData.totalAdditionalLightsCount);

m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, ScriptableRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration,dynamicBatching);
m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, ScriptableRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration, dynamicBatching);
foreach (var pass in camera.GetComponents<IAfterOpaquePass>())
renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
if (renderingData.cameraData.postProcessEnabled &&
renderingData.cameraData.postProcessLayer.HasOpaqueOnlyEffects(renderer.postProcessRenderContext))

foreach (var pass in camera.GetComponents<IAfterOpaquePostProcess>())
renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
{
m_DrawSkyboxPass.Setup(colorHandle, depthHandle);
}
if (depthHandle != RenderTargetHandle.CameraTarget)
foreach (var pass in camera.GetComponents<IAfterSkyboxPass>())
renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
if (requiresCameraDepth && !requiresDepthPrepass)
{
m_CopyDepthPass.Setup(depthHandle, DepthTexture);
renderer.EnqueuePass(m_CopyDepthPass);

m_RenderTransparentForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, ClearFlag.None, camera.backgroundColor, rendererConfiguration, dynamicBatching);
renderer.EnqueuePass(m_RenderTransparentForwardPass);
foreach (var pass in camera.GetComponents<IAfterTransparentPass>())
renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
m_TransparentPostProcessPass.Setup(renderer.postProcessRenderContext, baseDescriptor, colorHandle);
m_TransparentPostProcessPass.Setup(renderer.postProcessRenderContext, baseDescriptor, colorHandle, BuiltinRenderTextureType.CameraTarget);
renderer.EnqueuePass(m_TransparentPostProcessPass);
}
else if (!renderingData.cameraData.isOffscreenRender && colorHandle != RenderTargetHandle.CameraTarget)

}
foreach (var pass in camera.GetComponents<IAfterRender>())
renderer.EnqueuePass(pass.GetPassToEnqueue());
#if UNITY_EDITOR
if (renderingData.cameraData.isSceneViewCamera)
{

2
com.unity.render-pipelines.lightweight/LWRP/IRendererSetup.cs


{
void Setup(ScriptableRenderer renderer, ref ScriptableRenderContext context, ref CullResults cullResults, ref RenderingData renderingData);
}
}
}

1
com.unity.render-pipelines.lightweight/LWRP/LightweightAdditionalCameraData.cs


{
[DisallowMultipleComponent]
[RequireComponent(typeof(Camera))]
[ImageEffectAllowedInSceneView]
public class LightweightAdditionalCameraData : MonoBehaviour
{
[Tooltip("If enabled shadows will render for this camera.")]

229
com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs


public LightweightPipelineAsset pipelineAsset { get; private set; }
private IRendererSetup m_DefaultRendererSetup;
private IRendererSetup defaultRendererSetup
private static IRendererSetup m_DefaultRendererSetup;
private static IRendererSetup defaultRendererSetup
{
get
{

ScriptableRenderer m_Renderer;
CullResults m_CullResults;
List<int> m_LocalLightIndices = new List<int>();
private PipelineSettings m_PipelineSettings;
public struct PipelineSettings
{
public int msaaSampleCount { get; private set; }
public bool supportsHDR { get; private set; }
public XRGraphicsConfig savedXRGraphicsConfig { get; private set; }
public float renderScale { get; private set; }
public bool supportsCameraDepthTexture { get; private set; }
public Downsampling opaqueDownsampling { get; private set; }
public bool supportsCameraOpaqueTexture { get; private set; }
public bool supportsDynamicBatching { get; private set; }
public int maxPixelLights { get; private set; }
public bool supportsDirectionalShadows { get; private set; }
public bool supportsSoftParticles { get; private set; }
public bool supportsLocalShadows { get; private set; }
public float shadowDistance { get; private set; }
public int cascadeCount { get; private set; }
public int directionalShadowAtlasResolution { get; private set; }
public float cascade2Split { get; private set; }
public Vector3 cascade4Split { get; private set; }
public bool supportsVertexLight { get; private set; }
public int localShadowAtlasResolution { get; private set; }
public bool supportsSoftShadows { get; private set; }
public static PipelineSettings Create(LightweightPipelineAsset asset)
{
var cache = new PipelineSettings();
cache.msaaSampleCount = asset.msaaSampleCount;
cache.supportsHDR = asset.supportsHDR;
cache.savedXRGraphicsConfig = asset.savedXRGraphicsConfig;
cache.renderScale = asset.renderScale;
cache.supportsCameraDepthTexture = asset.supportsCameraDepthTexture;
cache.opaqueDownsampling = asset.opaqueDownsampling;
cache.supportsCameraOpaqueTexture = asset.supportsCameraOpaqueTexture;
cache.supportsDynamicBatching = asset.supportsDynamicBatching;
cache.maxPixelLights = asset.maxPixelLights;
cache.supportsDirectionalShadows = asset.supportsDirectionalShadows;
cache.supportsSoftParticles = asset.supportsSoftParticles;
cache.supportsLocalShadows = asset.supportsLocalShadows;
cache.shadowDistance = asset.shadowDistance;
cache.cascadeCount = asset.cascadeCount;
cache.directionalShadowAtlasResolution = asset.directionalShadowAtlasResolution;
cache.cascade2Split = asset.cascade2Split;
cache.cascade4Split = asset.cascade4Split;
cache.supportsVertexLight = asset.supportsVertexLight;
cache.localShadowAtlasResolution = asset.localShadowAtlasResolution;
cache.supportsSoftShadows = asset.supportsSoftShadows;
return cache;
}
}
pipelineAsset = asset;
m_PipelineSettings = PipelineSettings.Create(asset);
SetSupportedRenderingFeatures();
SetPipelineCapabilities(asset);

m_Renderer = new ScriptableRenderer(asset);
// Let engine know we have MSAA on for cases where we support MSAA backbuffer
if (QualitySettings.antiAliasing != pipelineAsset.msaaSampleCount)
QualitySettings.antiAliasing = pipelineAsset.msaaSampleCount;
if (QualitySettings.antiAliasing != m_PipelineSettings.msaaSampleCount)
QualitySettings.antiAliasing = m_PipelineSettings.msaaSampleCount;
Shader.globalRenderPipeline = "LightweightPipeline";
}

m_Renderer.Dispose();
}
public interface IBeforeCameraRender
{
void ExecuteBeforeCameraRender(ScriptableRenderContext context, Camera camera, PipelineSettings pipelineSettings, ScriptableRenderer renderer);
}
pipelineAsset.savedXRGraphicsConfig.renderScale = pipelineAsset.renderScale;
pipelineAsset.savedXRGraphicsConfig.viewportScale = 1.0f; // Placeholder until viewportScale is all hooked up
m_PipelineSettings.savedXRGraphicsConfig.renderScale = m_PipelineSettings.renderScale;
m_PipelineSettings.savedXRGraphicsConfig.viewportScale = 1.0f; // Placeholder until viewportScale is all hooked up
pipelineAsset.savedXRGraphicsConfig.SetConfig();
m_PipelineSettings.savedXRGraphicsConfig.SetConfig();
base.Render(context, cameras);
BeginFrameRendering(cameras);

foreach (Camera camera in cameras)
{
BeginCameraRendering(camera);
string renderCameraTag = camera.name;
CommandBuffer cmd = CommandBufferPool.Get(renderCameraTag);
using (new ProfilingSample(cmd, renderCameraTag))
foreach (var beforeCamera in camera.GetComponents<IBeforeCameraRender>())
beforeCamera.ExecuteBeforeCameraRender(context, camera, m_PipelineSettings, m_Renderer);
RenderSingleCamera(context, m_PipelineSettings, camera, ref m_CullResults, camera.GetComponent<IRendererSetup>(), m_Renderer);
}
}
public static void RenderSingleCamera(ScriptableRenderContext context, PipelineSettings settings, Camera camera, ref CullResults cullResults, IRendererSetup setup, ScriptableRenderer renderer)
{
string renderCameraTag = camera.name;
CommandBuffer cmd = CommandBufferPool.Get(renderCameraTag);
using (new ProfilingSample(cmd, renderCameraTag))
{
CameraData cameraData;
InitializeCameraData(settings, camera, out cameraData);
SetupPerCameraShaderConstants(cameraData);
ScriptableCullingParameters cullingParameters;
if (!CullResults.GetCullingParameters(camera, cameraData.isStereoEnabled, out cullingParameters))
CameraData cameraData;
InitializeCameraData(camera, out cameraData);
SetupPerCameraShaderConstants(cameraData);
CommandBufferPool.Release(cmd);
return;
}
ScriptableCullingParameters cullingParameters;
if (!CullResults.GetCullingParameters(camera, cameraData.isStereoEnabled, out cullingParameters))
{
CommandBufferPool.Release(cmd);
continue;
}
cullingParameters.shadowDistance = Mathf.Min(cameraData.maxShadowDistance, camera.farClipPlane);
cullingParameters.shadowDistance = Mathf.Min(cameraData.maxShadowDistance, camera.farClipPlane);
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
#if UNITY_EDITOR
#if UNITY_EDITOR
// Emit scene view UI
if (cameraData.isSceneViewCamera)
ScriptableRenderContext.EmitWorldGeometryForSceneView(camera);
// Emit scene view UI
if (cameraData.isSceneViewCamera)
ScriptableRenderContext.EmitWorldGeometryForSceneView(camera);
CullResults.Cull(ref cullingParameters, context, ref m_CullResults);
List<VisibleLight> visibleLights = m_CullResults.visibleLights;
CullResults.Cull(ref cullingParameters, context, ref cullResults);
List<VisibleLight> visibleLights = cullResults.visibleLights;
RenderingData renderingData;
InitializeRenderingData(settings, ref cameraData, visibleLights,
renderer.maxSupportedLocalLightsPerPass, renderer.maxSupportedVertexLights,
out renderingData);
RenderingData renderingData;
InitializeRenderingData(ref cameraData, visibleLights,
m_Renderer.maxSupportedLocalLightsPerPass, m_Renderer.maxSupportedVertexLights,
out renderingData);
var setupToUse = setup;
if (setupToUse == null)
setupToUse = defaultRendererSetup;
var setup = cameraData.camera.GetComponent<IRendererSetup>();
if (setup == null)
setup = defaultRendererSetup;
setupToUse.Setup(renderer, ref context, ref cullResults, ref renderingData);
setup.Setup(m_Renderer, ref context, ref m_CullResults, ref renderingData);
renderer.Execute(ref context, ref cullResults, ref renderingData);
m_Renderer.Execute(ref context, ref m_CullResults, ref renderingData);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
context.Submit();

void SetSupportedRenderingFeatures()
static void SetSupportedRenderingFeatures()
{
#if UNITY_EDITOR
SupportedRenderingFeatures.active = new SupportedRenderingFeatures()

#endif
}
void InitializeCameraData(Camera camera, out CameraData cameraData)
static void InitializeCameraData(PipelineSettings settings, Camera camera, out CameraData cameraData)
bool msaaEnabled = camera.allowMSAA && pipelineAsset.msaaSampleCount > 1;
bool msaaEnabled = camera.allowMSAA && settings.msaaSampleCount > 1;
cameraData.msaaSamples = (camera.targetTexture != null) ? camera.targetTexture.antiAliasing : pipelineAsset.msaaSampleCount;
cameraData.msaaSamples = (camera.targetTexture != null) ? camera.targetTexture.antiAliasing : settings.msaaSampleCount;
else
cameraData.msaaSamples = 1;

if (cameraData.isStereoEnabled && XRGraphicsConfig.eyeTextureDesc.dimension == TextureDimension.Tex2DArray)
cameraData.msaaSamples = 1;
cameraData.isHdrEnabled = camera.allowHDR && pipelineAsset.supportsHDR;
cameraData.isHdrEnabled = camera.allowHDR && settings.supportsHDR;
cameraData.postProcessLayer = camera.GetComponent<PostProcessLayer>();
cameraData.postProcessEnabled = cameraData.postProcessLayer != null && cameraData.postProcessLayer.isActiveAndEnabled;

// If XR is enabled, use XR renderScale.
// Discard variations lesser than kRenderScaleThreshold.
// Scale is only enabled for gameview.
float usedRenderScale = XRGraphicsConfig.enabled ? pipelineAsset.savedXRGraphicsConfig.renderScale : pipelineAsset.renderScale;
float usedRenderScale = XRGraphicsConfig.enabled ? settings.savedXRGraphicsConfig.renderScale : settings.renderScale;
cameraData.requiresDepthTexture = pipelineAsset.supportsCameraDepthTexture || cameraData.isSceneViewCamera;
cameraData.requiresSoftParticles = pipelineAsset.supportsSoftParticles;
cameraData.requiresOpaqueTexture = pipelineAsset.supportsCameraOpaqueTexture;
cameraData.opaqueTextureDownsampling = pipelineAsset.opaqueDownsampling;
cameraData.requiresDepthTexture = settings.supportsCameraDepthTexture || cameraData.isSceneViewCamera;
cameraData.requiresSoftParticles = settings.supportsSoftParticles;
cameraData.requiresOpaqueTexture = settings.supportsCameraOpaqueTexture;
cameraData.opaqueTextureDownsampling = settings.opaqueDownsampling;
bool anyShadowsEnabled = pipelineAsset.supportsDirectionalShadows || pipelineAsset.supportsLocalShadows;
cameraData.maxShadowDistance = (anyShadowsEnabled) ? pipelineAsset.shadowDistance : 0.0f;
bool anyShadowsEnabled = settings.supportsDirectionalShadows || settings.supportsLocalShadows;
cameraData.maxShadowDistance = (anyShadowsEnabled) ? settings.shadowDistance : 0.0f;
LightweightAdditionalCameraData additionalCameraData = camera.gameObject.GetComponent<LightweightAdditionalCameraData>();
if (additionalCameraData != null)

cameraData.requiresDepthTexture |= cameraData.postProcessEnabled;
}
void InitializeRenderingData(ref CameraData cameraData, List<VisibleLight> visibleLights, int maxSupportedLocalLightsPerPass, int maxSupportedVertexLights, out RenderingData renderingData)
static void InitializeRenderingData(PipelineSettings settings, ref CameraData cameraData,
List<VisibleLight> visibleLights, int maxSupportedLocalLightsPerPass, int maxSupportedVertexLights,
out RenderingData renderingData)
m_LocalLightIndices.Clear();
List<int> localLightIndices = new List<int>();
bool hasDirectionalShadowCastingLight = false;
bool hasLocalShadowCastingLight = false;

else
{
hasLocalShadowCastingLight |= castShadows;
m_LocalLightIndices.Add(i);
localLightIndices.Add(i);
InitializeLightData(visibleLights, maxSupportedLocalLightsPerPass, maxSupportedVertexLights, out renderingData.lightData);
InitializeShadowData(hasDirectionalShadowCastingLight, hasLocalShadowCastingLight, out renderingData.shadowData);
renderingData.supportsDynamicBatching = pipelineAsset.supportsDynamicBatching;
InitializeLightData(settings, visibleLights, maxSupportedLocalLightsPerPass, maxSupportedVertexLights, localLightIndices, out renderingData.lightData);
InitializeShadowData(settings, hasDirectionalShadowCastingLight, hasLocalShadowCastingLight, out renderingData.shadowData);
renderingData.supportsDynamicBatching = settings.supportsDynamicBatching;
void InitializeShadowData(bool hasDirectionalShadowCastingLight, bool hasLocalShadowCastingLight, out ShadowData shadowData)
static void InitializeShadowData(PipelineSettings settings, bool hasDirectionalShadowCastingLight, bool hasLocalShadowCastingLight, out ShadowData shadowData)
shadowData.renderDirectionalShadows = pipelineAsset.supportsDirectionalShadows && hasDirectionalShadowCastingLight;
shadowData.renderDirectionalShadows = settings.supportsDirectionalShadows && hasDirectionalShadowCastingLight;
shadowData.requiresScreenSpaceShadowResolve = shadowData.renderDirectionalShadows && supportsScreenSpaceShadows && pipelineAsset.cascadeCount > 1;
shadowData.directionalLightCascadeCount = (shadowData.requiresScreenSpaceShadowResolve) ? pipelineAsset.cascadeCount : 1;
shadowData.directionalShadowAtlasWidth = pipelineAsset.directionalShadowAtlasResolution;
shadowData.directionalShadowAtlasHeight = pipelineAsset.directionalShadowAtlasResolution;
shadowData.requiresScreenSpaceShadowResolve = shadowData.renderDirectionalShadows && supportsScreenSpaceShadows && settings.cascadeCount > 1;
shadowData.directionalLightCascadeCount = (shadowData.requiresScreenSpaceShadowResolve) ? settings.cascadeCount : 1;
shadowData.directionalShadowAtlasWidth = settings.directionalShadowAtlasResolution;
shadowData.directionalShadowAtlasHeight = settings.directionalShadowAtlasResolution;
switch (shadowData.directionalLightCascadeCount)
{

case 2:
shadowData.directionalLightCascades = new Vector3(pipelineAsset.cascade2Split, 1.0f, 0.0f);
shadowData.directionalLightCascades = new Vector3(settings.cascade2Split, 1.0f, 0.0f);
shadowData.directionalLightCascades = pipelineAsset.cascade4Split;
shadowData.directionalLightCascades = settings.cascade4Split;
shadowData.renderLocalShadows = pipelineAsset.supportsLocalShadows && hasLocalShadowCastingLight;
shadowData.localShadowAtlasWidth = shadowData.localShadowAtlasHeight = pipelineAsset.localShadowAtlasResolution;
shadowData.supportsSoftShadows = pipelineAsset.supportsSoftShadows;
shadowData.renderLocalShadows = settings.supportsLocalShadows && hasLocalShadowCastingLight;
shadowData.localShadowAtlasWidth = shadowData.localShadowAtlasHeight = settings.localShadowAtlasResolution;
shadowData.supportsSoftShadows = settings.supportsSoftShadows;
shadowData.bufferBitCount = 16;
shadowData.renderedDirectionalShadowQuality = LightShadows.None;

void InitializeLightData(List<VisibleLight> visibleLights, int maxSupportedLocalLightsPerPass, int maxSupportedVertexLights, out LightData lightData)
static void InitializeLightData(PipelineSettings settings, List<VisibleLight> visibleLights,
int maxSupportedLocalLightsPerPass, int maxSupportedVertexLights, List<int> localLightIndices, out LightData lightData)
int visibleLightsCount = Math.Min(visibleLights.Count, pipelineAsset.maxPixelLights);
lightData.mainLightIndex = GetMainLight(visibleLights);
int visibleLightsCount = Math.Min(visibleLights.Count, settings.maxPixelLights);
lightData.mainLightIndex = GetMainLight(settings, visibleLights);
int vertexLightCount = (pipelineAsset.supportsVertexLight) ? Math.Min(visibleLights.Count, maxSupportedLocalLightsPerPass) - additionalPixelLightsCount : 0;
int vertexLightCount = (settings.supportsVertexLight) ? Math.Min(visibleLights.Count, maxSupportedLocalLightsPerPass) - additionalPixelLightsCount : 0;
lightData.visibleLocalLightIndices = m_LocalLightIndices;
lightData.visibleLocalLightIndices = localLightIndices;
int GetMainLight(List<VisibleLight> visibleLights)
static int GetMainLight(PipelineSettings settings, List<VisibleLight> visibleLights)
if (totalVisibleLights == 0 || pipelineAsset.maxPixelLights == 0)
if (totalVisibleLights == 0 || settings.maxPixelLights == 0)
return -1;
for (int i = 0; i < totalVisibleLights; ++i)

return -1;
}
void SetupPerFrameShaderConstants()
static void SetupPerFrameShaderConstants()
{
// When glossy reflections are OFF in the shader we set a constant color to use as indirect specular
SphericalHarmonicsL2 ambientSH = RenderSettings.ambientProbe;

Shader.SetGlobalVector(PerFrameBuffer._SubtractiveShadowColor, CoreUtils.ConvertSRGBToActiveColorSpace(RenderSettings.subtractiveShadowColor));
}
void SetupPerCameraShaderConstants(CameraData cameraData)
static void SetupPerCameraShaderConstants(CameraData cameraData)
{
Camera camera = cameraData.camera;
float cameraWidth = (float)cameraData.camera.pixelWidth * cameraData.renderScale;

2
com.unity.render-pipelines.lightweight/LWRP/Passes/BeginXRRenderingPass.cs


context.StartMultiEye(camera);
}
}
}
}

4
com.unity.render-pipelines.lightweight/LWRP/Passes/CopyDepthPass.cs


descriptor.msaaSamples = 1;
descriptor.bindMS = false;
cmd.GetTemporaryRT(destination.id, descriptor, FilterMode.Point);
cmd.SetGlobalTexture("_CameraDepthAttachment", source.Identifier());
if (renderingData.cameraData.msaaSamples > 1)
{
cmd.DisableShaderKeyword(LightweightKeywordStrings.DepthNoMsaa);

2
com.unity.render-pipelines.lightweight/LWRP/Passes/CreateLightweightRenderTexturesPass.cs


if (colorAttachmentHandle != RenderTargetHandle.CameraTarget)
{
var colorDescriptor = descriptor;
colorDescriptor.depthBufferBits = k_DepthStencilBufferBits; // TODO: does the color RT always need depth?
colorDescriptor.depthBufferBits = 0;
colorDescriptor.sRGB = true;
colorDescriptor.msaaSamples = (int) samples;
cmd.GetTemporaryRT(colorAttachmentHandle.id, colorDescriptor, FilterMode.Bilinear);

4
com.unity.render-pipelines.lightweight/LWRP/Passes/DepthOnlyPass.cs


int kDepthBufferBits = 32;
private RenderTargetHandle depthAttachmentHandle { get; set; }
private RenderTextureDescriptor descriptor { get; set; }
public FilterRenderersSettings opaqueFilterSettings { get; private set; }
internal RenderTextureDescriptor descriptor { get; set; }
private FilterRenderersSettings opaqueFilterSettings { get; set; }
public void Setup(
RenderTextureDescriptor baseDescriptor,

21
com.unity.render-pipelines.lightweight/LWRP/Passes/DrawSkyboxPass.cs


using UnityEngine.Rendering;
private RenderTargetHandle colorAttachmentHandle { get; set; }
private RenderTargetHandle depthAttachmentHandle { get; set; }
public void Setup(RenderTargetHandle colorHandle, RenderTargetHandle depthHandle)
{
this.colorAttachmentHandle = colorHandle;
this.depthAttachmentHandle = depthHandle;
}
CommandBuffer cmd = CommandBufferPool.Get("Draw Skybox (Set RT's)");
cmd.SetRenderTarget(colorAttachmentHandle.Identifier(), depthAttachmentHandle.Identifier());
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
}

2
com.unity.render-pipelines.lightweight/LWRP/Passes/EndXRRenderingPass.cs


context.StereoEndRender(camera);
}
}
}
}

12
com.unity.render-pipelines.lightweight/LWRP/Passes/LightweightForwardPass.cs


protected void SetRenderTarget(CommandBuffer cmd, RenderBufferLoadAction loadOp, RenderBufferStoreAction storeOp, ClearFlag clearFlag, Color clearColor)
{
if (colorAttachmentHandle != RenderTargetHandle.CameraTarget)
{
if (depthAttachmentHandle != RenderTargetHandle.CameraTarget)
SetRenderTarget(
SetRenderTarget(
cmd,
colorAttachmentHandle.Identifier(),
loadOp,

clearFlag,
clearColor,
descriptor.dimension);
else
SetRenderTarget(cmd, colorAttachmentHandle.Identifier(), loadOp, storeOp, clearFlag, clearColor, descriptor.dimension);
}
else
{
SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget, loadOp, storeOp, clearFlag, clearColor, descriptor.dimension);
}
}
[Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")]

8
com.unity.render-pipelines.lightweight/LWRP/Passes/TransparentPostProcessPass.cs


private RenderTargetHandle colorAttachmentHandle { get; set; }
private RenderTextureDescriptor descriptor { get; set; }
private PostProcessRenderContext postContext { get; set; }
private RenderTargetIdentifier destination { get; set; }
RenderTargetHandle colorAttachmentHandle)
RenderTargetHandle colorAttachmentHandle,
RenderTargetIdentifier destination)
this.destination = destination;
public override void Execute(ScriptableRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,

LightweightPipeline.RenderPostProcess(cmd, postContext, ref renderingData.cameraData, descriptor.colorFormat, colorAttachmentHandle.Identifier(), BuiltinRenderTextureType.CameraTarget, false);
LightweightPipeline.RenderPostProcess(cmd, postContext, ref renderingData.cameraData, descriptor.colorFormat, colorAttachmentHandle.Identifier(), destination, false);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}

11
com.unity.render-pipelines.lightweight/LWRP/ScriptableRenderer.cs


public ScriptableRenderer(LightweightPipelineAsset pipelineAsset)
{
this.pipelineAsset = pipelineAsset;
m_Materials = new[]
{
CoreUtils.CreateEngineMaterial("Hidden/InternalErrorShader"),

postProcessRenderContext = new PostProcessRenderContext();
}
public LightweightPipelineAsset pipelineAsset { get; private set; }
public void Dispose()
{

desc.colorFormat = cameraData.isHdrEnabled ? RenderTextureFormat.DefaultHDR :
RenderTextureFormat.Default;
desc.enableRandomWrite = false;
desc.sRGB = true;
public void Execute(ref ScriptableRenderContext context, ref CullResults cullResults, ref RenderingData renderingData)
{
for (int i = 0; i < m_ActiveRenderPassQueue.Count; ++i)

m_ActiveRenderPassQueue.Add(pass);
}
public static bool RequiresIntermediateColorTexture(ref CameraData cameraData, RenderTextureDescriptor baseDescriptor, bool requiresCameraDepth)
public static bool RequiresIntermediateColorTexture(ref CameraData cameraData, RenderTextureDescriptor baseDescriptor)
{
if (cameraData.isOffscreenRender)
return false;

return requiresCameraDepth || cameraData.isSceneViewCamera || isScaledRender || cameraData.isHdrEnabled ||
return cameraData.isSceneViewCamera || isScaledRender || cameraData.isHdrEnabled ||
cameraData.postProcessEnabled || cameraData.requiresOpaqueTexture || isTargetTexture2DArray || !cameraData.isDefaultViewport;
}

2
com.unity.render-pipelines.lightweight/LWRP/ScriptableRenderer.cs.meta


fileFormatVersion: 2
guid: 83797c942458af1439f0f02f681ee8c9
guid: f0f3c3678ea96e34f97aa3e4a1503a22
MonoImporter:
externalObjects: {}
serializedVersion: 2

26
com.unity.testing.srp.lightweight/Tests/Scenes/028_PostProcessing_Custom/Scripts/InvertOpaque.cs


[Serializable]
[PostProcess(typeof(InvertOpaqueRenderer), PostProcessEvent.BeforeTransparent, "Custom/LWtest/Invert Opaque")]
public sealed class InvertOpaque : PostProcessEffectSettings {
public BoolParameter enable = new BoolParameter();
}
public sealed class InvertOpaque : PostProcessEffectSettings
{}
public sealed class InvertOpaqueRenderer : PostProcessEffectRenderer<InvertOpaque> {
public sealed class InvertOpaqueRenderer : PostProcessEffectRenderer<InvertOpaque>
{
internal static readonly int opaqueTemp = Shader.PropertyToID("_MainTex");
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
bool srcEqualsDest = context.destination == context.source;
if(srcEqualsDest)
context.GetScreenSpaceTemporaryRT(context.command, opaqueTemp);
context.command.BlitFullscreenTriangle(context.source, srcEqualsDest ? opaqueTemp : context.destination, sheet, 0);
if (srcEqualsDest)
{
context.command.BlitFullscreenTriangle(opaqueTemp, context.destination);
context.command.ReleaseTemporaryRT(opaqueTemp);
}
}
}

7
com.unity.render-pipelines.lightweight/LWRP/IAfterDepthPrePass.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public interface IAfterDepthPrePass
{
ScriptableRenderPass GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle depthAttachmentHandle);
}
}

11
com.unity.render-pipelines.lightweight/LWRP/IAfterDepthPrePass.cs.meta


fileFormatVersion: 2
guid: 9f5c6a69a4dcf2c449b7a61c2dd56cf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

10
com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePass.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public interface IAfterOpaquePass
{
ScriptableRenderPass GetPassToEnqueue(
RenderTextureDescriptor baseDescriptor,
RenderTargetHandle colorAttachmentHandle,
RenderTargetHandle depthAttachmentHandle);
}
}

11
com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePass.cs.meta


fileFormatVersion: 2
guid: 29d9a4da99a61ee46b3460ded642e269
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePostProcess.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public interface IAfterOpaquePostProcess
{
ScriptableRenderPass GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorHandle,
RenderTargetHandle depthHandle);
}
}

11
com.unity.render-pipelines.lightweight/LWRP/IAfterOpaquePostProcess.cs.meta


fileFormatVersion: 2
guid: 69367e423e833c046925cf2dc276bc55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

7
com.unity.render-pipelines.lightweight/LWRP/IAfterRender.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public interface IAfterRender
{
ScriptableRenderPass GetPassToEnqueue();
}
}

11
com.unity.render-pipelines.lightweight/LWRP/IAfterRender.cs.meta


fileFormatVersion: 2
guid: 586693508a009794c88f4760b7a0ba65
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

7
com.unity.render-pipelines.lightweight/LWRP/IAfterSkyboxPass.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public interface IAfterSkyboxPass
{
ScriptableRenderPass GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorHandle, RenderTargetHandle depthHandle);
}
}

11
com.unity.render-pipelines.lightweight/LWRP/IAfterSkyboxPass.cs.meta


fileFormatVersion: 2
guid: e8dc2e3f9b175f745915598d3139fa2e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

7
com.unity.render-pipelines.lightweight/LWRP/IAfterTransparentPass.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public interface IAfterTransparentPass
{
ScriptableRenderPass GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorHandle, RenderTargetHandle depthHandle);
}
}

11
com.unity.render-pipelines.lightweight/LWRP/IAfterTransparentPass.cs.meta


fileFormatVersion: 2
guid: 9c8bdf65e5b238b499ede67d890d95eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.meta


fileFormatVersion: 2
guid: a46d38292e14a884488084ddc4d73184
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

681
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.unity


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &613864840
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 613864844}
- component: {fileID: 613864843}
- component: {fileID: 613864842}
- component: {fileID: 613864841}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &613864841
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 613864840}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &613864842
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 613864840}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6602e4dc96b9e49e4b91b974a55eaaf0, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &613864843
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 613864840}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &613864844
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 613864840}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &802440984
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 802440988}
- component: {fileID: 802440987}
- component: {fileID: 802440986}
- component: {fileID: 802440985}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!135 &802440985
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802440984}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &802440986
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802440984}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: de0f448b225d240a7807e23dbddc52b6, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &802440987
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802440984}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &802440988
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802440984}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.431, y: 0.618, z: 1.66}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &870485155
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 870485159}
- component: {fileID: 870485158}
- component: {fileID: 870485157}
- component: {fileID: 870485156}
- component: {fileID: 870485160}
- component: {fileID: 870485161}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &870485156
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870485155}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTrigger: {fileID: 870485159}
volumeLayer:
serializedVersion: 2
m_Bits: 1
stopNaNPropagation: 1
antialiasingMode: 0
temporalAntialiasing:
jitterSpread: 0.75
sharpness: 0.25
stationaryBlending: 0.95
motionBlending: 0.85
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
fastMode: 0
keepAlpha: 0
fog:
enabled: 1
excludeSkybox: 1
debugLayer:
lightMeter:
width: 512
height: 256
showCurves: 1
histogram:
width: 512
height: 256
channel: 3
waveform:
exposure: 0.12
height: 256
vectorscope:
size: 256
exposure: 0.12
overlaySettings:
linearDepth: 0
motionColorIntensity: 4
motionGridSize: 64
colorBlindnessType: 0
colorBlindnessStrength: 1
m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
m_ShowToolkit: 0
m_ShowCustomSorter: 1
breakBeforeColorGrading: 0
m_BeforeTransparentBundles:
- assemblyQualifiedName: InvertOpaque, LWGraphicsTests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
m_BeforeStackBundles:
- assemblyQualifiedName: HalfToneOpaque, LWGraphicsTests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
m_AfterStackBundles: []
--- !u!81 &870485157
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870485155}
m_Enabled: 1
--- !u!20 &870485158
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870485155}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &870485159
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870485155}
m_LocalRotation: {x: -0.06049507, y: 0.86407423, z: -0.10709299, w: -0.48810577}
m_LocalPosition: {x: 2.344281, y: 1.1885588, z: 2.7055173}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &870485160
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870485155}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1922bf90be6ebc54da38e96e30f9339a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &870485161
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870485155}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 73231aa468d81ea49bc3d914080de185, type: 3}
m_Name:
m_EditorClassIdentifier:
ImageComparisonSettings:
TargetWidth: 1280
TargetHeight: 720
PerPixelCorrectnessThreshold: 0.005
AverageCorrectnessThreshold: 0.005
WaitFrames: 2
--- !u!1 &1018272651
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1018272655}
- component: {fileID: 1018272654}
- component: {fileID: 1018272653}
- component: {fileID: 1018272652}
m_Layer: 0
m_Name: Cube (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1018272652
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1018272651}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1018272653
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1018272651}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6602e4dc96b9e49e4b91b974a55eaaf0, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1018272654
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1018272651}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1018272655
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1018272651}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.583, y: 0.441, z: 2.681}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1027099700
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1027099702}
- component: {fileID: 1027099701}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1027099701
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027099700}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
m_Name:
m_EditorClassIdentifier:
sharedProfile: {fileID: 11400000, guid: 69722286846b6f04c9ec57b0c5bc9773, type: 2}
isGlobal: 1
blendDistance: 0
weight: 1
priority: 0
--- !u!4 &1027099702
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027099700}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5.961341, y: -1.2527268, z: -2.3001592}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2046495445
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2046495447}
- component: {fileID: 2046495446}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &2046495446
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2046495445}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &2046495447
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2046495445}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}

7
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks.unity.meta


fileFormatVersion: 2
guid: 58d22e8497ba91141b3ae7abd7b0bb41
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

169
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/CameraCallbackTests.cs


using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.LightweightPipeline;
using UnityEngine.Rendering;
public class CameraCallbackTests : MonoBehaviour
, IAfterDepthPrePass
, IAfterOpaquePass
, IAfterOpaquePostProcess
, IAfterSkyboxPass
, IAfterTransparentPass
, IAfterRender
{
static RenderTargetHandle afterDepth;
static RenderTargetHandle afterOpaque;
static RenderTargetHandle afterOpaquePost;
static RenderTargetHandle afterSkybox;
static RenderTargetHandle afterTransparent;
static RenderTargetHandle afterAll;
public CameraCallbackTests()
{
afterDepth.Init("_AfterDepth");
afterOpaque.Init("_AfterOpaque");
afterOpaquePost.Init("_AfterOpaquePost");
afterSkybox.Init("_AfterSkybox");
afterTransparent.Init("_AfterTransparent");
afterAll.Init("_AfterAll");
}
ScriptableRenderPass IAfterDepthPrePass.GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle depthAttachmentHandle)
{
var pass = new CopyDepthPass();
pass.Setup(depthAttachmentHandle, afterDepth);
return pass;
}
ScriptableRenderPass IAfterOpaquePass.GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorAttachmentHandle,
RenderTargetHandle depthAttachmentHandle)
{
var pass = new CopyColorPass();
pass.Setup(colorAttachmentHandle, afterOpaque);
return pass;
}
ScriptableRenderPass IAfterOpaquePostProcess.GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorHandle,
RenderTargetHandle depthHandle)
{
var pass = new CopyColorPass();;
pass.Setup(colorHandle, afterOpaquePost);
return pass;
}
ScriptableRenderPass IAfterSkyboxPass.GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorHandle,
RenderTargetHandle depthHandle)
{
var pass = new CopyColorPass();
pass.Setup(colorHandle, afterSkybox);
return pass;
}
ScriptableRenderPass IAfterTransparentPass.GetPassToEnqueue(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorHandle,
RenderTargetHandle depthHandle)
{
var pass = new CopyColorPass();
pass.Setup(colorHandle, afterTransparent);
return pass;
}
private class CapturePass : ScriptableRenderPass
{
private RenderTargetHandle m_Source;
private RenderTargetHandle m_Target;
public void Setup(RenderTargetHandle source, RenderTargetHandle target)
{
m_Source = source;
m_Target = target;
}
public override void Execute(ScriptableRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{
RenderTextureDescriptor opaqueDesc = ScriptableRenderer.CreateRTDesc(ref renderingData.cameraData);
var cmd = CommandBufferPool.Get("Capture Pass");
cmd.GetTemporaryRT(m_Target.id, opaqueDesc);
cmd.Blit(m_Source.Identifier(), m_Target.Identifier());
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
public override void FrameCleanup(CommandBuffer cmd)
{
if (m_Target != RenderTargetHandle.CameraTarget)
{
cmd.ReleaseTemporaryRT(m_Target.id);
m_Target = RenderTargetHandle.CameraTarget;
}
}
}
class BlitPass : ScriptableRenderPass
{
CapturePass m_CopyResult = new CapturePass();
public override void Execute(ScriptableRenderer renderer, ref ScriptableRenderContext context, ref CullResults cullResults,
ref RenderingData renderingData)
{
m_CopyResult.Setup(RenderTargetHandle.CameraTarget, afterAll);
m_CopyResult.Execute(renderer, ref context, ref cullResults, ref renderingData);
Material material = renderer.GetMaterial(MaterialHandles.Blit);
CommandBuffer cmd = CommandBufferPool.Get("Blit Pass");
cmd.SetRenderTarget(BuiltinRenderTextureType.CameraTarget);
cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity);
cmd.SetViewport(new Rect(0, renderingData.cameraData.camera.pixelRect.height / 2.0f, renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f));
cmd.SetGlobalTexture("_BlitTex", afterDepth.Identifier());
LightweightPipeline.DrawFullScreen(cmd, material);
cmd.SetViewport(new Rect(renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f, renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f));
cmd.SetGlobalTexture("_BlitTex", afterOpaque.Identifier());
LightweightPipeline.DrawFullScreen(cmd, material);
cmd.SetViewport(new Rect(renderingData.cameraData.camera.pixelRect.width / 3.0f * 2.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f, renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f));
cmd.SetGlobalTexture("_BlitTex", afterOpaquePost.Identifier());
LightweightPipeline.DrawFullScreen(cmd, material);
cmd.SetViewport(new Rect(0f, 0f, renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f));
cmd.SetGlobalTexture("_BlitTex", afterSkybox.Identifier());
LightweightPipeline.DrawFullScreen(cmd, material);
cmd.SetViewport(new Rect(renderingData.cameraData.camera.pixelRect.width / 3.0f, 0f, renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f));
cmd.SetGlobalTexture("_BlitTex", afterTransparent.Identifier());
LightweightPipeline.DrawFullScreen(cmd, material);
//TODO: Upsidown UV trash, ignore this for now
// Need to flip UV as we come from a framebuffer.
/*cmd.SetViewport(new Rect(renderingData.cameraData.camera.pixelRect.width / 3.0f * 2.0f, 0f, renderingData.cameraData.camera.pixelRect.width / 3.0f, renderingData.cameraData.camera.pixelRect.height / 2.0f));
cmd.SetGlobalTexture("_BlitTex", afterAll.Identifier());
cmd.EnableShaderKeyword("FLIP_VERTICAL_UV");
LightweightPipeline.DrawFullScreen(cmd, material);
cmd.DisableShaderKeyword("FLIP_VERTICAL_UV");*/
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
public override void FrameCleanup(CommandBuffer cmd)
{
base.FrameCleanup(cmd);
m_CopyResult.FrameCleanup(cmd);
}
}
ScriptableRenderPass IAfterRender.GetPassToEnqueue()
{
return new BlitPass();
}
}

11
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/CameraCallbackTests.cs.meta


fileFormatVersion: 2
guid: 1922bf90be6ebc54da38e96e30f9339a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1001
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/testPost.asset
文件差异内容过多而无法显示
查看文件

8
com.unity.testing.srp.lightweight/Tests/Scenes/052_LWCallbacks/testPost.asset.meta


fileFormatVersion: 2
guid: 69722286846b6f04c9ec57b0c5bc9773
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存