浏览代码
Added pipeline capabilities. Stripping shader meta pass and variants based on selected capabilities.
/main
Added pipeline capabilities. Stripping shader meta pass and variants based on selected capabilities.
/main
Felipe Lira
7 年前
当前提交
c30fcd10
共有 6 个文件被更改,包括 94 次插入 和 31 次删除
-
4ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs
-
25ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderPreprocessor.cs
-
20ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
-
58ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineCore.cs
-
18ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightKeywords.cs
-
0/ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineCore.cs.meta
|
|||
using System; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.LightweightPipeline |
|||
{ |
|||
[Flags] |
|||
public enum PipelineCapabilities |
|||
{ |
|||
AdditionalLights = (1 << 0), |
|||
VertexLights = (1 << 1), |
|||
DirectionalShadows = (1 << 2), |
|||
LocalShadows = (1 << 3), |
|||
} |
|||
|
|||
public class LightweightKeywords |
|||
{ |
|||
public static readonly string AdditionalLightsText = "_ADDITIONAL_LIGHTS"; |
|||
public static readonly string VertexLightsText = "_VERTEX_LIGHTS"; |
|||
public static readonly string MixedLightingSubtractiveText = "_MIXED_LIGHTING_SUBTRACTIVE"; |
|||
public static readonly string MainLightCookieText = "_MAIN_LIGHT_COOKIE"; |
|||
public static readonly string DirectionalShadowsText = "_SHADOWS_ENABLED"; |
|||
public static readonly string LocalShadowsText = "_LOCAL_SHADOWS_ENABLED"; |
|||
|
|||
public static readonly ShaderKeyword AdditionalLights = new ShaderKeyword(AdditionalLightsText); |
|||
public static readonly ShaderKeyword VertexLights = new ShaderKeyword(VertexLightsText); |
|||
public static readonly ShaderKeyword MixedLightingSubtractive = new ShaderKeyword(MixedLightingSubtractiveText); |
|||
public static readonly ShaderKeyword MainLightCookie = new ShaderKeyword(MainLightCookieText); |
|||
public static readonly ShaderKeyword DirectionalShadows = new ShaderKeyword(DirectionalShadowsText); |
|||
public static readonly ShaderKeyword LocalShadows = new ShaderKeyword(LocalShadowsText); |
|||
} |
|||
|
|||
public partial class LightweightPipeline |
|||
{ |
|||
static PipelineCapabilities pipelineCapabilities; |
|||
|
|||
public static PipelineCapabilities GetPipelineCapabilities() |
|||
{ |
|||
return pipelineCapabilities; |
|||
} |
|||
|
|||
static void SetPipelineCapabilities(LightweightPipelineAsset pipelineAsset) |
|||
{ |
|||
pipelineCapabilities = 0U; |
|||
|
|||
if (pipelineAsset.MaxPixelLights < 1 && !pipelineAsset.SupportsVertexLight) |
|||
pipelineCapabilities |= PipelineCapabilities.AdditionalLights; |
|||
|
|||
if (pipelineAsset.SupportsVertexLight) |
|||
pipelineCapabilities |= PipelineCapabilities.VertexLights; |
|||
|
|||
if (pipelineAsset.ShadowSetting != ShadowType.NO_SHADOW) |
|||
pipelineCapabilities |= PipelineCapabilities.DirectionalShadows; |
|||
|
|||
pipelineCapabilities |= PipelineCapabilities.LocalShadows; |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.LightweightPipeline |
|||
{ |
|||
public class LightweightKeywords : MonoBehaviour |
|||
{ |
|||
// Pipeline specific keywords
|
|||
public static readonly ShaderKeyword AdditionalLights = new ShaderKeyword("_ADDITIONAL_LIGHTS"); |
|||
public static readonly ShaderKeyword VertexLights = new ShaderKeyword("_VERTEX_LIGHTS"); |
|||
public static readonly ShaderKeyword SubtractiveLight = new ShaderKeyword("_MIXED_LIGHTING_SUBTRACTIVE"); |
|||
public static readonly ShaderKeyword DirectionalShadows = new ShaderKeyword("_SHADOWS_ENABLED"); |
|||
public static readonly ShaderKeyword LocalShadows = new ShaderKeyword("_LOCAL_SHADOWS_ENABLED"); |
|||
|
|||
public static readonly ShaderKeyword Lightmap = new ShaderKeyword("DIRLIGHTMAP_COMBINED"); |
|||
public static readonly ShaderKeyword DirectionalLightmap = new ShaderKeyword("LIGHTMAP_ON"); |
|||
} |
|||
} |
|||
|
撰写
预览
正在加载...
取消
保存
Reference in new issue