From 2605ea64fe7ea898d3e04460a376ac09f394c12d Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 9 Feb 2021 16:24:44 +0000 Subject: [PATCH] Cleanup some of the abstractions we are using. --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/Lighting/Shadow/ContactShadows.compute | 8 ++++---- com.unity.visualeffectgraph/CHANGELOG.md | 1 + com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl | 9 ++++++--- com.unity.visualeffectgraph/package.json | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 332e851013b..9260fbeb7f3 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Change Assets/Create/Rendering/Diffusion Profile to Assets/Create/Rendering/HDRP Diffusion Profile - Change Assets/Create/Rendering/C# Custom Pass to Assets/Create/Rendering/HDRP C# Custom Pass - Change Assets/Create/Rendering/C# Post Process Volume to Assets/Create/Rendering/HDRP C# Post Process Volume +- Tidy up of platform abstraction code for shader optimization. ## [11.0.0] - 2020-10-21 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute index b9190c95c2e..e65e34f8d04 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute @@ -2,10 +2,6 @@ #pragma multi_compile _ ENABLE_MSAA -#ifdef SHADER_API_PSSL -# pragma argument( scheduler=minpressure ) // instruct the shader compiler to prefer minimizing vgpr usage -#endif - #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" @@ -16,6 +12,10 @@ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch +#ifdef SHADER_API_PSSL +#include SHADER_COMPILER_GLOBAL_OPTIMIZE_REGISTER_USAGE +#endif + // #pragma enable_d3d11_debug_symbols #ifdef ENABLE_MSAA diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 9ccccd3380c..a3e905159e1 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Move Assets/Create/Visual Effects/Visual Effect Defaults to Assets/Create/VFX/VFX Defaults - Move Assets/Create/Visual Effects/Visual Effect Subgraph Operator to Assets/Create/VFX/VFX Subgraph Operator - Move Assets/Create/Visual Effects/Visual Effect Subgraph Block to Assets/Create/VFX/VFX Subgraph Block +- Tidy up of platform abstraction code for random number generation, requires a dependency on com.unity.render-pipelines.core for those abstractions. ## [11.0.0] - 2020-10-21 diff --git a/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl b/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl index ebef01f8256..6a276e2ae08 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl +++ b/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl @@ -1,3 +1,6 @@ +// Required for the correct use of cross platform abstractions. +#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + //Helper to disable bounding box compute code #define USE_DYNAMIC_AABB 1 @@ -267,7 +270,7 @@ uint VFXMul24(uint a, uint b) #ifndef SHADER_API_PSSL return (a & 0xffffff) * (b & 0xffffff); // Tmp to ensure correct inputs #else - return mul24(a, b); + return Mul24(a, b); #endif } @@ -311,7 +314,7 @@ uint Lcg(uint seed) const uint multiplier = 0x0019660d; const uint increment = 0x3c6ef35f; #if RAND_24BITS && defined(SHADER_API_PSSL) - return mad24(multiplier, seed, increment); + return Mad24(multiplier, seed, increment); #else return multiplier * seed + increment; #endif @@ -321,7 +324,7 @@ float ToFloat01(uint u) { #if !RAND_24BITS return asfloat((u >> 9) | 0x3f800000) - 1.0f; -#else //Using mad24 keeping consitency between platform +#else //Using Mad24 keeping consitency between platform return asfloat((u & 0x007fffff) | 0x3f800000) - 1.0f; #endif } diff --git a/com.unity.visualeffectgraph/package.json b/com.unity.visualeffectgraph/package.json index 0dfc8f396db..eab2365fce3 100644 --- a/com.unity.visualeffectgraph/package.json +++ b/com.unity.visualeffectgraph/package.json @@ -13,7 +13,8 @@ "particles" ], "dependencies": { - "com.unity.shadergraph": "12.0.0" + "com.unity.shadergraph": "12.0.0", + "com.unity.render-pipelines.core": "12.0.0" }, "samples": [ {