Skip to content

Commit 4b61fbb

Browse files
robinb-u3dsebastienlagarde
authored andcommitted
Shader abstraction cleanup #3443
1 parent a17116a commit 4b61fbb

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
119119
- Updated the tooltip for the Decal Angle Fade property (requires to enable Decal Layers in both HDRP asset and Frame settings) (case 1308048).
120120
- The RTAO's history is now discarded if the occlusion caster was moving (case 1303418).
121121
- Unifying the history validation pass so that it is only done once for the whole frame and not per effect.
122+
- Tidy up of platform abstraction code for shader optimization.
122123

123124
## [10.3.0] - 2020-12-01
124125

com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
#pragma multi_compile _ ENABLE_MSAA
44

5-
#ifdef SHADER_API_PSSL
6-
# pragma argument( scheduler=minpressure ) // instruct the shader compiler to prefer minimizing vgpr usage
7-
#endif
8-
95
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
106
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
117
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl"
@@ -16,6 +12,10 @@
1612

1713
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
1814

15+
#ifdef SHADER_API_PSSL
16+
#include SHADER_COMPILER_GLOBAL_OPTIMIZE_REGISTER_USAGE
17+
#endif
18+
1919
// #pragma enable_d3d11_debug_symbols
2020

2121
#ifdef ENABLE_MSAA

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313

1414
### Changed
1515
- Changed the "Edit" button so it becomes "New" when no asset is set on a Visual Effect component, in order to save a new visual effect graph asset.
16+
- Tidy up of platform abstraction code for random number generation, requires a dependency on com.unity.render-pipelines.core for those abstractions.
1617

1718
### Fixed
1819
- Forbid incorrect link between incompatible context [Case 1269756](https://issuetracker.unity3d.com/product/unity/issues/guid/1269756/)

com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Required for the correct use of cross platform abstractions.
2+
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
3+
14
//Helper to disable bounding box compute code
25
#define USE_DYNAMIC_AABB 1
36

@@ -267,7 +270,7 @@ uint VFXMul24(uint a, uint b)
267270
#ifndef SHADER_API_PSSL
268271
return (a & 0xffffff) * (b & 0xffffff); // Tmp to ensure correct inputs
269272
#else
270-
return mul24(a, b);
273+
return Mul24(a, b);
271274
#endif
272275
}
273276

@@ -311,7 +314,7 @@ uint Lcg(uint seed)
311314
const uint multiplier = 0x0019660d;
312315
const uint increment = 0x3c6ef35f;
313316
#if RAND_24BITS && defined(SHADER_API_PSSL)
314-
return mad24(multiplier, seed, increment);
317+
return Mad24(multiplier, seed, increment);
315318
#else
316319
return multiplier * seed + increment;
317320
#endif
@@ -321,7 +324,7 @@ float ToFloat01(uint u)
321324
{
322325
#if !RAND_24BITS
323326
return asfloat((u >> 9) | 0x3f800000) - 1.0f;
324-
#else //Using mad24 keeping consitency between platform
327+
#else //Using Mad24 keeping consitency between platform
325328
return asfloat((u & 0x007fffff) | 0x3f800000) - 1.0f;
326329
#endif
327330
}

com.unity.visualeffectgraph/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"particles"
1414
],
1515
"dependencies": {
16-
"com.unity.shadergraph": "11.0.0"
16+
"com.unity.shadergraph": "11.0.0",
17+
"com.unity.render-pipelines.core": "11.0.0"
1718
},
1819
"samples": [
1920
{

0 commit comments

Comments
 (0)