Add ps5 changes

This commit is contained in:
Wojtek Figat
2021-11-21 19:02:24 +01:00
parent d260681773
commit e8b680c78b
8 changed files with 17 additions and 15 deletions

View File

@@ -37,6 +37,7 @@ private:
#if COMPILE_WITH_DEV_ENV #if COMPILE_WITH_DEV_ENV
void OnShaderReloading(Asset* obj) void OnShaderReloading(Asset* obj)
{ {
if (_psTAA)
_psTAA->ReleaseGPU(); _psTAA->ReleaseGPU();
invalidateResources(); invalidateResources();
} }

View File

@@ -16,6 +16,9 @@
#if defined(PLATFORM_PS4) #if defined(PLATFORM_PS4)
#include "./FlaxPlatforms/PS4/Shaders/PS4Common.hlsl" #include "./FlaxPlatforms/PS4/Shaders/PS4Common.hlsl"
#endif #endif
#if defined(PLATFORM_PS5)
#include "./FlaxPlatforms/PS5/Shaders/PS5Common.hlsl"
#endif
// Feature levels // Feature levels
#define FEATURE_LEVEL_ES2 0 #define FEATURE_LEVEL_ES2 0
@@ -202,14 +205,14 @@ float Luminance(float3 color)
} }
// Samples the unwrapped 3D texture (eg. volume texture of size 16x16x16 would be unwrapped to 256x16) // Samples the unwrapped 3D texture (eg. volume texture of size 16x16x16 would be unwrapped to 256x16)
half4 SampleUnwrappedTexture3D(Texture2D tex, SamplerState s, float3 uvw, float size) float4 SampleUnwrappedTexture3D(Texture2D tex, SamplerState s, float3 uvw, float size)
{ {
float intW = floor(uvw.z * size - 0.5); float intW = floor(uvw.z * size - 0.5);
half fracW = uvw.z * size - 0.5 - intW; half fracW = uvw.z * size - 0.5 - intW;
float u = (uvw.x + intW) / size; float u = (uvw.x + intW) / size;
float v = uvw.y; float v = uvw.y;
half4 rg0 = tex.Sample(s, float2(u, v)); float4 rg0 = tex.Sample(s, float2(u, v));
half4 rg1 = tex.Sample(s, float2(u + 1.0f / size, v)); float4 rg1 = tex.Sample(s, float2(u + 1.0f / size, v));
return lerp(rg0, rg1, fracW); return lerp(rg0, rg1, fracW);
} }

View File

@@ -37,22 +37,22 @@ float4 FastTonemapInvert(float4 c)
return float4(FastTonemapInvert(c.rgb), c.a); return float4(FastTonemapInvert(c.rgb), c.a);
} }
half LinearToSrgbChannel(half linearColor) float LinearToSrgbChannel(float linearColor)
{ {
if (linearColor < 0.00313067) if (linearColor < 0.00313067)
return linearColor * 12.92; return linearColor * 12.92;
return pow(linearColor, (1.0 / 2.4)) * 1.055 - 0.055; return pow(linearColor, (1.0 / 2.4)) * 1.055 - 0.055;
} }
half3 LinearToSrgb(half3 linearColor) float3 LinearToSrgb(float3 linearColor)
{ {
return half3( return float3(
LinearToSrgbChannel(linearColor.r), LinearToSrgbChannel(linearColor.r),
LinearToSrgbChannel(linearColor.g), LinearToSrgbChannel(linearColor.g),
LinearToSrgbChannel(linearColor.b)); LinearToSrgbChannel(linearColor.b));
} }
half3 sRGBToLinear(half3 color) float3 sRGBToLinear(float3 color)
{ {
color = max(6.10352e-5, color); color = max(6.10352e-5, color);
return color > 0.04045 ? pow(color * (1.0 / 1.055) + 0.0521327, 2.4) : color * (1.0 / 12.92); return color > 0.04045 ? pow(color * (1.0 / 1.055) + 0.0521327, 2.4) : color * (1.0 / 12.92);

View File

@@ -1,6 +1,5 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System;
using System.IO; using System.IO;
using Flax.Build; using Flax.Build;
using Flax.Build.NativeCpp; using Flax.Build.NativeCpp;

View File

@@ -232,6 +232,8 @@ namespace Flax.Build
public static bool WithCSharp(NativeCpp.BuildOptions options) public static bool WithCSharp(NativeCpp.BuildOptions options)
{ {
if (options.Platform.Target == TargetPlatform.PS5)
return false; // TODO: mono for ps5
return UseCSharp || options.Target.IsEditor; return UseCSharp || options.Target.IsEditor;
} }
} }

