浏览代码

[srl]Implement c# changes to match the c++ code changes.

/main
Tim Cooper 8 年前
当前提交
e9ce1c42
共有 12 个文件被更改,包括 127 次插入83 次删除
  1. 42
      Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
  2. 2
      Assets/Editor/Tests/RenderloopTests/CullResultsTest.cs
  3. 22
      Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
  4. 51
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  5. 8
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs
  6. 8
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
  7. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs
  8. 8
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs
  9. 18
      Assets/ScriptableRenderLoop/HDRenderLoop/Utilities.cs
  10. 6
      Assets/ScriptableRenderLoop/RenderPasses/ShadowRenderPass.cs
  11. 4
      Assets/ScriptableRenderLoop/common/SkyboxHelper.cs
  12. 39
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs

42
Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs


using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;

// - This loop also does not setup lightmaps, light probes, reflection probes or light cookies
[ExecuteInEditMode]
public class BasicRenderLoop : RenderPipeline
public class BasicRenderLoop : RenderPipeline<ICameraProvider>
#if UNITY_EDITOR
[UnityEditor.MenuItem("Renderloop/Create BasicRenderLoop")]
static void CreateBasicRenderLoop()

#endif
public override void Build()
{
}
{}
{}
[NonSerialized]
readonly List<Camera> m_CamerasToRender = new List<Camera>();
public override void Render(ScriptableRenderContext renderLoop)
if (realCameraProvider == null)
realCameraProvider = new DefaultCameraProvider();
realCameraProvider.GetCamerasToRender(m_CamerasToRender);
Render(renderLoop, m_CamerasToRender);
public override void Render(Camera[] cameras, RenderLoop loop)
public static void Render(ScriptableRenderContext context, IEnumerable<Camera> cameras)
{
foreach (var camera in cameras)
{

continue;
CullResults cull = CullResults.Cull (ref cullingParams, loop);
CullResults cull = CullResults.Cull (ref cullingParams, context);
loop.SetupCameraProperties (camera);
context.SetupCameraProperties (camera);
loop.ExecuteCommandBuffer(cmd);
context.ExecuteCommandBuffer(cmd);
SetupLightShaderVariables (cull.visibleLights, loop);
SetupLightShaderVariables (cull.visibleLights, context);
loop.DrawRenderers (ref settings);
context.DrawRenderers (ref settings);
loop.DrawSkybox (camera);
context.DrawSkybox (camera);
loop.DrawRenderers (ref settings);
context.DrawRenderers (ref settings);
loop.Submit ();
context.Submit ();
static void SetupLightShaderVariables (VisibleLight[] lights, RenderLoop loop)
static void SetupLightShaderVariables (VisibleLight[] lights, ScriptableRenderContext context)
{
// We only support up to 8 visible lights here. More complex approaches would
// be doing some sort of per-object light setups, but here we go for simplest possible

cmd.SetGlobalVectorArray ("globalLightAtten", lightAtten);
cmd.SetGlobalVector ("globalLightCount", new Vector4 (lightCount, 0, 0, 0));
cmd.SetGlobalVectorArray ("globalSH", shConstants);
loop.ExecuteCommandBuffer (cmd);
context.ExecuteCommandBuffer (cmd);
cmd.Dispose ();
}

outCoefficients[6].z = ambientProbe[2, 8];
outCoefficients[6].w = 1.0f;
}
}

2
Assets/Editor/Tests/RenderloopTests/CullResultsTest.cs


