浏览代码

Update to work with graphics/srp/prepare-filtering

/main
Peter Bay Bastian 7 年前
当前提交
d969dce9
共有 5 个文件被更改,包括 46 次插入50 次删除
  1. 13
      Assets/ScriptableRenderPipeline/BasicRenderPipeline/BasicRenderPipeline.cs
  2. 30
      Assets/ScriptableRenderPipeline/Fptl/FptlLighting.cs
  3. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  4. 27
      Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
  5. 14
      Assets/ScriptableRenderPipeline/OnTileDeferredPipeline/OnTileDeferredRenderPipeline.cs

13
Assets/ScriptableRenderPipeline/BasicRenderPipeline/BasicRenderPipeline.cs


SetupLightShaderVariables(cull.visibleLights, context);
// Draw opaque objects using BasicPass shader pass
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("BasicPass"));
settings.sorting.flags = SortFlags.CommonOpaque;
settings.inputFilter.SetQueuesOpaque();
context.DrawRenderers(ref settings);
var drawSettings = new DrawRendererSettings(camera, new ShaderPassName("BasicPass")) { sorting = { flags = SortFlags.CommonOpaque } };
var filterSettings = new FilterRenderersSettings(true) { renderQueueRange = RenderQueueRange.opaque };
context.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
settings.sorting.flags = SortFlags.CommonTransparent;
settings.inputFilter.SetQueuesTransparent();
context.DrawRenderers(ref settings);
drawSettings.sorting.flags = SortFlags.CommonTransparent;
filterSettings.renderQueueRange = RenderQueueRange.transparent;
context.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
if (useIntermediateBlitPath)
{

30
Assets/ScriptableRenderPipeline/Fptl/FptlLighting.cs


CommandBufferPool.Release(cmd);
// render opaque objects using Deferred pass
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("Deferred"))
var drawSettings = new DrawRendererSettings(camera, new ShaderPassName("Deferred"))
rendererConfiguration = RendererConfiguration.PerObjectLightmaps
//@TODO: need to get light probes + LPPV too?
rendererConfiguration = RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbe
//@TODO: need to get light probes + LPPV too?
settings.inputFilter.SetQueuesOpaque();
settings.rendererConfiguration = RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbe;
loop.DrawRenderers(ref settings);
var filterSettings = new FilterRenderersSettings(true){renderQueueRange = RenderQueueRange.opaque};
loop.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
}
void RenderForward(CullResults cull, Camera camera, ScriptableRenderContext loop, bool opaquesOnly)

// render opaque objects using Deferred pass
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("ForwardSinglePass"))
var drawSettings = new DrawRendererSettings(camera, new ShaderPassName("ForwardSinglePass"))
sorting = { flags = SortFlags.CommonOpaque }
sorting = { flags = SortFlags.CommonOpaque },
rendererConfiguration = RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbe
settings.rendererConfiguration = RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbe;
if (opaquesOnly) settings.inputFilter.SetQueuesOpaque();
else settings.inputFilter.SetQueuesTransparent();
var filterSettings = new FilterRenderersSettings(true) { renderQueueRange = opaquesOnly ? RenderQueueRange.opaque : RenderQueueRange.transparent };
loop.DrawRenderers(ref settings);
loop.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
}
static void DepthOnlyForForwardOpaques(CullResults cull, Camera camera, ScriptableRenderContext loop)

CommandBufferPool.Release(cmd);
// render opaque objects using Deferred pass
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("DepthOnly"))
var drawSettings = new DrawRendererSettings(camera, new ShaderPassName("DepthOnly"))
settings.inputFilter.SetQueuesOpaque();
loop.DrawRenderers(ref settings);
var filterSettings = new FilterRenderersSettings(true) {};
filterSettings.renderQueueRange = RenderQueueRange.opaque;
loop.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
}
bool usingFptl

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


renderContext.ExecuteCommandBuffer(cmd);
cmd.Clear();
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName(passName))
var drawSettings = new DrawRendererSettings(camera, new ShaderPassName(passName))
settings.inputFilter.SetQueuesOpaque();
renderContext.DrawRenderers(ref settings);
var filterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.opaque};
renderContext.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
}
void RenderTransparentRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, string passName, RendererConfiguration rendererConfiguration = 0)

renderContext.ExecuteCommandBuffer(cmd);
cmd.Clear();
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName(passName))
var drawSettings = new DrawRendererSettings(camera, new ShaderPassName(passName))
settings.inputFilter.SetQueuesTransparent();
renderContext.DrawRenderers(ref settings);
var filterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.transparent};
renderContext.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
}
void RenderDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)

27
Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


BeginForwardRendering(camera, ref context, stereoEnabled);
var litDrawSettings = new DrawRendererSettings(camera, m_LitPassName);
litDrawSettings.sorting.flags = SortFlags.CommonOpaque;
litDrawSettings.rendererConfiguration = configuration;
var unlitDrawSettings = new DrawRendererSettings(camera, m_UnlitPassName);
unlitDrawSettings.sorting.flags = SortFlags.CommonTransparent;
var litSettings = new DrawRendererSettings(m_CullResults, camera, m_LitPassName);
litSettings.sorting.flags = SortFlags.CommonOpaque;
litSettings.inputFilter.SetQueuesOpaque();
litSettings.rendererConfiguration = configuration;
var opaqueFilterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.opaque};
var unlitSettings = new DrawRendererSettings(m_CullResults, camera, m_UnlitPassName);
unlitSettings.sorting.flags = SortFlags.CommonTransparent;
unlitSettings.inputFilter.SetQueuesTransparent();
context.DrawRenderers(ref litSettings);
context.DrawRenderers(m_CullResults.visibleRenderers, ref litDrawSettings, opaqueFilterSettings);
litSettings.sorting.flags = SortFlags.CommonTransparent;
litSettings.inputFilter.SetQueuesTransparent();
context.DrawRenderers(ref litSettings);
context.DrawRenderers(ref unlitSettings);
var transparentFilterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.transparent};
litDrawSettings.sorting.flags = SortFlags.CommonTransparent;
context.DrawRenderers(m_CullResults.visibleRenderers, ref litDrawSettings, transparentFilterSettings);
context.DrawRenderers(m_CullResults.visibleRenderers, ref unlitDrawSettings, transparentFilterSettings);
EndForwardRendering(camera, ref context, stereoEnabled);

14
Assets/ScriptableRenderPipeline/OnTileDeferredPipeline/OnTileDeferredRenderPipeline.cs


loop.ExecuteCommandBuffer (cmd);
// render opaque objects using Deferred pass
var settings = new DrawRendererSettings (cullResults, camera, new ShaderPassName ("Deferred")) {
var drawSettings = new DrawRendererSettings (camera, new ShaderPassName ("Deferred")) {
settings.inputFilter.SetQueuesOpaque ();
loop.DrawRenderers (ref settings);
var filterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.opaque};
loop.DrawRenderers (cullResults.visibleRenderers, ref drawSettings, filterSettings);
}
}

SetupLightShaderVariables (cullResults, camera, loop, cmd);
loop.ExecuteCommandBuffer(cmd);
var settings = new DrawRendererSettings(cullResults, camera, new ShaderPassName("ForwardSinglePass"))
var settings = new DrawRendererSettings(camera, new ShaderPassName("ForwardSinglePass"))
settings.inputFilter.SetQueuesTransparent();
loop.DrawRenderers (ref settings);
var filterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.transparent};
loop.DrawRenderers (cullResults.visibleRenderers, ref settings, filterSettings);
}
}

正在加载...
取消
保存