Skip to content

Commit

Permalink
Adds support for the PlayStation 5 platform (Unity-Technologies#3151)
Browse files Browse the repository at this point in the history
* Adding support for PS5 platform.

* Updating CHANGELOGs with PS5 support addition.

* Fix PS5 not being in the buildtarget enum for all versions of Unity that PPV2 supports.

* Remove old code that is nolonger needed.

* The optimizer will take the standard Min3 and Max3 functions and produce optimal results so we don't need this anymore.

* filter for xbone addded (Unity-Technologies#3116)

* Updated the PS5 CHANGELOG entries to be for the correct version.

* Formatting fixup

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
Co-authored-by: Martin Thorzen <35328557+martint-unity@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 19, 2021
1 parent f77f7df commit ba1336f
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 34 deletions.
1 change: 1 addition & 0 deletions Tools/check-shader-includes-exclusions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
com.unity.render-pipelines.xboxone/ShaderLibrary/API/XBoxOne.hlsl
com.unity.render-pipelines.ps4/ShaderLibrary/API/PSSL.hlsl
com.unity.render-pipelines.ps5/ShaderLibrary/API/PSSL.hlsl
3 changes: 3 additions & 0 deletions com.unity.postprocessing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Fix FXAA when running on render-targets without alpha channel: force using green channel as luminance

### Added
- Support for the PlayStation 5 platform has been added.

### Changed
- ResetProjection isn't being called anymore if Temporal Anti-aliasing isn't enabled, allowing the use of custom projection matrices.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static bool isTargetingConsoles
{
var t = EditorUserBuildSettings.activeBuildTarget;
return t == BuildTarget.PS4
#if UNITY_PS5
|| t == BuildTarget.PS5
#endif
|| t == BuildTarget.XboxOne
|| t == BuildTarget.Switch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Camera camera
stereoRenderingMode = StereoRenderingMode.MultiPass;
#endif

#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_PS4
#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_PS4 || UNITY_PS5
if (xrDesc.dimension == TextureDimension.Tex2DArray)
stereoRenderingMode = StereoRenderingMode.SinglePassInstanced;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#define UNITY_REVERSED_Z 1
#define UNITY_GATHER_SUPPORTED (SHADER_TARGET >= 50)
#define UNITY_CAN_READ_POSITION_IN_FRAGMENT_PROGRAM 1
#define INTRINSIC_MINMAX3
#define Min3 min3
#define Max3 max3

#define TEXTURE2D_SAMPLER2D(textureName, samplerName) Texture2D textureName; SamplerState samplerName
#define TEXTURE3D_SAMPLER3D(textureName, samplerName) Texture3D textureName; SamplerState samplerName
Expand Down Expand Up @@ -43,7 +40,7 @@
#define UNITY_LOOP [loop]
#define UNITY_FASTOPT [fastopt]

#define CBUFFER_START(name) ConstantBuffer name {
#define CBUFFER_START(name) cbuffer name {
#define CBUFFER_END };

#if UNITY_GATHER_SUPPORTED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,8 @@ float4 FragReproject(VaryingsDefault i) : SV_Target
_MainTex.SampleLevel(sampler_MainTex, UnityStereoTransformScreenSpaceTex(i.texcoord + float2( k.x, k.y)), 0)
);

// PS4 INTRINSIC_MINMAX3
#if SHADER_API_PSSL
float4 minimum = min3(min3(min3(min3(top[0], top[1], top[2]), top[3], bottom[0]), bottom[1], bottom[2]), bottom[3], color);
float4 maximum = max3(max3(max3(max3(top[0], top[1], top[2]), top[3], bottom[0]), bottom[1], bottom[2]), bottom[3], color);
#else
float4 minimum = min(min(min(min(min(min(min(min(top[0], top[1]), top[2]), top[3]), bottom[0]), bottom[1]), bottom[2]), bottom[3]), color);
float4 maximum = max(max(max(max(max(max(max(max(top[0], top[1]), top[2]), top[3]), bottom[0]), bottom[1]), bottom[2]), bottom[3]), color);
#endif
float4 minimum = min(min(min(min(min(min(min(min(top[0], top[1]), top[2]), top[3]), bottom[0]), bottom[1]), bottom[2]), bottom[3]), color);
float4 maximum = max(max(max(max(max(max(max(max(top[0], top[1]), top[2]), top[3]), bottom[0]), bottom[1]), bottom[2]), bottom[3]), color);

float4 history = _History.SampleLevel(sampler_History, UnityStereoTransformScreenSpaceTex(uv), 0);
history = clamp(history, minimum, maximum);
Expand Down
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
Version Updated
The version number for this package has increased due to a version update of a related graphics package.

### Added
- Support for the PlayStation 5 platform has been added.

## [11.0.0] - 2020-10-21

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static bool useTexArray
case GraphicsDeviceType.Direct3D11:
case GraphicsDeviceType.Direct3D12:
case GraphicsDeviceType.PlayStation4:
case GraphicsDeviceType.PlayStation5:
case GraphicsDeviceType.Vulkan:
return true;

Expand Down
4 changes: 3 additions & 1 deletion com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@
// Include language header
#if defined(SHADER_API_XBOXONE)
#include "Packages/com.unity.render-pipelines.xboxone/ShaderLibrary/API/XBoxOne.hlsl"
#elif defined(SHADER_API_PSSL)
#elif defined(SHADER_API_PS4)
#include "Packages/com.unity.render-pipelines.ps4/ShaderLibrary/API/PSSL.hlsl"
#elif defined(SHADER_API_PS5)
#include "Packages/com.unity.render-pipelines.ps5/ShaderLibrary/API/PSSL.hlsl"
#elif defined(SHADER_API_D3D11)
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl"
#elif defined(SHADER_API_METAL)
Expand Down
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [12.0.0] - 2021-01-11

### Added
- Added support for the PlayStation 5 platform.

### Fixed
- Fixed GC allocations from XR occlusion mesh when using multipass.
- Fixed XR depth copy when using MSAA.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Building your Project for consoles

To build a Project for the **PlayStation 4** or **Xbox One**, you need to install an additional package for each platform you want to support. The packages for each platform are:
To build a Project for the **PlayStation 4**, **PlayStation 5** or **Xbox One**, you need to install an additional package for each platform you want to support. The packages for each platform are:

- **PlayStation 4**: com.unity.render-pipelines.ps4
- **PlayStation 5**: com.unity.render-pipelines.ps5
- **Xbox One**: com.unity.render-pipelines.xboxone

## Platform package installation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ internal DebugDisplaySettings()
s_RenderingFullScreenDebugStrings = s_RenderingFullScreenDebugStrings.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.VertexDensity).ToArray();
s_RenderingFullScreenDebugValues = s_RenderingFullScreenDebugValues.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.VertexDensity).ToArray();
}
if (device == GraphicsDeviceType.Metal || device == GraphicsDeviceType.PlayStation4)
if (device == GraphicsDeviceType.Metal || device == GraphicsDeviceType.PlayStation4 || device == GraphicsDeviceType.PlayStation5)
{
s_RenderingFullScreenDebugStrings = s_RenderingFullScreenDebugStrings.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.QuadOverdraw).ToArray();
s_RenderingFullScreenDebugValues = s_RenderingFullScreenDebugValues.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.QuadOverdraw).ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/TextureXR.hlsl"

