Skip to content

Commit 3b2af98

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.4] [URP] Added OpenGL support checks for active build profiles related to RenderFeature
1 parent 91c981f commit 3b2af98

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

Packages/com.unity.render-pipelines.universal/Editor/RendererFeatures/DecalRendererFeatureEditor.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ private struct Styles
1414
public static GUIContent UseRenderingLayers = EditorGUIUtility.TrTextContent("Use Rendering Layers", "When enabled, you can configure specific Decal Projectors to affect only specific objects. The number of Rendering Layers affects the performance.");
1515
public static GUIContent SurfaceData = EditorGUIUtility.TrTextContent("Surface Data", "Allows specifying which decals surface data should be blended with surfaces.");
1616
public static GUIContent NormalBlend = EditorGUIUtility.TrTextContent("Normal Blend", "Controls the quality of normal reconstruction. The higher the value the more accurate normal reconstruction and the cost on performance.");
17+
public static readonly GUIContent OpenGlSupportWarning = EditorGUIUtility.TrTextContentWithIcon("Rendering Layers are not supported on OpenGL.", "This feature is incompatible with OpenGL. Disable 'Auto Graphics API' in Player Settings and remove OpenGL from the list.", MessageType.Warning);
1718
}
1819

1920
private SerializedProperty m_Technique;
@@ -45,7 +46,18 @@ public override void OnInspectorGUI()
4546
{
4647
Init();
4748

48-
var isGLDevice = SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLCore;
49+
var gfxTypes = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget);
50+
51+
var isGLDevice = false;
52+
53+
foreach (var type in gfxTypes)
54+
{
55+
if (type == GraphicsDeviceType.OpenGLES3 || type == GraphicsDeviceType.OpenGLCore)
56+
{
57+
isGLDevice = true;
58+
break;
59+
}
60+
}
4961

5062
EditorGUILayout.PropertyField(m_Technique, Styles.Technique);
5163

@@ -89,7 +101,7 @@ public override void OnInspectorGUI()
89101
if (isGLDevice)
90102
{
91103
GUI.enabled = true;
92-
EditorGUILayout.HelpBox("Rendering Layers are not supported on OpenGL.", MessageType.Warning);
104+
EditorGUILayout.HelpBox(Styles.OpenGlSupportWarning);
93105
}
94106
}
95107
}

0 commit comments

Comments
 (0)