From cc51dc56604763485dfe07e78b8fead5c43737ee Mon Sep 17 00:00:00 2001 From: Jeannette Yu Date: Tue, 27 Apr 2021 10:21:28 -0700 Subject: [PATCH 1/2] Ensure broader support by overriding half into min16float when unified model is enabled --- .../ShaderLibrary/Common.hlsl | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl index 3fd7994b294..477049d43f0 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl @@ -87,6 +87,20 @@ #define REAL_IS_HALF 0 #endif // Do we have half? +#if REAL_IS_HALF || (defined(UNITY_UNIFIED_SHADER_PRECISION_MODEL) && (defined(UNITY_COMPILER_HLSL) || defined(UNITY_COMPILER_DXC))) +#define half min16float +#define half2 min16float2 +#define half3 min16float3 +#define half4 min16float4 +#define half2x2 min16float2x2 +#define half2x3 min16float2x3 +#define half3x2 min16float3x2 +#define half3x3 min16float3x3 +#define half3x4 min16float3x4 +#define half4x3 min16float4x3 +#define half4x4 min16float4x4 +#endif + #if REAL_IS_HALF #define real half #define real2 half2 @@ -102,19 +116,6 @@ #define real4x3 half4x3 #define real4x4 half4x4 -#define half min16float -#define half2 min16float2 -#define half3 min16float3 -#define half4 min16float4 - -#define half2x2 min16float2x2 -#define half2x3 min16float2x3 -#define half3x2 min16float3x2 -#define half3x3 min16float3x3 -#define half3x4 min16float3x4 -#define half4x3 min16float4x3 -#define half4x4 min16float4x4 - #define REAL_MIN HALF_MIN #define REAL_MAX HALF_MAX #define REAL_EPS HALF_EPS From 9307ec9d635492b66fe9da023bf2f19b871b56d9 Mon Sep 17 00:00:00 2001 From: Jeannette Yu Date: Tue, 27 Apr 2021 22:35:32 -0700 Subject: [PATCH 2/2] Changelog --- com.unity.render-pipelines.core/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.core/CHANGELOG.md b/com.unity.render-pipelines.core/CHANGELOG.md index fad9159d4b6..10ec9ad3cdd 100644 --- a/com.unity.render-pipelines.core/CHANGELOG.md +++ b/com.unity.render-pipelines.core/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed normal bias field of reference volume being wrong until the profile UI was displayed. - Fixed L2 for Probe Volumes. - Fixed assertion on compression of L1 coefficients for Probe Volume. +- Explicit half precision not working even when Unified Shader Precision Model is enabled. ### Added - Support for the PlayStation 5 platform has been added.