#ifdef SHADER_API_PSSL
#ifndef Texture2DMS
#define Texture2DMS MS_Texture2D
#endif

#ifndef SampleCmpLevelZero
#define SampleCmpLevelZero SampleCmpLOD0
#endif

#ifndef firstbithigh
#define firstbithigh FirstSetBit_Hi
#endif
#endif

#ifdef MSAA_ENABLED
TEXTURE2D_X_MSAA(float, g_depth_tex) : register( t0 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ static bool NeedTemporarySubsurfaceBuffer()
// Most modern GPUs support it. We can avoid performing a costly copy in this case.
// TODO: test/implement for other platforms.
return (SystemInfo.graphicsDeviceType != GraphicsDeviceType.PlayStation4 &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.PlayStation5 &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.XboxOne &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.XboxOneD3D12);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ PrepassOutput RenderPrepass(RenderGraph renderGraph,

// Only on consoles is safe to read and write from/to the depth atlas
bool mip1FromDownsampleForLowResTrans = SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation5 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOneD3D12;
mip1FromDownsampleForLowResTrans = mip1FromDownsampleForLowResTrans && hdCamera.frameSettings.IsEnabled(FrameSettingsField.LowResTransparent);
Expand Down Expand Up @@ -803,6 +804,7 @@ void RenderDBuffer(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle dec
}

bool canReadBoundDepthBuffer = SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation5 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOneD3D12;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ internal static bool IsSupportedGraphicDevice(GraphicsDeviceType graphicDevice)
return (graphicDevice == GraphicsDeviceType.Direct3D11 ||
graphicDevice == GraphicsDeviceType.Direct3D12 ||
graphicDevice == GraphicsDeviceType.PlayStation4 ||
graphicDevice == GraphicsDeviceType.PlayStation5 ||
graphicDevice == GraphicsDeviceType.XboxOne ||
graphicDevice == GraphicsDeviceType.XboxOneD3D12 ||
graphicDevice == GraphicsDeviceType.Metal ||
Expand All @@ -735,6 +736,7 @@ internal static bool IsSupportedBuildTarget(UnityEditor.BuildTarget buildTarget)
buildTarget == UnityEditor.BuildTarget.WSAPlayer ||
buildTarget == UnityEditor.BuildTarget.XboxOne ||
buildTarget == UnityEditor.BuildTarget.PS4 ||
buildTarget == UnityEditor.BuildTarget.PS5 ||
// buildTarget == UnityEditor.BuildTarget.iOS || // IOS isn't supported
// buildTarget == UnityEditor.BuildTarget.Switch || // Switch isn't supported
buildTarget == UnityEditor.BuildTarget.CloudRendering);
Expand Down
4 changes: 3 additions & 1 deletion com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [12.0.0] - 2021-01-11

### Added
- Added support for the PlayStation 5 platform.

### Fixed
- Fixed an issue where objects in motion might jitter when the Pixel Perfect Camera is used. [case 1300474](https://issuetracker.unity3d.com/issues/urp-characters-sprite-repeats-in-the-build-when-using-pixel-perfect-camera-and-2d-renderer)
- Fixed an issue where the letter box/pillar box areas were not properly cleared when the Pixel Perfect Camera is used. [case 1291224](https://issuetracker.unity3d.com/issues/pixel-perfect-image-artifact-appear-between-the-reference-resolution-and-screen-resolution-borders-when-strech-fill-is-enabled)
Expand All @@ -16,7 +19,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [11.0.0] - 2020-10-21
### Added
- Added real-time Point Light Shadows.
- Added support for custom additional (i.e punctual) light shadow resolutions.
- Added a supported MSAA samples count check, so the actual supported MSAA samples count value can be assigned to RenderTexture descriptors.
- Added the TerrainCompatible SubShader Tag. Use this Tag in your custom shader to tell Unity that the shader is compatible with the Terrain system.
- Added _CameraSortingLayerTexture global shader variable and related parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Building your Project for consoles

To build a Project for the **PlayStation 4** or **Xbox One**, you need to install an additional package for each platform you want to support. The packages for each platform are:
To build a Project for the **PlayStation 4**, **PlayStation 5** or **Xbox One**, you need to install an additional package for each platform you want to support. The packages for each platform are:

- **PlayStation 4**: com.unity.render-pipelines.ps4
- **PlayStation 5**: com.unity.render-pipelines.ps5
- **Xbox One**: com.unity.render-pipelines.xboxone

## Platform package installation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal static bool useStructuredBuffer
//GraphicsDeviceType deviceType = SystemInfo.graphicsDeviceType;
//return !Application.isMobilePlatform &&
// (deviceType == GraphicsDeviceType.Metal || deviceType == GraphicsDeviceType.Vulkan ||
// deviceType == GraphicsDeviceType.PlayStation4 || deviceType == GraphicsDeviceType.XboxOne);
// deviceType == GraphicsDeviceType.PlayStation4 || deviceType == GraphicsDeviceType.PlayStation5 || deviceType == GraphicsDeviceType.XboxOne);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This Project Template uses the following features:

This Template utilizes the High Definition Render Pipeline.

The High-Definition Render Pipeline prioritizes stunning, high-fidelity visuals and is intended for high-end hardware: GPU-compute-capable consoles, and PC hardware (DX11 and above, Xbox One, PS4, Metal (macOS),
The High-Definition Render Pipeline prioritizes stunning, high-fidelity visuals and is intended for high-end hardware: GPU-compute-capable consoles, and PC hardware (DX11 and above, Xbox One, PS4, PS5, Metal (macOS),
and Vulkan (PC)).

Because this Template was created to deliver great visuals the render pipeline asset, project, lighting, and post-processing settings have been tuned with a high-end experience in mind. This makes it a great starting point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ static IEnumerable GraphicsJobsValidBuildTargets
yield return new TestCaseData(BuildTarget.iOS);
yield return new TestCaseData(BuildTarget.Lumin);
yield return new TestCaseData(BuildTarget.PS4);
yield return new TestCaseData(BuildTarget.PS5);
yield return new TestCaseData(BuildTarget.Stadia);
yield return new TestCaseData(BuildTarget.StandaloneLinux64);
yield return new TestCaseData(BuildTarget.StandaloneOSX);
Expand All @@ -43,6 +44,7 @@ private static bool GraphicsJobsEnabledByDefault(BuildTarget buildTarget)
case BuildTarget.WebGL:
return false;
case BuildTarget.PS4:
case BuildTarget.PS5:
case BuildTarget.Stadia:
case BuildTarget.StandaloneLinux64:
case BuildTarget.StandaloneWindows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ static IEnumerable GraphicsJobsValidBuildTargets
yield return new TestCaseData(BuildTarget.iOS);
yield return new TestCaseData(BuildTarget.Lumin);
yield return new TestCaseData(BuildTarget.PS4);
yield return new TestCaseData(BuildTarget.PS5);
yield return new TestCaseData(BuildTarget.Stadia);
yield return new TestCaseData(BuildTarget.StandaloneLinux64);
yield return new TestCaseData(BuildTarget.StandaloneOSX);
Expand All @@ -43,6 +44,7 @@ private static bool GraphicsJobsEnabledByDefault(BuildTarget buildTarget)
case BuildTarget.WebGL:
return false;
case BuildTarget.PS4:
case BuildTarget.PS5:
case BuildTarget.Stadia:
case BuildTarget.StandaloneLinux64:
case BuildTarget.StandaloneWindows:
Expand Down

0 comments on commit ba1336f

Please sign in to comment.