Skip to content

Commit d5ddc79

Browse files
kirill-titov-uEvergreen
authored andcommitted
[RPW] Switch to BuiltIn only when we plan to do it
https://jira.unity3d.com/browse/UUM-67156 Before this change when we switched from URP to HDRP or vice versa we set globalRenderPipeline for the Shader systems twice. First we set `Shader.globalRenderPipeline = string.Empty` from destructor of the previous RP so we go from RP to BuiltIn. Then when we create RP we set `Shader.globalRenderPipeline = "RPName"` and we go from BuiltIn to RP. Each set of the globalRenderPipeline tag call `void Shader::SetGlobalRenderPipeline(const core::string& name) {}` and reload shaders. Now if we switch from any SRP to any SRP we will avoid intermediate step where we set an empty string to the `Shader.globalRenderPipeline` by checking `GraphicsSettings.currentRenderPipeline`
1 parent 86231e4 commit d5ddc79

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,6 @@ public void ResetRTHandleReferenceSize(int width, int height)
742742

743743
void SetRenderingFeatures()
744744
{
745-
// Set sub-shader pipeline tag
746-
Shader.globalRenderPipeline = k_ShaderTagName;
747-
748745
// HD use specific GraphicsSettings
749746
m_PreviousLightsUseLinearIntensity = GraphicsSettings.lightsUseLinearIntensity;
750747
GraphicsSettings.lightsUseLinearIntensity = true;
@@ -860,8 +857,6 @@ bool IsSupportedPlatformAndDevice(out GraphicsDeviceType unsupportedGraphicDevic
860857

861858
void UnsetRenderingFeatures()
862859
{
863-
Shader.globalRenderPipeline = string.Empty;
864-
865860
GraphicsSettings.lightsUseLinearIntensity = m_PreviousLightsUseLinearIntensity;
866861
GraphicsSettings.lightsUseColorTemperature = m_PreviousLightsUseColorTemperature;
867862
GraphicsSettings.useScriptableRenderPipelineBatching = m_PreviousSRPBatcher;

Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ public UniversalRenderPipeline(UniversalRenderPipelineAsset asset)
248248
XRSystem.SetDisplayMSAASamples(msaaSamples);
249249
XRSystem.SetRenderScale(asset.renderScale);
250250

251-
Shader.globalRenderPipeline = k_ShaderTagName;
252-
253251
Lightmapping.SetDelegate(lightsDelegate);
254252

255253
CameraCaptureBridge.enabled = true;
@@ -316,8 +314,6 @@ protected override void Dispose(bool disposing)
316314

317315
pipelineAsset.DestroyRenderers();
318316

319-
Shader.globalRenderPipeline = string.Empty;
320-
321317
SupportedRenderingFeatures.active = new SupportedRenderingFeatures();
322318
ShaderData.instance.Dispose();
323319
XRSystem.Dispose();

0 commit comments

Comments
 (0)