Skip to content

[2022.1] Shader Stripping Improvements #5060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f4ae1b6
Adding off keyword stripping. Adding builtin shader stripping. Adding…
lukaschod Jul 6, 2021
437cd5a
Fixing correct off keyword stripping only for urp shaders. Fixing pun…
lukaschod Jul 7, 2021
0ba8a01
Adding temp disabling
lukaschod Jul 8, 2021
6514fe8
Disabling off striping of additional shadows
lukaschod Jul 8, 2021
a624f27
More disabled
lukaschod Jul 8, 2021
891e139
Exposing striping options and updating striping logic with new features
lukaschod Jul 29, 2021
89c1241
Cleanup
lukaschod Jul 29, 2021
eedfa34
Cleanup
lukaschod Jul 29, 2021
bb059d7
Cleanup
lukaschod Jul 29, 2021
5c3be17
Adding stripping to respect excluded build targets in quality settings
lukaschod Jul 29, 2021
0681444
Cleanup
lukaschod Jul 29, 2021
ed3731e
Temp setting change for QA pass
lukaschod Jul 29, 2021
722e47d
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
lukaschod Jul 30, 2021
420f4d9
Format
lukaschod Jul 30, 2021
18d6320
Format
lukaschod Jul 30, 2021
15fa7e2
Renaming disabled keyword variants to off variants
lukaschod Aug 2, 2021
872c4b0
Cleanup
lukaschod Aug 2, 2021
50e3dbb
Changing strip tool from class to struct
lukaschod Aug 2, 2021
1cdff01
Cleanup
lukaschod Aug 2, 2021
f6b39b0
Fixing post processing stripping and fixing shadow cascade stripping
lukaschod Aug 6, 2021
14f9a56
Cleanup
lukaschod Aug 6, 2021
d2d55a3
Fixing SSAO and VR stripping
lukaschod Aug 10, 2021
6075d5e
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
lukaschod Aug 10, 2021
3d12bd8
Updating changelog
lukaschod Aug 10, 2021
8de0ec5
Cleanup
lukaschod Aug 10, 2021
bd90de9
Edited the descriptions.
oleks-k Aug 10, 2021
0412812
Fix null reference error
lukaschod Aug 11, 2021
05cc7f1
Merge branch 'universal/shader-strip-improvements' of github.com:Unit…
lukaschod Aug 11, 2021
23c1396
Renaming stripping options to have consistent naming and logic
lukaschod Aug 17, 2021
7ca3f7b
Fixing strip debug variants option upgrader
lukaschod Aug 18, 2021
cdf320e
Updating urp global settings for gfx split projects
lukaschod Aug 18, 2021
68ce2d1
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
lukaschod Aug 18, 2021
413e621
Fixing obsolete warning for updater
lukaschod Aug 18, 2021
e6fb445
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
lukaschod Aug 19, 2021
a3eef86
Re-enabling to check if case still repros after shader striping chang…
lukaschod Aug 19, 2021
c99fa2f
Fixed standard shader upgraded to urp details to have same visual sca…
lukaschod Aug 25, 2021
3b0cb20
Cleanup and strip light layers on gles
lukaschod Aug 31, 2021
5d2d57e
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
lukaschod Sep 6, 2021
da1bb50
Moving changes to new version in changelog
lukaschod Sep 6, 2021
a5e01ac
Reverting accidental changes that slipped form other branch
lukaschod Sep 6, 2021
7e6b3b6
Cleanup
lukaschod Sep 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2ec995e51a6e251468d2a3fd8a686257, type: 3}
m_Name: UniversalRenderPipelineGlobalSettings
m_EditorClassIdentifier:
k_AssetVersion: 1
k_AssetPreviousVersion: 1
k_AssetVersion: 2
lightLayerName0: Light Layer default
lightLayerName1: Light Layer 1
lightLayerName2: Light Layer 2
Expand All @@ -22,3 +21,7 @@ MonoBehaviour:
lightLayerName5: Light Layer 5
lightLayerName6: Light Layer 6
lightLayerName7: Light Layer 7
m_StripDebugVariants: 1
m_StripUnusedPostProcessingVariants: 1
m_StripUnusedVariants: 1
supportRuntimeDebugDisplay: 0
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2ec995e51a6e251468d2a3fd8a686257, type: 3}
m_Name: UniversalRenderPipelineGlobalSettings
m_EditorClassIdentifier:
k_AssetVersion: 1
k_AssetPreviousVersion: 1
k_AssetVersion: 2
lightLayerName0: Light Layer default
lightLayerName1: Light Layer 1
lightLayerName2: Light Layer 2
Expand All @@ -22,3 +21,7 @@ MonoBehaviour:
lightLayerName5: Light Layer 5
lightLayerName6: Light Layer 6
lightLayerName7: Light Layer 7
m_StripDebugVariants: 1
m_StripUnusedPostProcessingVariants: 1
m_StripUnusedVariants: 1
supportRuntimeDebugDisplay: 0
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2ec995e51a6e251468d2a3fd8a686257, type: 3}
m_Name: UniversalRenderPipelineGlobalSettings
m_EditorClassIdentifier:
k_AssetVersion: 1
k_AssetPreviousVersion: 1
k_AssetVersion: 2
lightLayerName0: Light Layer default
lightLayerName1: Light Layer 1
lightLayerName2: Light Layer 2
Expand All @@ -22,3 +21,7 @@ MonoBehaviour:
lightLayerName5: Light Layer 5
lightLayerName6: Light Layer 6
lightLayerName7: Light Layer 7
m_StripDebugVariants: 1
m_StripUnusedPostProcessingVariants: 1
m_StripUnusedVariants: 1
supportRuntimeDebugDisplay: 0
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/152_Lighting_EnlightenEnvironment.unity
guid: fb8f8e7cc18a5314f8d66d2ddfbfbaec
- enabled: 1
path: Assets/Scenes/153_Lighting_EnlightenTerrain.unity
guid: 677cb6424a7fe3947974395b6c3d70a4
- enabled: 1
path: Assets/Scenes/200_DepthDeferred.unity
guid: 3bbe19bef8dcc4e65b7aaa710c4114c6
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [13.0.0] - 2021-09-01

