浏览代码

Split stripping at shader, pass and variant stage.

/main
Felipe Lira 7 年前
当前提交
38d02996
共有 1 个文件被更改,包括 34 次插入3 次删除
  1. 37
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderPreprocessor.cs

37
ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderPreprocessor.cs


// The first one executed is the one where callbackOrder is returning the smallest number.
public int callbackOrder { get { return 0; } }
private bool StripUnusedVariant(ShaderSnippetData snippetData, ShaderCompilerData compilerData)
private bool StripUnusedShader(PipelineCapabilities capabilities, Shader shader)
{
if (!CoreUtils.HasFlag(capabilities, PipelineCapabilities.DirectionalShadows) &&
shader.name.Contains("ScreenSpaceShadows"))
return true;
return false;
}
private bool StripUnusedPass(PipelineCapabilities capabilities, ShaderSnippetData snippetData)
PipelineCapabilities capabilities = UnityEngine.Experimental.Rendering.LightweightPipeline.LightweightPipeline.GetPipelineCapabilities();
if (snippetData.passType == PassType.ShadowCaster)
if (!CoreUtils.HasFlag(capabilities, PipelineCapabilities.DirectionalShadows) && !CoreUtils.HasFlag(capabilities, PipelineCapabilities.LocalShadows))
return true;
return false;
}
private bool StripUnusedVariant(PipelineCapabilities capabilities, ShaderCompilerData compilerData)
{
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.AdditionalLights) &&
!CoreUtils.HasFlag(capabilities, PipelineCapabilities.AdditionalLights))
return true;

return false;
}
private bool StripUnused(PipelineCapabilities capabilities, Shader shader, ShaderSnippetData snippetData, ShaderCompilerData compilerData)
{
if (StripUnusedShader(capabilities, shader))
return true;
if (StripUnusedPass(capabilities, snippetData))
return true;
if (StripUnusedVariant(capabilities, compilerData))
return true;
return false;
}
PipelineCapabilities capabilities = UnityEngine.Experimental.Rendering.LightweightPipeline.LightweightPipeline.GetPipelineCapabilities();
if (StripUnusedVariant(snippet, data[i]))
if (StripUnused(capabilities, shader, snippet, data[i]))
{
data.RemoveAt(i);
--i;

正在加载...
取消
保存