Skip to content

Commit 459a1a7

Browse files
arttu-peltonenEvergreen
authored andcommitted
Remove asmref usage from main SRP code
Currently in Unity 6, asmref files are sometimes used to bypass assembly visibility rules. In the future, asmref is no longer allowed so the current usage must be removed (see [RFC](https://docs.google.com/document/d/1SWAG19Ns5gnmbVl4WD-HT0f4DO2UVdiRj_YhX1o7J7E/edit#heading=h.9tfgs0fpr1tb)). This PR solves the sub-task [Remove asmref usage in main SRP package code](https://jira.unity3d.com/browse/XPIPELINE-917), part of the broader task [XPIPELINE-904](https://jira.unity3d.com/browse/XPIPELINE-904) to completely remove asmref usage from SRP code. Asmref usage in this PR originated from the need to access the internal "rawRenderQueue" property inside Material class. This PR just makes that property public API. Similar code was also found in ShaderGraph and fixed the same way.
1 parent f257d0e commit 459a1a7

File tree

15 files changed

+5
-98
lines changed

15 files changed

+5
-98
lines changed

Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,7 @@ internal static void UpdateMaterialRenderQueueControl(Material material)
846846
// user has explicitly selected a render queue and we should not override it.
847847
//
848848
bool isShaderGraph = material.IsShaderGraph(); // Non-shadergraph materials use automatic behavior
849-
int rawRenderQueue = MaterialAccess.ReadMaterialRawRenderQueue(material);
850-
if (!isShaderGraph || rawRenderQueue == -1)
849+
if (!isShaderGraph || material.rawRenderQueue == -1)
851850
{
852851
material.SetFloat(Property.QueueControl, (float)QueueControl.Auto); // Automatic behavior - surface type override
853852
}

Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/MaterialAssemblyReference.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/MaterialAssemblyReference/MaterialAssemblyReference.asmref

Lines changed: 0 additions & 3 deletions
This file was deleted.

Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/MaterialAssemblyReference/MaterialAssemblyReference.asmref.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/MaterialAssemblyReference/RawRenderQueue.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/MaterialAssemblyReference/RawRenderQueue.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
using UnityEditor;
44
using UnityEditor.ProjectWindowCallback;
55
using System.IO;
6-
using UnityEditorInternal;
76
using ShaderKeywordFilter = UnityEditor.ShaderKeywordFilter;
87
#endif
98
using System.ComponentModel;
10-
using System.Linq;
11-
using UnityEditor.Rendering;
12-
using UnityEngine;
139
using UnityEngine.Serialization;
1410
using UnityEngine.Experimental.Rendering;
1511
using UnityEngine.Rendering.RenderGraphModule;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using UnityEditor.Rendering;
43
using UnityEngine.Experimental.Rendering;
54

65
namespace UnityEngine.Rendering.Universal

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
using System.IO;
33
using System.ComponentModel;
44
using System.Collections.Generic;
5+
using UnityEngine.Serialization;
6+
#if UNITY_EDITOR
57
using UnityEditor;
68
using UnityEditor.Rendering;
7-
using UnityEngine.Serialization;
9+
#endif
810

911
namespace UnityEngine.Rendering.Universal
1012
{

Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGUI/BaseShaderGUI.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ internal static void UpdateMaterialRenderQueueControl(Material material)
209209
// If we find another value, add the the property set to 1 so we will know that the
210210
// user has explicitly selected a render queue and we should not override it.
211211
//
212-
int rawRenderQueue = MaterialAccess.ReadMaterialRawRenderQueue(material);
213-
if (rawRenderQueue == -1)
212+
if (material.rawRenderQueue == -1)
214213
{
215214
material.SetFloat(Property.QueueControl(), (float)QueueControl.Auto); // Automatic behavior - surface type override
216215
}

0 commit comments

Comments
 (0)