Version Updated
The version number for this package has increased due to a version update of a related graphics package.
### Added
- URP global setting for stripping post processing shader variants.
- URP global setting for stripping off shader variants.

## [12.0.0] - 2021-01-11
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ The section contains the following settings.

Use this section to define the names of Light Layers. Light Layers only work with 3D Renderers.

## Miscellaneous
## Shader Stripping

The check boxes in this section define which shader variants Unity strips when you build the Player.

| **Property** | **Description** |
| --------------------------| ------------------------------------------------------------ |
| Runtime Debug Shaders | When disabled, all debug display shader variants are removed when you build for the Unity Player. This decreases build time, but prevents the use of Rendering Debugger in Player builds. |
| Strip Debug Variants | When enabled, Unity strips all debug view shader variants when you build the Player. This decreases build time, but prevents the use of Rendering Debugger in Player builds. |
| Strip Unused Post Processing Variants | When enabled, Unity assumes that the Player does not create new [Volume Profiles](VolumeProfile.md) at runtime. With this assumption, Unity only keeps the shader variants that the existing [Volume Profiles](VolumeProfile.md) use, and strips all the other variants. Unity keeps shader variants used in Volume Profiles even if the Scenes in the project do not use the Profiles. |
| Strip Unused Variants | When enabled, Unity performs shader stripping in a more efficient way. This option reduces the amount of shader variants in the Player by a factor of 2 if the project uses the following URP features:<ul><li>Light Layers</li><li>Native Render Pass</li><li>Reflection Probe Blending</li><li>Reflection Probe Box Projection</li><li>SSAO Renderer Feature</li><li>Decal Renderer Feature</li><li>Certain post-processing effects</li></ul>Disable this option only if you see issues in the Player. |
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class SerializedUniversalRenderPipelineGlobalSettings
public SerializedProperty lightLayerName6;
public SerializedProperty lightLayerName7;

public SerializedProperty supportRuntimeDebugDisplay;
public SerializedProperty stripDebugVariants;
public SerializedProperty stripUnusedPostProcessingVariants;
public SerializedProperty stripUnusedVariants;

