浏览代码
Refactorentrypoint (#68)
Refactorentrypoint (#68)
Update to the RenderPipes to support the new paradigm on how to go about writing a renderpipe. Renderloops now should only contain configuration information + a call out to the rendering logic (preferably living in a static function). A loop now executes within a 'rendering context' that passes along a sidecar configuration file called a 'DataStore'. Any transient information that is needed between frames should be stored in this datastore (things like the materials / rendertextures). When the renderloop is destroyed this sidecar data is automatically cleaned up. It can also be cleaned manually. Currently only the BasicRenderLoop has been ported to this new model due to the other loops not having a separation of concerns between transient data and configuration. They need the loop owners to detangle this before porting to the new model can take place. These existing loops still work, but they suffer from the same lifecycle issues they have had up unti.../main
GitHub
8 年前
当前提交
7a0c40da
共有 21 个文件被更改,包括 358 次插入 和 1099 次删除
-
40Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
-
2Assets/Editor/Tests/RenderloopTests/CullResultsTest.cs
-
31Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
-
10Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs
-
78Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
8Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs
-
1001Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs
-
8Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs
-
18Assets/ScriptableRenderLoop/HDRenderLoop/Utilities.cs
-
6Assets/ScriptableRenderLoop/RenderPasses/ShadowRenderPass.cs
-
4Assets/ScriptableRenderLoop/common/SkyboxHelper.cs
-
68Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
-
9Assets/ScriptableRenderLoop/core.meta
-
33Assets/ScriptableRenderLoop/core/DefaultCameraProvider.cs
-
12Assets/ScriptableRenderLoop/core/DefaultCameraProvider.cs.meta
-
63Assets/ScriptableRenderLoop/core/RenderPipeline.cs
-
12Assets/ScriptableRenderLoop/core/RenderPipeline.cs.meta
-
40Assets/ScriptableRenderLoop/core/RenderingDataStore.cs
-
12Assets/ScriptableRenderLoop/core/RenderingDataStore.cs.meta
1001
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 2850f79359a84d84793e8feefa3ebb54 |
|||
folderAsset: yes |
|||
timeCreated: 1483004461 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.ScriptableRenderPipeline |
|||
{ |
|||
public class DefaultCameraProvider : ICameraProvider |
|||
{ |
|||
public Camera overrideCamera { get; set; } |
|||
|
|||
public static void GetCamerasToRenderDefault(List<Camera> cameras) |
|||
{ |
|||
cameras.Clear(); |
|||
foreach (var c in Camera.allCameras) |
|||
{ |
|||
if (c.enabled) |
|||
cameras.Add(c); |
|||
} |
|||
} |
|||
|
|||
public void GetCamerasToRender(List<Camera> cameras) |
|||
{ |
|||
if (overrideCamera != null) |
|||
{ |
|||
cameras.Clear(); |
|||
cameras.Add(overrideCamera); |
|||
} |
|||
else |
|||
{ |
|||
GetCamerasToRenderDefault(cameras); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3ac0b0f83d74a194f8578dc2907cacf6 |
|||
timeCreated: 1483007679 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.ScriptableRenderPipeline |
|||
{ |
|||
public abstract class RenderPipeline : BaseRenderPipeline |
|||
{ |
|||
private readonly HashSet<IScriptableRenderDataStore> m_AssociatedDataStores = new HashSet<IScriptableRenderDataStore>(); |
|||
private ICameraProvider m_CameraProvider; |
|||
|
|||
public override ICameraProvider cameraProvider |
|||
{ |
|||
get |
|||
{ |
|||
if (m_CameraProvider == null) |
|||
m_CameraProvider = ConstructCameraProvider(); |
|||
|
|||
return m_CameraProvider; |
|||
} |
|||
set { m_CameraProvider = value; } |
|||
} |
|||
|
|||
public override void Render(ScriptableRenderContext renderContext, IScriptableRenderDataStore dataStore) |
|||
{ |
|||
if (dataStore == null) |
|||
throw new ArgumentException(string.Format("Null DataStore has been passed into pipe {0}", this)); |
|||
|
|||
if (dataStore.owner == null) |
|||
throw new ArgumentException(string.Format("DataStore owner is null. It needs o be owned by loop {0}", this)); |
|||
|
|||
if (dataStore.owner != null && !ReferenceEquals(dataStore.owner, this)) |
|||
throw new ArgumentException(string.Format("DataStore {0} has been passed into pipe {1}, but is owned by {2}", dataStore, this, dataStore.owner)); |
|||
|
|||
m_AssociatedDataStores.Add(dataStore); |
|||
dataStore.Build(); |
|||
} |
|||
|
|||
public override void ClearCachedData() |
|||
{ |
|||
foreach (var store in m_AssociatedDataStores) |
|||
store.Cleanup(); |
|||
|
|||
m_AssociatedDataStores.Clear(); |
|||
} |
|||
|
|||
public override ICameraProvider ConstructCameraProvider() |
|||
{ |
|||
return new DefaultCameraProvider(); |
|||
} |
|||
|
|||
public override IScriptableRenderDataStore ConstructDataStore() |
|||
{ |
|||
return new RenderingDataStore(this); |
|||
} |
|||
|
|||
public static void CleanCameras(IEnumerable<Camera> cameras) |
|||
{ |
|||
foreach (var camera in cameras) |
|||
camera.ClearIntermediateRenderers(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 841216767fdff24409a31bd55d2f6f72 |
|||
timeCreated: 1483005410 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.ScriptableRenderPipeline |
|||
{ |
|||
public class RenderingDataStore : IScriptableRenderDataStore |
|||
{ |
|||
private bool m_NeedsBuild = true; |
|||
|
|||
public RenderingDataStore(IRenderPipeline owner) |
|||
{ |
|||
this.owner = owner; |
|||
} |
|||
|
|||
public void Build() |
|||
{ |
|||
if (m_NeedsBuild) |
|||
{ |
|||
InternalBuild(); |
|||
m_NeedsBuild = false; |
|||
} |
|||
} |
|||
|
|||
protected virtual void InternalBuild() |
|||
{} |
|||
|
|||
public void Cleanup() |
|||
{ |
|||
if (!m_NeedsBuild) |
|||
{ |
|||
InternalCleanup(); |
|||
m_NeedsBuild = true; |
|||
} |
|||
} |
|||
|
|||
protected virtual void InternalCleanup() |
|||
{} |
|||
|
|||
public IRenderPipeline owner { get; private set; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bd20f7d7bf8c34548b33677973016a96 |
|||
timeCreated: 1483005411 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue