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

This commit is contained in:
Harald Csaszar 2023-07-03 20:55:19 +02:00
parent b210ff5b9e
commit 5635f31053
6 changed files with 20 additions and 11 deletions

View File

@ -1,8 +1,6 @@
#ifndef 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/SpriteLighting.cginc"

View File

@ -1,8 +1,6 @@
#ifndef 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/SpriteLighting.cginc"
#if defined(_ALPHAPREMULTIPLY_ON)

View File

@ -2,16 +2,21 @@
#define SPINE_COMMON_URP_INCLUDED
#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_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
#define IS_URP_12_OR_NEWER 0
#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
#define USE_WRITE_RENDERING_LAYERS

View File

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

View File

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

View File

@ -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.16",
"version": "4.1.17",
"unity": "2019.3",
"author": {
"name": "Esoteric Software",