public SerializedUniversalRenderPipelineGlobalSettings(SerializedObject serializedObject)
{
Expand All @@ -44,7 +46,9 @@ public SerializedUniversalRenderPipelineGlobalSettings(SerializedObject serializ
lightLayerName6 = serializedObject.Find((UniversalRenderPipelineGlobalSettings s) => s.lightLayerName6);
lightLayerName7 = serializedObject.Find((UniversalRenderPipelineGlobalSettings s) => s.lightLayerName7);

supportRuntimeDebugDisplay = serializedObject.Find((UniversalRenderPipelineGlobalSettings s) => s.supportRuntimeDebugDisplay);
stripDebugVariants = serializedObject.FindProperty("m_StripDebugVariants");
stripUnusedPostProcessingVariants = serializedObject.FindProperty("m_StripUnusedPostProcessingVariants");
stripUnusedVariants = serializedObject.FindProperty("m_StripUnusedVariants");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal partial class UniversalGlobalSettingsPanelIMGUI
{
internal class Styles
{
public const int labelWidth = 220;
public const int labelWidth = 260;

public static readonly GUIContent lightLayersLabel = EditorGUIUtility.TrTextContent("Light Layer Names (3D)", "If the Light Layers feature is enabled in the URP Asset, Unity allocates memory for processing Light Layers. In the Deferred Rendering Path, this allocation includes an extra render target in GPU memory, which reduces performance.");
public static readonly GUIContent lightLayerName0 = EditorGUIUtility.TrTextContent("Light Layer 0", "The display name for Light Layer 0.");
Expand All @@ -25,8 +25,10 @@ internal class Styles
public static readonly GUIContent lightLayerName6 = EditorGUIUtility.TrTextContent("Light Layer 6", "The display name for Light Layer 6.");
public static readonly GUIContent lightLayerName7 = EditorGUIUtility.TrTextContent("Light Layer 7", "The display name for Light Layer 7.");

public static readonly GUIContent miscSettingsLabel = EditorGUIUtility.TrTextContent("Miscellaneous", "Miscellaneous settings");
public static readonly GUIContent supportRuntimeDebugDisplayContentLabel = EditorGUIUtility.TrTextContent("Runtime Debug Shaders", "When disabled, all debug display shader variants are removed when you build for the Unity Player. This decreases build time, but prevents the use of Rendering Debugger in Player builds.");
public static readonly GUIContent miscSettingsLabel = EditorGUIUtility.TrTextContent("Shader Stripping", "Shader Stripping settings");
public static readonly GUIContent stripDebugVariantsLabel = EditorGUIUtility.TrTextContent("Strip Debug Variants", "When disabled, all debug display shader variants are removed when you build for the Unity Player. This decreases build time, but prevents the use of Rendering Debugger in Player builds.");
public static readonly GUIContent stripUnusedPostProcessingVariantsLabel = EditorGUIUtility.TrTextContent("Strip Unused Post Processing Variants", "Controls whether strips automatically post processing shader variants based on VolumeProfile components. It strips based on VolumeProfiles in project and not scenes that actually uses it.");
public static readonly GUIContent stripUnusedVariantsLabel = EditorGUIUtility.TrTextContent("Strip Unused Variants", "Controls whether strip disabled keyword variants if the feature is enabled.");

public static readonly string warningUrpNotActive = "Project graphics settings do not refer to a URP Asset. Check the settings: Graphics > Scriptable Render Pipeline Settings, Quality > Render Pipeline Asset.";
public static readonly string warningGlobalSettingsMissing = "The Settings property does not contain a valid URP Global Settings asset. There might be issues in rendering. Select a valid URP Global Settings asset.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ static void DrawMiscSettings(SerializedUniversalRenderPipelineGlobalSettings ser

using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(serialized.supportRuntimeDebugDisplay, Styles.supportRuntimeDebugDisplayContentLabel);
EditorGUILayout.PropertyField(serialized.stripDebugVariants, Styles.stripDebugVariantsLabel);
EditorGUILayout.PropertyField(serialized.stripUnusedPostProcessingVariants, Styles.stripUnusedPostProcessingVariantsLabel);
EditorGUILayout.PropertyField(serialized.stripUnusedVariants, Styles.stripUnusedVariantsLabel);
}

EditorGUIUtility.labelWidth = oldWidth;
Expand Down
Loading