Skip to content

Commit d0ac89e

Browse files
TudorJudemeta-codesync[bot]
authored andcommitted
Fix URP shader compiler warnings and update occlusion macros
Summary: Shaders throw several warning as of Unity 6.3.10. This diff addresses these warnings. Guard REQUIRES_WORLD_SPACE_POS_INTERPOLATOR macro redefinition with #ifndef Zero-initialize v2f struct to suppress uninitialized variable warnings Pass .xyz to META_DEPTH_INITIALIZE_VERTEX_OUTPUT to avoid implicit float4-to-float3 truncation Replace deprecated META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS_NAME with META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS Reviewed By: kyrylokuzyk-m Differential Revision: D95209385 fbshipit-source-id: 97f31b699fce3a7cd8405d7a4f1ad1edc1875956
1 parent 8109e96 commit d0ac89e

File tree

9 files changed

+14
-9
lines changed

9 files changed

+14
-9
lines changed

DepthAPI-URP/Assets/DepthAPISample/Shaders/DepthUnlit.shader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Shader "Depth/Unlit"
8484

8585
// 5. World position is required to calculate the occlusions.
8686
// This macro will calculate and set world position value in the output Varyings structure.
87-
META_DEPTH_INITIALIZE_VERTEX_OUTPUT(output, input.vertex);
87+
META_DEPTH_INITIALIZE_VERTEX_OUTPUT(output, input.vertex.xyz);
8888

8989
// 6. Passes stereo information to frag shader
9090
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);

Packages/com.meta.xr.depthapi.urp/Shaders/OcclusionCutoutURP.shader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ Shader "Meta/EnvironmentDepth/URP/OcclusionCutoutURP"
7171
float _EnvironmentDepthBias;
7272

7373
v2f vert (appdata v) {
74-
v2f o;
74+
v2f o = (v2f)0;
7575

7676
UNITY_SETUP_INSTANCE_ID(v);
7777
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
7878
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
7979
o.vertex = TransformObjectToHClip(v.vertex.xyz);
8080

81-
META_DEPTH_INITIALIZE_VERTEX_OUTPUT(o, v.vertex);
81+
META_DEPTH_INITIALIZE_VERTEX_OUTPUT(o, v.vertex.xyz);
8282

8383
return o;
8484
}

Packages/com.meta.xr.depthapi.urp/Shaders/StandardShaders/BakedLitForwardPass.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void BakedLitForwardPassFragment(
175175
finalColor.a = OutputAlpha(finalColor.a, _Surface);
176176

177177
#if defined(HARD_OCCLUSION) || defined(SOFT_OCCLUSION)
178-
META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS_NAME(input, positionWS, finalColor, _EnvironmentDepthBias);
178+
META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS(input.positionWS, finalColor, _EnvironmentDepthBias);
179179
#endif
180180

181181
outColor = finalColor;

Packages/com.meta.xr.depthapi.urp/Shaders/StandardShaders/LitForwardPass.hlsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#endif
88

99
#if defined(HARD_OCCLUSION) || defined(SOFT_OCCLUSION)
10-
#define REQUIRES_WORLD_SPACE_POS_INTERPOLATOR 1
10+
#ifndef REQUIRES_WORLD_SPACE_POS_INTERPOLATOR
11+
#define REQUIRES_WORLD_SPACE_POS_INTERPOLATOR 1
12+
#endif
1113
#endif
1214

1315
#include "Packages/com.meta.xr.sdk.core/Shaders/EnvironmentDepth/URP/EnvironmentOcclusionURP.hlsl"

Packages/com.meta.xr.depthapi.urp/Shaders/StandardShaders/ParticlesUnlitForwardPass.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ half4 fragParticleUnlit(VaryingsParticle input) : SV_Target
152152
finalColor.rgb = MixFog(finalColor.rgb, inputData.fogCoord);
153153
finalColor.a = OutputAlpha(finalColor.a, IsSurfaceTypeTransparent(_Surface));
154154

155-
META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS_NAME(input, positionWS, finalColor, _EnvironmentDepthBias);
155+
META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS(input.positionWS, finalColor, _EnvironmentDepthBias);
156156

157157
return finalColor;
158158
}

Packages/com.meta.xr.depthapi.urp/Shaders/StandardShaders/UnlitForwardPass.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void UnlitPassFragment(
162162
finalColor.a = OutputAlpha(finalColor.a, IsSurfaceTypeTransparent(_Surface));
163163

164164
#if defined(HARD_OCCLUSION) || defined(SOFT_OCCLUSION)
165-
META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS_NAME(input, positionWS, finalColor, _EnvironmentDepthBias);
165+
META_DEPTH_OCCLUDE_OUTPUT_PREMULTIPLY_WORLDPOS(input.positionWS, finalColor, _EnvironmentDepthBias);
166166
#endif
167167

168168

Packages/com.meta.xr.depthapi.urp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.meta.xr.depthapi.urp",
33
"displayName": "Depth API URP support",
44
"description": "Package with URP specific details",
5-
"version": "77.0.0",
5+
"version": "85.0.0",
66
"unity": "2022.3",
77
"unityRelease": "1f1"
88
}

Packages/com.meta.xr.depthapi/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 85.0.0
2+
* Fix shader compilation warnings in Unity 6000.x
3+
14
# 77.0.0
25
* Add support for Unity 6.1's URP 17.1
36

Packages/com.meta.xr.depthapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.meta.xr.depthapi",
33
"displayName": "Depth API",
44
"description": "This project gives useful tools to use with Depth API",
5-
"version": "77.0.0",
5+
"version": "85.0.0",
66
"unity": "2022.3",
77
"unityRelease": "1f1"
88
}

0 commit comments

Comments
 (0)