浏览代码

Add shader stripper support for decal variant + update HDRP asset

/main
Sebastien Lagarde 7 年前
当前提交
a8187784
共有 3 个文件被更改,包括 22 次插入5 次删除
  1. 16
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/BaseShaderPreprocessor.cs
  2. 7
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
  3. 4
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs

16
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/BaseShaderPreprocessor.cs


protected ShaderKeyword m_TileLighting;
protected ShaderKeyword m_ClusterLighting;
protected ShaderKeyword m_LodFadeCrossFade;
protected ShaderKeyword m_Decals3RT;
protected ShaderKeyword m_Decals4RT;
public BaseShaderPreprocessor()
{

m_ClusterLighting = new ShaderKeyword("USE_CLUSTERED_LIGHTLIST");
m_LodFadeCrossFade = new ShaderKeyword("LOD_FADE_CROSSFADE");
m_Decals3RT = new ShaderKeyword("_DECALS_3RT");
m_Decals4RT = new ShaderKeyword("_DECALS_4RT");
}
public virtual void AddStripperFuncs(Dictionary<string, VariantStrippingFunc> stripperFuncs) {}

return true;
if (inputData.shaderKeywordSet.IsEnabled(m_LodFadeCrossFade) && !hdrpAsset.renderPipelineSettings.supportDitheringCrossFade)
return true;
// Decal case
// If no decal, remove decal variant
if ((inputData.shaderKeywordSet.IsEnabled(m_Decals3RT) || inputData.shaderKeywordSet.IsEnabled(m_Decals4RT)) && !hdrpAsset.renderPipelineSettings.supportDecals)
return true;
// If decal but with 4RT remove 3RT variant and vice versa
if (inputData.shaderKeywordSet.IsEnabled(m_Decals3RT) && hdrpAsset.renderPipelineSettings.decalSettings.perChannelMask)
return true;
if (inputData.shaderKeywordSet.IsEnabled(m_Decals4RT) && !hdrpAsset.renderPipelineSettings.decalSettings.perChannelMask)
return true;
return false;

7
com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset


m_Script: {fileID: 11500000, guid: 0cf1dab834d4ec34195b920ea7bbf9ec, type: 3}
m_Name: HDRenderPipelineAsset
m_EditorClassIdentifier:
version: 1
m_Version: 1
m_RenderPipelineResources: {fileID: 11400000, guid: 3ce144cff5783da45aa5d4fdc2da14b7, type: 2}
m_FrameSettings:
enableShadow: 1

enableTransparentPrepass: 1
enableMotionVectors: 1
enableObjectMotionVectors: 1
enableDBuffer: 1
enableDecals: 1
enableRoughRefraction: 1
enableTransparentPostpass: 1
enableDistortion: 1

increaseResolutionOfVolumetrics: 0
supportRuntimeDebugDisplay: 1
supportDitheringCrossFade: 1
supportDBuffer: 1
supportDecals: 1
supportMSAA: 0
msaaSampleCount: 1
supportMotionVectors: 1

drawDistance: 1000
atlasWidth: 4096
atlasHeight: 4096
perChannelMask: 0
allowShaderVariantStripping: 1
diffusionProfileSettings: {fileID: 11400000, guid: 404820c4cf36ad944862fa59c56064f0, type: 2}

4
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


m_ReflectionProbeCullResults.Cull();
m_DbufferManager.enableDBuffer = false;
using (new ProfilingSample(cmd, "DBufferPrepareDrawData", CustomSamplerId.DBufferPrepareDrawData.GetSampler()))
if (hdCamera.frameSettings.enableDecals)
if (hdCamera.frameSettings.enableDecals)
using (new ProfilingSample(cmd, "DBufferPrepareDrawData", CustomSamplerId.DBufferPrepareDrawData.GetSampler()))
{
DecalSystem.instance.EndCull();
m_DbufferManager.enableDBuffer = true; // mesh decals are renderers managed by c++ runtime and we have no way to query if any are visible, so set to true

正在加载...
取消
保存