Skip to content

Commit 499cc62

Browse files
Adrian1066Evergreen
authored andcommitted
Fix for shaders to be compliant with HLSL 2021
1 parent 8e6dcb5 commit 499cc62

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/PatchUtil.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace PatchUtil
100100
float2 SphereToSquare(float3 n)
101101
{
102102
n /= (abs(n.x) + abs(n.y) + abs(n.z));
103-
n.xy = n.z >= 0.0 ? n.xy : OctWrap(n.xy);
103+
n.xy = VECTOR_LOGIC_SELECT(n.z >= 0.0, n.xy, OctWrap(n.xy));
104104
n.xy = n.xy * 0.5 + 0.5;
105105
return n.xy;
106106
}
@@ -152,7 +152,7 @@ namespace PatchUtil
152152
uint3 SignedIntegerModulo(int3 x, uint modulus)
153153
{
154154
const uint3 remainder = uint3(abs(x)) % modulus;
155-
return VECTOR_LOGIC_SELECT(x < 0 && remainder != 0, modulus - remainder, remainder);
155+
return VECTOR_LOGIC_SELECT(VECTOR_LOGIC_AND(x < 0, remainder != 0), modulus - remainder, remainder);
156156
}
157157

158158
uint3 ConvertVolumeSpaceToStorageSpace(uint3 posVolSpace, uint spatialResolution, int3 cascadeOffset)

Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/VectorLogic.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#ifndef VECTOR_LOGIC
22
#define VECTOR_LOGIC
33

4-
#if defined(XBOX)
4+
#if defined(SHADER_API_GAMECORE)
55
#define USE_HLSL2021_VECTOR_LOGIC_INTRINSICS
66
#endif
77

88
#if defined(USE_HLSL2021_VECTOR_LOGIC_INTRINSICS)
99

1010
#define VECTOR_LOGIC_AND(x, y) and(x, y)
1111
#define VECTOR_LOGIC_OR(x, y) or(x, y)
12-
#define VECTOR_LOGIC_SELECT(condition, trueValue, falseValue) select(condition, trueValue, falseValue)
12+
#define VECTOR_LOGIC_SELECT(condition, trueValue, falseValue) select((condition), (trueValue), (falseValue))
1313

1414
#else
1515

0 commit comments

Comments
 (0)