[TestFixture]
public class CullResultsTest
{
void InspectCullResults(Camera camera, CullResults cullResults, RenderLoop renderLoop)
void InspectCullResults(Camera camera, CullResults cullResults, ScriptableRenderContext renderLoop)
{
VisibleReflectionProbe[] probes = cullResults.visibleReflectionProbes;

22
Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs


using System.Collections;
using System;
using UnityEngine.Experimental.ScriptableRenderLoop;
public class RenderLoopTestFixture : RenderPipeline
public class RenderLoopTestFixture : RenderPipeline<ICameraProvider>
public delegate void TestDelegate(Camera camera, CullResults cullResults, RenderLoop renderLoop);
public delegate void TestDelegate(Camera camera, CullResults cullResults, ScriptableRenderContext renderLoop);
public override void Render(Camera[] cameras, RenderLoop renderLoop)
[NonSerialized]
readonly List<Camera> m_CamerasToRender = new List<Camera>();
public override void Render(ScriptableRenderContext renderLoop)
foreach (var camera in cameras)
if (realCameraProvider == null)
realCameraProvider = new DefaultCameraProvider();
realCameraProvider.GetCamerasToRender(m_CamerasToRender);
foreach (var camera in m_CamerasToRender)
if (!camera.enabled)
continue;
CullingParameters cullingParams;
bool gotCullingParams = CullResults.GetCullingParameters(camera, out cullingParams);
Assert.IsTrue(gotCullingParams);

51
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


{
[ExecuteInEditMode]
// This HDRenderLoop assume linear lighting. Don't work with gamma.
public partial class HDRenderLoop : RenderPipeline
public partial class HDRenderLoop : RenderPipeline<ICameraProvider>
{
const string k_HDRenderLoopPath = "Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset";

UnityEngine.Rendering.GraphicsSettings.lightsUseCCT = previousLightsUseCCT;
}
void InitAndClearBuffer(Camera camera, RenderLoop renderLoop)
void InitAndClearBuffer(Camera camera, ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("InitAndClearBuffer", renderLoop))
{

}
}
void RenderOpaqueRenderList(CullResults cull, Camera camera, RenderLoop renderLoop, string passName, RendererConfiguration rendererConfiguration = 0)
void RenderOpaqueRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderLoop, string passName, RendererConfiguration rendererConfiguration = 0)
{
if (!debugParameters.displayOpaqueObjects)
return;

renderLoop.DrawRenderers(ref settings);
}
void RenderTransparentRenderList(CullResults cull, Camera camera, RenderLoop renderLoop, string passName, RendererConfiguration rendererConfiguration = 0)
void RenderTransparentRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderLoop, string passName, RendererConfiguration rendererConfiguration = 0)
{
if (!debugParameters.displayTransparentObjects)
return;

renderLoop.DrawRenderers(ref settings);
}
void RenderDepthPrepass(CullResults cull, Camera camera, RenderLoop renderLoop)
void RenderDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderLoop)
{
// If we are forward only we will do a depth prepass
// TODO: Depth prepass should be enabled based on light loop settings. LightLoop define if they need a depth prepass + forward only...

}
}
void RenderGBuffer(CullResults cull, Camera camera, RenderLoop renderLoop)
void RenderGBuffer(CullResults cull, Camera camera, ScriptableRenderContext renderLoop)
{
if (debugParameters.useForwardRenderingOnly)
{

}
// This pass is use in case of forward opaque and deferred rendering. We need to render forward objects before tile lighting pass
void RenderForwardOnlyDepthPrepass(CullResults cull, Camera camera, RenderLoop renderLoop)
void RenderForwardOnlyDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderLoop)
{
// If we are forward only we don't need to render ForwardOpaqueDepth object
// But in case we request a prepass we render it

}
}
void RenderDebugViewMaterial(CullResults cull, HDCamera hdCamera, RenderLoop renderLoop)
void RenderDebugViewMaterial(CullResults cull, HDCamera hdCamera, ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("DebugView Material Mode Pass", renderLoop))
// Render Opaque forward

}
}
void RenderDeferredLighting(HDCamera hdCamera, RenderLoop renderLoop)
void RenderDeferredLighting(HDCamera hdCamera, ScriptableRenderContext renderLoop)
{
if (debugParameters.useForwardRenderingOnly)
{

m_lightLoop.RenderDeferredLighting(hdCamera, renderLoop, m_CameraColorBuffer);
}
void UpdateSkyEnvironment(HDCamera hdCamera, RenderLoop renderLoop)
void UpdateSkyEnvironment(HDCamera hdCamera, ScriptableRenderContext renderLoop)
void RenderSky(HDCamera hdCamera, RenderLoop renderLoop)
void RenderSky(HDCamera hdCamera, ScriptableRenderContext renderLoop)
void RenderForward(CullResults cullResults, Camera camera, RenderLoop renderLoop, bool renderOpaque)
void RenderForward(CullResults cullResults, Camera camera, ScriptableRenderContext renderLoop, bool renderOpaque)
{
// TODO: Currently we can't render opaque object forward when deferred is enabled
// miss option

// Render material that are forward opaque only (like eye)
// TODO: Think about hair that could be render both as opaque and transparent...
void RenderForwardOnly(CullResults cullResults, Camera camera, RenderLoop renderLoop)
void RenderForwardOnly(CullResults cullResults, Camera camera, ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("Forward Only Pass", renderLoop))
{

}
}
void RenderForwardUnlit(CullResults cullResults, Camera camera, RenderLoop renderLoop)
void RenderForwardUnlit(CullResults cullResults, Camera camera, ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("Forward Unlit Pass", renderLoop))
{

}
}
void RenderVelocity(CullResults cullResults, Camera camera, RenderLoop renderLoop)
void RenderVelocity(CullResults cullResults, Camera camera, ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("Velocity Pass", renderLoop))
{

}
}
void RenderDistortion(CullResults cullResults, Camera camera, RenderLoop renderLoop)
void RenderDistortion(CullResults cullResults, Camera camera, ScriptableRenderContext renderLoop)
{
if (!debugParameters.useDistortion)
return ;

}
}
void FinalPass(RenderLoop renderLoop)
void FinalPass(ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("Final Pass", renderLoop))
{

}
}
public void PushGlobalParams(HDCamera hdCamera, RenderLoop renderLoop)
public void PushGlobalParams(HDCamera hdCamera, ScriptableRenderContext renderLoop)
{
if (m_SkyManager.IsSkyValid())
{

}
}
public override void Render(Camera[] cameras, RenderLoop renderLoop)
[NonSerialized]
readonly List<Camera> m_CamerasToRender = new List<Camera>();
public override void Render(ScriptableRenderContext renderLoop)
if (realCameraProvider == null)
realCameraProvider = new DefaultCameraProvider();
realCameraProvider.GetCamerasToRender(m_CamerasToRender);
if (!m_LitRenderLoop.isInit)
{
m_LitRenderLoop.RenderInit(renderLoop);

// Set Frame constant buffer
// TODO...
foreach (var camera in cameras)
foreach (var camera in m_CamerasToRender)
if (!camera.enabled)
continue;
// Set camera constant buffer
// TODO...

8
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs


public virtual void PrepareLightsForGPU(ShadowSettings shadowSettings, CullResults cullResults, Camera camera, ref ShadowOutput shadowOutput) { }
// TODO: this should not be part of the interface but for now make something working
public virtual void BuildGPULightLists(Camera camera, RenderLoop loop, RenderTargetIdentifier cameraDepthBufferRT) { }
public virtual void BuildGPULightLists(Camera camera, ScriptableRenderContext loop, RenderTargetIdentifier cameraDepthBufferRT) { }
public virtual void PushGlobalParams(Camera camera, RenderLoop loop) {}
public virtual void PushGlobalParams(Camera camera, ScriptableRenderContext loop) {}
public virtual void RenderDeferredLighting(HDRenderLoop.HDCamera hdCamera, RenderLoop renderLoop, RenderTargetIdentifier cameraColorBufferRT) {}
public virtual void RenderDeferredLighting(HDRenderLoop.HDCamera hdCamera, ScriptableRenderContext renderLoop, RenderTargetIdentifier cameraColorBufferRT) {}
public virtual void RenderForward(Camera camera, RenderLoop renderLoop, bool renderOpaque) {}
public virtual void RenderForward(Camera camera, ScriptableRenderContext renderLoop, bool renderOpaque) {}
public Light GetCurrentSunLight() { return m_CurrentSunLight; }
}