View File

@@ -27,6 +27,7 @@ namespace Flax.Deps.Dependencies
TargetPlatform.XboxOne, TargetPlatform.XboxOne,
TargetPlatform.XboxScarlett, TargetPlatform.XboxScarlett,
TargetPlatform.PS4, TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.Switch, TargetPlatform.Switch,
}; };
default: return new TargetPlatform[0]; default: return new TargetPlatform[0];
@@ -81,6 +82,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.UWP: case TargetPlatform.UWP:
case TargetPlatform.XboxOne: case TargetPlatform.XboxOne:
case TargetPlatform.PS4: case TargetPlatform.PS4:
case TargetPlatform.PS5:
case TargetPlatform.XboxScarlett: case TargetPlatform.XboxScarlett:
case TargetPlatform.Switch: case TargetPlatform.Switch:
{ {

View File

@@ -170,6 +170,7 @@ namespace Flax.Deps.Dependencies
Utilities.DirectoryCopy( Utilities.DirectoryCopy(
Path.Combine(GetBinariesFolder(options, platform), "Data", "freetype"), Path.Combine(GetBinariesFolder(options, platform), "Data", "freetype"),
Path.Combine(root, "builds", "PS5"), false, true); Path.Combine(root, "builds", "PS5"), false, true);
Utilities.ReplaceInFile(Path.Combine(root, "include\\freetype\\config\\ftstdlib.h"), "#define ft_getenv getenv", "char* ft_getenv(const char* n);");
// Build for PS5 // Build for PS5
var solutionPath = Path.Combine(root, "builds", "PS5", "freetype.sln"); var solutionPath = Path.Combine(root, "builds", "PS5", "freetype.sln");

View File

@@ -31,7 +31,6 @@ namespace Flax.Deps.Dependencies
TargetPlatform.Windows, TargetPlatform.Windows,
TargetPlatform.UWP, TargetPlatform.UWP,
TargetPlatform.XboxOne, TargetPlatform.XboxOne,
TargetPlatform.PS4,
TargetPlatform.XboxScarlett, TargetPlatform.XboxScarlett,
TargetPlatform.Switch, TargetPlatform.Switch,
}; };
@@ -573,11 +572,6 @@ namespace Flax.Deps.Dependencies
Utilities.FilesDelete(dstMonoEditorLibs, "*.pdb", true); Utilities.FilesDelete(dstMonoEditorLibs, "*.pdb", true);
break; break;
} }
case TargetPlatform.PS4:
{
// TODO: implement automatic extraction of the package from mono-ps4-binaries
break;
}
case TargetPlatform.XboxOne: case TargetPlatform.XboxOne:
{ {
ConfigureMsvc(options, "v142", "10.0.19041.0", "0x0A00", "_XBOX_ONE=1;DISABLE_JIT;WINAPI_FAMILY=WINAPI_FAMILY_GAMES;HAVE_EXTERN_DEFINED_WINAPI_SUPPORT;CRITICAL_SECTION_NO_DEBUG_INFO=0x01000000"); ConfigureMsvc(options, "v142", "10.0.19041.0", "0x0A00", "_XBOX_ONE=1;DISABLE_JIT;WINAPI_FAMILY=WINAPI_FAMILY_GAMES;HAVE_EXTERN_DEFINED_WINAPI_SUPPORT;CRITICAL_SECTION_NO_DEBUG_INFO=0x01000000");