"Hidden/ALINE/Surface" shader does not compile for XBox One

ALine version: 1.6.4

“Hidden/ALINE/Surface” shader does not compile for XBox One when building with Unity 2020.3.40f1.

They also do not compile with Unity 2022.1.22f1.

ALine 1.5.3 worked with Unity 2020.3.40f1 but not Unity 2022.1.22f1.

We’ve managed to work around it with:

diff --git a/quantum_unity/Assets/Vendor/ALINE/Resources/aline_surface_mat.shader b/quantum_unity/Assets/Vendor/ALINE/Resources/aline_surface_mat.shader
index 1215ab572c..d31c99ad1c 100644
--- a/quantum_unity/Assets/Vendor/ALINE/Resources/aline_surface_mat.shader
+++ b/quantum_unity/Assets/Vendor/ALINE/Resources/aline_surface_mat.shader
@@ -7,7 +7,6 @@ Shader "Hidden/ALINE/Surface" {
 	}
 
 	HLSLINCLUDE
-	sampler2D _MainTex;
 	float4 _MainTex_ST;
 	float4 _Color;
 	float4 _FadeColor;
@@ -38,6 +37,9 @@ Shader "Hidden/ALINE/Surface" {
 			#define UNITY_HDRP
 			#include "aline_common_surface.cginc"
 
+			TEXTURE2D(_MainTex);
+			SAMPLER(sampler_MainTex);
+			
 			v2f vert (appdata_color v) {
 				return vert_base(v, _Color, _Scale);
 			}
@@ -60,12 +62,15 @@ Shader "Hidden/ALINE/Surface" {
 			#define UNITY_HDRP
 			#include "aline_common_surface.cginc"
 
+			TEXTURE2D(_MainTex);
+			SAMPLER(sampler_MainTex);
+			
 			v2f vert (appdata_color v) {
 				return vert_base(v, _Color * _FadeColor, _Scale);
 			}
 
 			float4 frag (v2f i) : COLOR {
-				return tex2D (_MainTex, i.uv) * i.col;
+				return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv) * i.col;
 			}
 			ENDHLSL
 
@@ -81,12 +86,15 @@ Shader "Hidden/ALINE/Surface" {
 			#define UNITY_HDRP
 			#include "aline_common_surface.cginc"
 
+			TEXTURE2D(_MainTex);
+			SAMPLER(sampler_MainTex);
+		
 			v2f vert (appdata_color v) {
 				return vert_base(v, _Color, _Scale);
 			}
 
 			float4 frag (v2f i) : COLOR {
-				return tex2D (_MainTex, i.uv) * i.col;
+				return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv) * i.col;
 			}
 			ENDHLSL
 		}
@@ -128,12 +136,14 @@ Shader "Hidden/ALINE/Surface" {
 			HLSLPROGRAM
 			#include "aline_common_surface.cginc"
 
+			UNITY_DECLARE_TEX2D(_MainTex);
+			
 			v2f vert (appdata_color v) {
 				return vert_base(v, _Color * _FadeColor, _Scale);
 			}
 
 			float4 frag (v2f i) : COLOR {
-				return tex2D (_MainTex, i.uv) * i.col;
+				return UNITY_SAMPLE_TEX2D_SAMPLER(_MainTex, _MainTex, i.uv) * i.col;
 			}
 			ENDHLSL
 
@@ -148,12 +158,14 @@ Shader "Hidden/ALINE/Surface" {
 			HLSLPROGRAM
 			#include "aline_common_surface.cginc"
 
+			UNITY_DECLARE_TEX2D(_MainTex);
+
 			v2f vert (appdata_color v) {
 				return vert_base(v, _Color, _Scale);
 			}
 
 			float4 frag (v2f i) : COLOR {
-				return tex2D (_MainTex, i.uv) * i.col;
+				return UNITY_SAMPLE_TEX2D_SAMPLER(_MainTex, _MainTex, i.uv) * i.col;
 			}
 			ENDHLSL
 		}
1 Like

Thank you! I’ll include this in the next update.

Just curious. Is there any reason you used separate samplers in some cases but not in others? I made it use the same method for all passes, as I am not aware that this would cause any issues.

I also fixed the text rendering shader, which had the same issue.