8
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs


cmd.DispatchCompute(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, numTilesX, numTilesY, 1);
}
public override void BuildGPULightLists(Camera camera, RenderLoop loop, RenderTargetIdentifier cameraDepthBufferRT)
public override void BuildGPULightLists(Camera camera, ScriptableRenderContext loop, RenderTargetIdentifier cameraDepthBufferRT)
{
var w = camera.pixelWidth;
var h = camera.pixelHeight;

cmd.Dispose();
}
public override void PushGlobalParams(Camera camera, RenderLoop loop)
public override void PushGlobalParams(Camera camera, ScriptableRenderContext loop)
{
Shader.SetGlobalTexture("_CookieTextures", m_CookieTexArray.GetTexCache());
Shader.SetGlobalTexture("_CookieCubeTextures", m_CubeCookieTexArray.GetTexCache());

}
#endif
public override void RenderDeferredLighting(HDRenderLoop.HDCamera hdCamera, RenderLoop renderLoop, RenderTargetIdentifier cameraColorBufferRT)
public override void RenderDeferredLighting(HDRenderLoop.HDCamera hdCamera, ScriptableRenderContext renderLoop, RenderTargetIdentifier cameraColorBufferRT)
{
var bUseClusteredForDeferred = !usingFptl;

} // TilePass - Deferred Lighting Pass
}
public override void RenderForward(Camera camera, RenderLoop renderLoop, bool renderOpaque)
public override void RenderForward(Camera camera, ScriptableRenderContext renderLoop, bool renderOpaque)
{
// Note: if we use render opaque with deferred tiling we need to render a opque depth pass for these opaque objects
bool useFptl = renderOpaque && usingFptl;

2
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs


isInit = false;
}
public void RenderInit(UnityEngine.Experimental.Rendering.RenderLoop renderLoop)
public void RenderInit(Rendering.ScriptableRenderContext renderLoop)
{
var cmd = new CommandBuffer();
cmd.name = "Init PreFGD";

8
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs


public Matrix4x4 invViewProjMatrix;
public Vector4 screenSize;
public Mesh skyMesh;
public RenderLoop renderLoop;
public ScriptableRenderContext renderLoop;
public Light sunLight;
public RenderTargetIdentifier colorBuffer;
public RenderTargetIdentifier depthBuffer;

}
}
private void RenderCubemapGGXConvolution(RenderLoop renderLoop, BuiltinSkyParameters builtinParams, SkyParameters skyParams, Texture input, RenderTexture target)
private void RenderCubemapGGXConvolution(ScriptableRenderContext renderLoop, BuiltinSkyParameters builtinParams, SkyParameters skyParams, Texture input, RenderTexture target)
{
using (new Utilities.ProfilingSample("Sky Pass: GGX Convolution", renderLoop))
{

m_UpdateRequired = true;
}
public void UpdateEnvironment(HDRenderLoop.HDCamera camera, Light sunLight, RenderLoop renderLoop)
public void UpdateEnvironment(HDRenderLoop.HDCamera camera, Light sunLight, ScriptableRenderContext renderLoop)
{
{
using (new Utilities.ProfilingSample("Sky Environment Pass", renderLoop))

}
}
public void RenderSky(HDRenderLoop.HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, RenderLoop renderLoop)
public void RenderSky(HDRenderLoop.HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ScriptableRenderContext renderLoop)
{
using (new Utilities.ProfilingSample("Sky Pass", renderLoop))
{

18
Assets/ScriptableRenderLoop/HDRenderLoop/Utilities.cs


// Render Target Management.
public const ClearFlag kClearAll = ClearFlag.ClearDepth | ClearFlag.ClearColor;
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier buffer, ClearFlag clearFlag = ClearFlag.ClearNone, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier buffer, ClearFlag clearFlag = ClearFlag.ClearNone, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
{
var cmd = new CommandBuffer();
cmd.name = "";

}
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = CubemapFace.Unknown)
{
var cmd = new CommandBuffer();
cmd.name = "";

cmd.Dispose();
}
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer)
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag = ClearFlag.ClearNone)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag = ClearFlag.ClearNone)
public static void SetRenderTarget(RenderLoop renderLoop, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor)
public static void SetRenderTarget(ScriptableRenderContext renderLoop, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor)
{
var cmd = new CommandBuffer();
cmd.name = "";

: IDisposable
{
bool disposed = false;
RenderLoop renderLoop;
ScriptableRenderContext renderLoop;
public ProfilingSample(string _name, RenderLoop _renderloop)
public ProfilingSample(string _name, ScriptableRenderContext _renderloop)
{
renderLoop = _renderloop;
name = _name;

6
Assets/ScriptableRenderLoop/RenderPasses/ShadowRenderPass.cs


parameters.shadowDistance = Mathf.Min(m_Settings.maxShadowDistance, parameters.shadowDistance);
}
public void Render(RenderLoop loop, CullResults cullResults, out ShadowOutput packedShadows)
public void Render(ScriptableRenderContext loop, CullResults cullResults, out ShadowOutput packedShadows)
{
if (!m_Settings.enabled)
{

//---------------------------------------------------------------------------------------------------------------------------------------------------
// Render shadows
//---------------------------------------------------------------------------------------------------------------------------------------------------
void RenderPackedShadows(RenderLoop loop, CullResults cullResults, ref ShadowOutput packedShadows)
void RenderPackedShadows(ScriptableRenderContext loop, CullResults cullResults, ref ShadowOutput packedShadows)
{
var setRenderTargetCommandBuffer = new CommandBuffer();

}
//---------------------------------------------------------------------------------------------------------------------------------------------------
private void RenderShadowSplit(ref ShadowSliceData slice, Vector3 lightDirection, Matrix4x4 proj, Matrix4x4 view, ref RenderLoop loop, DrawShadowsSettings settings)
private void RenderShadowSplit(ref ShadowSliceData slice, Vector3 lightDirection, Matrix4x4 proj, Matrix4x4 view, ref ScriptableRenderContext loop, DrawShadowsSettings settings)
{
var commandBuffer = new CommandBuffer { name = "ShadowSetup" };

4
Assets/ScriptableRenderLoop/common/SkyboxHelper.cs


using System.Collections.Generic;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering;
public class SkyboxHelper
{

get { return m_Mesh; }
}
public void Draw(RenderLoop loop, Camera camera)
public void Draw(ScriptableRenderContext loop, Camera camera)
{
if (camera.clearFlags != CameraClearFlags.Skybox)
{

39
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


namespace UnityEngine.Experimental.ScriptableRenderLoop
{
[ExecuteInEditMode]
public class FptlLighting : RenderPipeline
public class FptlLighting : RenderPipeline<ICameraProvider>
{
#if UNITY_EDITOR
[UnityEditor.MenuItem("Renderloop/CreateRenderLoopFPTL")]

//@TODO: render VR occlusion mesh
}
static void RenderGBuffer(CullResults cull, Camera camera, RenderLoop loop)
static void RenderGBuffer(CullResults cull, Camera camera, ScriptableRenderContext loop)
{
// setup GBuffer for rendering
var cmd = new CommandBuffer { name = "Create G-Buffer" };

loop.DrawRenderers(ref settings);
}
void RenderForward(CullResults cull, Camera camera, RenderLoop loop, bool opaquesOnly)
void RenderForward(CullResults cull, Camera camera, ScriptableRenderContext loop, bool opaquesOnly)
{
var cmd = new CommandBuffer { name = opaquesOnly ? "Prep Opaques Only Forward Pass" : "Prep Forward Pass" };

loop.DrawRenderers(ref settings);
}
static void DepthOnlyForForwardOpaques(CullResults cull, Camera camera, RenderLoop loop)
static void DepthOnlyForForwardOpaques(CullResults cull, Camera camera, ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "Forward Opaques - Depth Only" };
cmd.SetRenderTarget(new RenderTargetIdentifier(s_GBufferZ));

}
}
static void CopyDepthAfterGBuffer(RenderLoop loop)
static void CopyDepthAfterGBuffer(ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "Copy depth" };
cmd.CopyTexture(new RenderTargetIdentifier(s_GBufferZ), new RenderTargetIdentifier(s_CameraDepthTexture));

void DoTiledDeferredLighting(Camera camera, RenderLoop loop, int numLights, int numDirLights)
void DoTiledDeferredLighting(Camera camera, ScriptableRenderContext loop, int numLights, int numDirLights)
{
var bUseClusteredForDeferred = !usingFptl;
var cmd = new CommandBuffer();

return numLightsOut + numProbesOut;
}
public override void Render(Camera[] cameras, RenderLoop renderLoop)
[NonSerialized]
readonly List<Camera> m_CamerasToRender = new List<Camera>();
public override void Render(ScriptableRenderContext renderLoop)
foreach (var camera in cameras)
if (realCameraProvider == null)
realCameraProvider = new DefaultCameraProvider();
realCameraProvider.GetCamerasToRender(m_CamerasToRender);
foreach (var camera in m_CamerasToRender)
if (!camera.enabled)
continue;
CullingParameters cullingParams;
if (!CullResults.GetCullingParameters(camera, out cullingParams))
continue;

renderLoop.Submit();
}
void FinalPass(RenderLoop loop)
void FinalPass(ScriptableRenderContext loop)
{
var cmd = new CommandBuffer { name = "FinalPass" };
cmd.Blit(s_CameraTarget, BuiltinRenderTextureType.CameraTarget, m_BlitMaterial, 0);

void ExecuteRenderLoop(Camera camera, CullResults cullResults, RenderLoop loop)
void ExecuteRenderLoop(Camera camera, CullResults cullResults, ScriptableRenderContext loop)
{
var w = camera.pixelWidth;
var h = camera.pixelHeight;

}
void DrawLightBoundsDebug(RenderLoop loop, int numLights)
void DrawLightBoundsDebug(ScriptableRenderContext loop, int numLights)
{
var cmd = new CommandBuffer { name = "DrawLightBoundsDebug" };
m_DebugLightBoundsMaterial.SetBuffer("g_data", s_ConvexBoundsBuffer);

m_CubeReflTexArray.NewFrame();
}
void RenderShadowMaps(CullResults cullResults, RenderLoop loop)
void RenderShadowMaps(CullResults cullResults, ScriptableRenderContext loop)
{
ShadowOutput shadows;
m_ShadowPass.Render(loop, cullResults, out shadows);

cmd.DispatchCompute(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, numTilesX, numTilesY, 1);
}
void BuildPerTileLightLists(Camera camera, RenderLoop loop, int numLights, Matrix4x4 projscr, Matrix4x4 invProjscr)
void BuildPerTileLightLists(Camera camera, ScriptableRenderContext loop, int numLights, Matrix4x4 projscr, Matrix4x4 invProjscr)
{
var w = camera.pixelWidth;
var h = camera.pixelHeight;

cmd.Dispose();
}
void PushGlobalParams(Camera camera, RenderLoop loop, Matrix4x4 viewToWorld, Matrix4x4 scrProj, Matrix4x4 incScrProj, int numDirLights)
void PushGlobalParams(Camera camera, ScriptableRenderContext loop, Matrix4x4 viewToWorld, Matrix4x4 scrProj, Matrix4x4 incScrProj, int numDirLights)
{
var cmd = new CommandBuffer { name = "Push Global Parameters" };

正在加载...
取消
保存