Przeglądaj źródła

[unity] Fixed URP shaders compile error on Unity 2023.1. Closes #2311.

Harald Csaszar 2 lat temu
rodzic
commit
5635f31053

+ 0 - 2
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-NormalsPass-URP-2D.hlsl

@@ -1,8 +1,6 @@
 #ifndef SPRITE_NORMALS_PASS_URP_INCLUDED
 #ifndef SPRITE_NORMALS_PASS_URP_INCLUDED
 #define SPRITE_NORMALS_PASS_URP_INCLUDED
 #define SPRITE_NORMALS_PASS_URP_INCLUDED
 
 
-#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
-
 #include "../Include/SpineCoreShaders/ShaderShared.cginc"
 #include "../Include/SpineCoreShaders/ShaderShared.cginc"
 #include "../Include/SpineCoreShaders/SpriteLighting.cginc"
 #include "../Include/SpineCoreShaders/SpriteLighting.cginc"
 
 

+ 0 - 2
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-StandardPass-URP-2D.hlsl

@@ -1,8 +1,6 @@
 #ifndef SPRITE_STANDARD_PASS_URP_INCLUDED
 #ifndef SPRITE_STANDARD_PASS_URP_INCLUDED
 #define SPRITE_STANDARD_PASS_URP_INCLUDED
 #define SPRITE_STANDARD_PASS_URP_INCLUDED
 
 
-#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
-
 #include "../Include/SpineCoreShaders/ShaderShared.cginc"
 #include "../Include/SpineCoreShaders/ShaderShared.cginc"
 #include "../Include/SpineCoreShaders/SpriteLighting.cginc"
 #include "../Include/SpineCoreShaders/SpriteLighting.cginc"
 #if defined(_ALPHAPREMULTIPLY_ON)
 #if defined(_ALPHAPREMULTIPLY_ON)

+ 10 - 5
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Common-URP.hlsl

@@ -2,16 +2,21 @@
 #define SPINE_COMMON_URP_INCLUDED
 #define SPINE_COMMON_URP_INCLUDED
 
 
 #ifdef USE_FORWARD_PLUS
 #ifdef USE_FORWARD_PLUS
-#define IS_URP_14_OR_NEWER 1
-#define IS_URP_12_OR_NEWER 1
+    #define IS_URP_14_OR_NEWER 1
+    #define IS_URP_12_OR_NEWER 1
 #else
 #else
-#define IS_URP_14_OR_NEWER 0
+    #define IS_URP_14_OR_NEWER 0
     #ifdef UNIVERSAL_REALTIME_LIGHTS_INCLUDED
     #ifdef UNIVERSAL_REALTIME_LIGHTS_INCLUDED
-    #define IS_URP_12_OR_NEWER 1
+        #define IS_URP_12_OR_NEWER 1
     #else
     #else
-    #define IS_URP_12_OR_NEWER 0
+        #define IS_URP_12_OR_NEWER 0
     #endif
     #endif
 #endif
 #endif
+#if IS_URP_14_OR_NEWER && !defined(_USE_WEBGL1_LIGHTS)
+    #define IS_URP_15_OR_NEWER 1
+#else
+    #define IS_URP_15_OR_NEWER 0
+#endif
 
 
 #if defined(_WRITE_RENDERING_LAYERS) && IS_URP_14_OR_NEWER
 #if defined(_WRITE_RENDERING_LAYERS) && IS_URP_14_OR_NEWER
 #define USE_WRITE_RENDERING_LAYERS
 #define USE_WRITE_RENDERING_LAYERS

+ 4 - 0
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-SkeletonLit-ForwardPass-URP.hlsl

@@ -150,7 +150,11 @@ VertexOutput vert(appdata v) {
 
 
 	// Note: ambient light is also handled via SH.
 	// Note: ambient light is also handled via SH.
 	half3 vertexSH;
 	half3 vertexSH;
+#if IS_URP_15_OR_NEWER
+	OUTPUT_SH(positionWS, normalWS.xyz, GetWorldSpaceNormalizeViewDir(positionWS), vertexSH);
+#else
 	OUTPUT_SH(normalWS.xyz, vertexSH);
 	OUTPUT_SH(normalWS.xyz, vertexSH);
+#endif
 	color.rgb += SAMPLE_GI(v.lightmapUV, vertexSH, normalWS);
 	color.rgb += SAMPLE_GI(v.lightmapUV, vertexSH, normalWS);
 	o.color = color;
 	o.color = color;
 
 

+ 4 - 0
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-ForwardPass-URP.hlsl

@@ -311,7 +311,11 @@ VertexOutputLWRP ForwardPassVertexSprite(VertexInput input)
 	output.fogFactorAndVertexLight.x = fogFactor;
 	output.fogFactorAndVertexLight.x = fogFactor;
 #endif
 #endif
 
 
+#if IS_URP_15_OR_NEWER
+	OUTPUT_SH(positionWS, normalWS.xyz, GetWorldSpaceNormalizeViewDir(positionWS), output.vertexSH);
+#else
 	OUTPUT_SH(normalWS.xyz, output.vertexSH);
 	OUTPUT_SH(normalWS.xyz, output.vertexSH);
+#endif
 	return output;
 	return output;
 }
 }
 
 

+ 1 - 1
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json

@@ -2,7 +2,7 @@
   "name": "com.esotericsoftware.spine.urp-shaders",
   "name": "com.esotericsoftware.spine.urp-shaders",
   "displayName": "Spine Universal RP Shaders",
   "displayName": "Spine Universal RP Shaders",
   "description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
   "description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
-  "version": "4.1.16",
+  "version": "4.1.17",
   "unity": "2019.3",
   "unity": "2019.3",
   "author": {
   "author": {
     "name": "Esoteric Software",
     "name": "Esoteric Software",