فهرست منبع

[unity] URP shaders: Fixed more compile errors with old URP versions.

Harald Csaszar 2 سال پیش
والد
کامیت
1fe8f95e27

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

@@ -3,21 +3,37 @@
 
 #ifdef USE_FORWARD_PLUS
 #define IS_URP_14_OR_NEWER 1
+#define IS_URP_12_OR_NEWER 1
 #else
 #define IS_URP_14_OR_NEWER 0
+    #ifdef UNIVERSAL_REALTIME_LIGHTS_INCLUDED
+    #define IS_URP_12_OR_NEWER 1
+    #else
+    #define IS_URP_12_OR_NEWER 0
+    #endif
 #endif
 
 #if defined(_WRITE_RENDERING_LAYERS) && IS_URP_14_OR_NEWER
 #define USE_WRITE_RENDERING_LAYERS
 #endif
 
-#ifdef _LIGHT_LAYERS
+#if defined(_LIGHT_LAYERS) && IS_URP_12_OR_NEWER
+#define USE_LIGHT_LAYERS
+#endif
+
+#if defined(_LIGHT_COOKIES) && IS_URP_12_OR_NEWER
+#define USE_LIGHT_COOKIES
+#endif
+
+#ifdef USE_LIGHT_LAYERS
 uint GetMeshRenderingLayerBackwardsCompatible()
 {
     #if IS_URP_14_OR_NEWER
     return GetMeshRenderingLayer();
-    #else
+    #elif IS_URP_12_OR_NEWER
     return GetMeshRenderingLightLayer();
+    #else
+    return 0;
     #endif
 }
 #else

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

@@ -46,7 +46,7 @@ struct VertexOutput {
 half3 ProcessLight(float3 positionWS, half3 normalWS, uint meshRenderingLayers, int lightIndex)
 {
 	Light light = GetAdditionalLight(lightIndex, positionWS);
-#ifdef _LIGHT_LAYERS
+#ifdef USE_LIGHT_LAYERS
 	if (!IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
 		return half3(0, 0, 0);
 #endif

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

@@ -109,7 +109,7 @@ half3 ProcessLightPBRSimplified(InputData inputData, BRDFData brdfData, half4 sh
 #else
 	Light light = GetAdditionalLight(lightIndex, inputData.positionWS);
 #endif
-#ifdef _LIGHT_LAYERS
+#ifdef USE_LIGHT_LAYERS
 	if (!IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
 		return half3(0, 0, 0);
 #endif
@@ -136,7 +136,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
 #else
 	Light mainLight = GetMainLight();
 #endif
-#if defined(_LIGHT_COOKIES)
+#if defined(USE_LIGHT_COOKIES)
 	half3 cookieColor = SampleMainLightCookie(inputData.positionWS);
 	mainLight.color *= cookieColor;
 #endif
@@ -187,7 +187,7 @@ half3 ProcessLightLambert(InputData inputData, half4 shadowMask, uint meshRender
 	Light light = GetAdditionalLight(lightIndex, inputData.positionWS);
 #endif
 
-#ifdef _LIGHT_LAYERS
+#ifdef USE_LIGHT_LAYERS
 	if (!IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
 		return half3(0, 0, 0);
 #endif
@@ -215,7 +215,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
 #else
 	Light mainLight = GetMainLight();
 #endif
-#if defined(_LIGHT_COOKIES)
+#if defined(USE_LIGHT_COOKIES)
 	half3 cookieColor = SampleMainLightCookie(inputData.positionWS);
 	mainLight.color *= cookieColor;
 #endif

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

@@ -2,7 +2,7 @@
   "name": "com.esotericsoftware.spine.urp-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)",
-  "version": "4.1.14",
+  "version": "4.1.15",
   "unity": "2019.3",
   "author": {
     "name": "Esoteric Software",