浏览代码

Stripped invalid variants. Reduced Standard shader with full settings to 43.75% variants. Furter reduced tandard shader with minimal settings to 2.08%.

/main
Felipe Lira 7 年前
当前提交
fab1cd33
共有 2 个文件被更改,包括 26 次插入0 次删除
  1. 23
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderPreprocessor.cs
  2. 3
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineCore.cs

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


return false;
}
bool StripInvalidVariants(ShaderCompilerData compilerData)
{
bool isShadowVariant = compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.DirectionalShadows) ||
compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.LocalShadows);
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.SoftShadows) && !isShadowVariant)
return true;
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.VertexLights) &&
!compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.AdditionalLights))
return true;
// Note: LWRP doesn't support Dynamic Lightmap.
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.DirectionalLightmap) &&
!compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.Lightmap))
return true;
return false;
}
bool StripUnused(PipelineCapabilities capabilities, Shader shader, ShaderSnippetData snippetData, ShaderCompilerData compilerData)
{
if (StripUnusedShader(capabilities, shader))

return true;
if (StripUnusedVariant(capabilities, compilerData))
return true;
if (StripInvalidVariants(compilerData))
return true;
return false;

3
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineCore.cs


public static readonly ShaderKeyword DirectionalShadows = new ShaderKeyword(DirectionalShadowsText);
public static readonly ShaderKeyword LocalShadows = new ShaderKeyword(LocalShadowsText);
public static readonly ShaderKeyword SoftShadows = new ShaderKeyword(SoftShadowsText);
public static readonly ShaderKeyword Lightmap = new ShaderKeyword("LIGHTMAP_ON");
public static readonly ShaderKeyword DirectionalLightmap = new ShaderKeyword("DIRLIGHTMAP_COMBINED");
}
public partial class LightweightPipeline

正在加载...
取消
保存