Update consoles building

This commit is contained in:
Wojtek Figat
2023-02-05 23:48:11 +01:00
parent ac45bbe53e
commit c878c613c7
27 changed files with 51 additions and 43 deletions

BIN
Content/Shaders/GI/DDGI.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/GI/GlobalSurfaceAtlas.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/GUI.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Shaders/ProbesFilter.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/SSR.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/TAA.flax (Stored with Git LFS)

Binary file not shown.

View File

@@ -354,7 +354,7 @@ bool CookAssetsStep::Process(CookingData& data, CacheData& cache, Asset* asset)
if (asset->WaitForLoaded()) if (asset->WaitForLoaded())
{ {
LOG(Error, "Failed to load asset \'{0}\'", asset->ToString()); LOG(Error, "Failed to load asset \'{0}\'", asset->ToString());
return false; return true;
} }
// Switch based on an asset type // Switch based on an asset type
@@ -1132,7 +1132,10 @@ bool CookAssetsStep::Perform(CookingData& data)
// Cook asset // Cook asset
if (Process(data, cache, assetRef.Get())) if (Process(data, cache, assetRef.Get()))
{
cache.Save();
return true; return true;
}
data.Stats.CookedAssets++; data.Stats.CookedAssets++;
// Auto save build cache after every few cooked assets (reduces next build time if cooking fails later) // Auto save build cache after every few cooked assets (reduces next build time if cooking fails later)

View File

@@ -428,6 +428,7 @@ void GPUContextDX11::Dispatch(GPUShaderProgramCS* shader, uint32 threadGroupCoun
void GPUContextDX11::DispatchIndirect(GPUShaderProgramCS* shader, GPUBuffer* bufferForArgs, uint32 offsetForArgs) void GPUContextDX11::DispatchIndirect(GPUShaderProgramCS* shader, GPUBuffer* bufferForArgs, uint32 offsetForArgs)
{ {
ASSERT(bufferForArgs && EnumHasAnyFlags(bufferForArgs->GetFlags(), GPUBufferFlags::Argument));
CurrentCS = (GPUShaderProgramCSDX11*)shader; CurrentCS = (GPUShaderProgramCSDX11*)shader;
auto bufferForArgsDX11 = (GPUBufferDX11*)bufferForArgs; auto bufferForArgsDX11 = (GPUBufferDX11*)bufferForArgs;

View File

@@ -111,7 +111,7 @@ bool GPUBufferDX12::OnInit()
if (useUAV) if (useUAV)
resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
#if PLATFORM_XBOX_SCARLETT || PLATFORM_XBOX_ONE #if PLATFORM_XBOX_SCARLETT || PLATFORM_XBOX_ONE
if (_desc.Flags & GPUBufferFlags::Argument) if (EnumHasAnyFlags(_desc.Flags, GPUBufferFlags::Argument))
resourceDesc.Flags |= D3D12XBOX_RESOURCE_FLAG_ALLOW_INDIRECT_BUFFER; resourceDesc.Flags |= D3D12XBOX_RESOURCE_FLAG_ALLOW_INDIRECT_BUFFER;
#endif #endif

View File

@@ -152,7 +152,7 @@ void SceneRendering::AddActor(Actor* a, int32& key)
listener->OnSceneRenderingAddActor(a); listener->OnSceneRenderingAddActor(a);
} }
void SceneRendering::UpdateActor(Actor* a, int32 key) void SceneRendering::UpdateActor(Actor* a, int32& key)
{ {
const int32 category = a->_drawCategory; const int32 category = a->_drawCategory;
ScopeLock lock(Locker); ScopeLock lock(Locker);

View File

@@ -123,7 +123,7 @@ public:
public: public:
void AddActor(Actor* a, int32& key); void AddActor(Actor* a, int32& key);
void UpdateActor(Actor* a, int32 key); void UpdateActor(Actor* a, int32& key);
void RemoveActor(Actor* a, int32& key); void RemoveActor(Actor* a, int32& key);
FORCE_INLINE void AddPostFxProvider(IPostFxSettingsProvider* obj) FORCE_INLINE void AddPostFxProvider(IPostFxSettingsProvider* obj)

View File

@@ -320,7 +320,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
auto positionOffset = emitter->Graph.GetPositionAttributeOffset(); auto positionOffset = emitter->Graph.GetPositionAttributeOffset();
if (positionOffset == -1 || buffer->CPU.Count < 2 || buffer->CPU.RibbonOrder.IsEmpty()) if (positionOffset == -1 || buffer->CPU.Count < 2 || buffer->CPU.RibbonOrder.IsEmpty())
break; break;
int32 count = buffer->CPU.Count; uint32 count = buffer->CPU.Count;
ASSERT(buffer->CPU.RibbonOrder.Count() == emitter->Graph.RibbonRenderingModules.Count() * buffer->Capacity); ASSERT(buffer->CPU.RibbonOrder.Count() == emitter->Graph.RibbonRenderingModules.Count() * buffer->Capacity);
int32* ribbonOrderData = buffer->CPU.RibbonOrder.Get() + module->RibbonOrderOffset; int32* ribbonOrderData = buffer->CPU.RibbonOrder.Get() + module->RibbonOrderOffset;
ParticleBufferCPUDataAccessor<Float3> positionData(buffer, emitter->Graph.Layout.GetAttributeOffset(module->Attributes[0])); ParticleBufferCPUDataAccessor<Float3> positionData(buffer, emitter->Graph.Layout.GetAttributeOffset(module->Attributes[0]));

View File

@@ -64,7 +64,7 @@ PACK_STRUCT(struct ModelsRasterizeData
Int3 ChunkCoord; Int3 ChunkCoord;
float MaxDistance; float MaxDistance;
Float3 CascadeCoordToPosMul; Float3 CascadeCoordToPosMul;
int32 ObjectsCount; uint32 ObjectsCount;
Float3 CascadeCoordToPosAdd; Float3 CascadeCoordToPosAdd;
int32 CascadeResolution; int32 CascadeResolution;
int32 CascadeIndex; int32 CascadeIndex;

View File

@@ -198,7 +198,7 @@ void PostProcessingPass::Render(RenderContext& renderContext, GPUTexture* input,
if (checkIfSkipPass() || !(useBloom || useToneMapping || useCameraArtifacts)) if (checkIfSkipPass() || !(useBloom || useToneMapping || useCameraArtifacts))
{ {
// Resources are missing. Do not perform rendering. Just copy raw frame // Resources are missing. Do not perform rendering. Just copy raw frame
context->SetViewportAndScissors(output->Width(), output->Height()); context->SetViewportAndScissors((float)output->Width(), (float)output->Height());
context->SetRenderTarget(*output); context->SetRenderTarget(*output);
context->Draw(input); context->Draw(input);
return; return;

View File

@@ -73,7 +73,7 @@ PACK_STRUCT(struct Data
{ {
Float2 Dummy0; Float2 Dummy0;
int32 CubeFace; int32 CubeFace;
int32 SourceMipIndex; float SourceMipIndex;
}); });
namespace ProbesRendererImpl namespace ProbesRendererImpl
@@ -515,8 +515,8 @@ void ProbesRenderer::OnRender(RenderTask* task, GPUContext* context)
auto cb = shader->GetCB(0); auto cb = shader->GetCB(0);
for (int32 mipIndex = 1; mipIndex < mipLevels; mipIndex++) for (int32 mipIndex = 1; mipIndex < mipLevels; mipIndex++)
{ {
int32 mipSize = 1 << (mipLevels - mipIndex - 1); const int32 mipSize = 1 << (mipLevels - mipIndex - 1);
data.SourceMipIndex = mipIndex - 1; data.SourceMipIndex = (float)mipIndex - 1.0f;
context->SetViewportAndScissors((float)mipSize, (float)mipSize); context->SetViewportAndScissors((float)mipSize, (float)mipSize);
for (int32 faceIndex = 0; faceIndex < 6; faceIndex++) for (int32 faceIndex = 0; faceIndex < 6; faceIndex++)
{ {

View File

@@ -220,13 +220,9 @@ float3 TransmittanceWithDistance(float radius, float Mu, float D)
float R1 = sqrt(radius * radius + D * D + 2.0 * radius * Mu * D); float R1 = sqrt(radius * radius + D * D + 2.0 * radius * Mu * D);
float Mu1 = (radius * Mu + D) / R1; float Mu1 = (radius * Mu + D) / R1;
if (Mu > 0.0) if (Mu > 0.0)
{
result = min(Transmittance(radius, Mu) / Transmittance(R1, Mu1), 1.0); result = min(Transmittance(radius, Mu) / Transmittance(R1, Mu1), 1.0);
}
else else
{
result = min(Transmittance(R1, -Mu1) / Transmittance(radius, -Mu), 1.0); result = min(Transmittance(R1, -Mu1) / Transmittance(radius, -Mu), 1.0);
}
return result; return result;
} }
@@ -249,7 +245,7 @@ float OpticalDepthWithDistance(float H, float radius, float Mu, float D)
float particleDensity = 6.2831; // REK 04, Table 2 float particleDensity = 6.2831; // REK 04, Table 2
float a = sqrt(0.5 / H * radius); float a = sqrt(0.5 / H * radius);
float2 A01 = a * float2(Mu, Mu + D / radius); float2 A01 = a * float2(Mu, Mu + D / radius);
float2 A01Sign = sign(A01); float2 A01Sign = (float2)sign(A01);
float2 A01Squared = A01 * A01; float2 A01Squared = A01 * A01;
float x = A01Sign.y > A01Sign.x ? exp(A01Squared.x) : 0.0; float x = A01Sign.y > A01Sign.x ? exp(A01Squared.x) : 0.0;
float2 y = A01Sign / (2.3193 * abs(A01) + sqrt(1.52 * A01Squared + 4.0)) * float2(1.0, exp(-D / H * (D / (2.0 * radius) + Mu))); float2 y = A01Sign / (2.3193 * abs(A01) + sqrt(1.52 * A01Squared + 4.0)) * float2(1.0, exp(-D / H * (D / (2.0 * radius) + Mu)));

View File

@@ -232,7 +232,7 @@ float3 SampleDDGIIrradiance(DDGIData data, Texture2D<snorm float4> probesData, T
weight *= Square(weight) * (1.0f / (minWeightThreshold * minWeightThreshold)); weight *= Square(weight) * (1.0f / (minWeightThreshold * minWeightThreshold));
// Calculate trilinear weights based on the distance to each probe to smoothly transition between grid of 8 probes // Calculate trilinear weights based on the distance to each probe to smoothly transition between grid of 8 probes
float3 trilinear = lerp(1.0f - biasAlpha, biasAlpha, probeCoordsOffset); float3 trilinear = lerp(1.0f - biasAlpha, biasAlpha, (float3)probeCoordsOffset);
weight *= max(trilinear.x * trilinear.y * trilinear.z, 0.001f); weight *= max(trilinear.x * trilinear.y * trilinear.z, 0.001f);
// Sample irradiance texture // Sample irradiance texture

View File

@@ -54,7 +54,7 @@ float3 GetSphericalFibonacci(float sampleIndex, float samplesCount)
// Calculates a random normalized ray direction (based on the ray index and the current probes rotation phrase) // Calculates a random normalized ray direction (based on the ray index and the current probes rotation phrase)
float3 GetProbeRayDirection(DDGIData data, uint rayIndex) float3 GetProbeRayDirection(DDGIData data, uint rayIndex)
{ {
float3 direction = GetSphericalFibonacci(rayIndex, data.RaysCount); float3 direction = GetSphericalFibonacci((float)rayIndex, (float)data.RaysCount);
return normalize(QuaternionRotate(data.RaysRotation, direction)); return normalize(QuaternionRotate(data.RaysRotation, direction));
} }
@@ -307,7 +307,7 @@ void CS_TraceRays(uint3 DispatchThreadId : SV_DispatchThreadID)
else else
{ {
// Ray hits sky // Ray hits sky
radiance.rgb = Skybox.SampleLevel(SamplerLinearClamp, probeRayDirection, 0); radiance.rgb = Skybox.SampleLevel(SamplerLinearClamp, probeRayDirection, 0).rgb;
radiance.a = 1e27f; // Sky is the limit radiance.a = 1e27f; // Sky is the limit
} }

View File

@@ -153,7 +153,7 @@ float4 SampleGlobalSurfaceAtlasTile(const GlobalSurfaceAtlasData data, GlobalSur
bilinearWeights.w = (1 - bilinearWeightsUV.x) * (1 - bilinearWeightsUV.y); bilinearWeights.w = (1 - bilinearWeightsUV.x) * (1 - bilinearWeightsUV.y);
// Tile depth weight based on sample position occlusion // Tile depth weight based on sample position occlusion
float4 tileZ = depth.Gather(SamplerLinearClamp, atlasUV, 0.0f); float4 tileZ = depth.Gather(SamplerLinearClamp, atlasUV);
float depthThreshold = 2.0f * surfaceThreshold / tile.ViewBoundsSize.z; float depthThreshold = 2.0f * surfaceThreshold / tile.ViewBoundsSize.z;
float4 depthVisibility = 1.0f; float4 depthVisibility = 1.0f;
UNROLL UNROLL

View File

@@ -330,7 +330,7 @@ float4 PS_Debug(Quad_VS2PS input) : SV_Target
else else
{ {
// Sample skybox // Sample skybox
float3 skybox = Skybox.SampleLevel(SamplerLinearClamp, viewRay, 0); float3 skybox = Skybox.SampleLevel(SamplerLinearClamp, viewRay, 0).rgb;
float3 sky = float3(0.4f, 0.4f, 1.0f) * saturate(hit.StepsCount / 80.0f); float3 sky = float3(0.4f, 0.4f, 1.0f) * saturate(hit.StepsCount / 80.0f);
color = lerp(sky, skybox, SkyboxIntensity); color = lerp(sky, skybox, SkyboxIntensity);
} }

View File

@@ -34,7 +34,7 @@ VS2PS VS(Render2DVertex input)
// Render2D::RenderingFeatures::VertexSnapping // Render2D::RenderingFeatures::VertexSnapping
if ((int)input.CustomDataAndClipOrigin.y & 1) if ((int)input.CustomDataAndClipOrigin.y & 1)
input.Position = (int2)input.Position; input.Position = (float2)(int2)input.Position;
output.Position = mul(float4(input.Position, 0, 1), ViewProjection); output.Position = mul(float4(input.Position, 0, 1), ViewProjection);
output.Color = input.Color; output.Color = input.Color;

View File

@@ -34,7 +34,7 @@ META_CB_BEGIN(1, ModelsRasterizeData)
int3 ChunkCoord; int3 ChunkCoord;
float MaxDistance; float MaxDistance;
float3 CascadeCoordToPosMul; float3 CascadeCoordToPosMul;
int ObjectsCount; uint ObjectsCount;
float3 CascadeCoordToPosAdd; float3 CascadeCoordToPosAdd;
int CascadeResolution; int CascadeResolution;
int CascadeIndex; int CascadeIndex;
@@ -91,7 +91,11 @@ float DistanceToModelSDF(float minDistance, ObjectRasterizeData modelData, Textu
BRANCH if (minDistance <= distanceToVolume) return distanceToVolume; BRANCH if (minDistance <= distanceToVolume) return distanceToVolume;
// Sample SDF // Sample SDF
#if defined(PLATFORM_PS4) || defined(PLATFORM_PS5)
float volumeDistance = 0; // TODO: fix shader compilation error
#else
float volumeDistance = modelSDFTex.SampleLevel(SamplerLinearClamp, volumeUV, modelData.MipOffset).x * modelData.DecodeMul + modelData.DecodeAdd; float volumeDistance = modelSDFTex.SampleLevel(SamplerLinearClamp, volumeUV, modelData.MipOffset).x * modelData.DecodeMul + modelData.DecodeAdd;
#endif
volumeDistance *= volumeScale; // Apply uniform instance scale (non-uniform is not supported) volumeDistance *= volumeScale; // Apply uniform instance scale (non-uniform is not supported)
// Combine distance to the volume with distance to the surface inside the model // Combine distance to the volume with distance to the surface inside the model
@@ -153,7 +157,11 @@ void CS_RasterizeHeightfield(uint3 DispatchThreadId : SV_DispatchThreadID)
float2 heightfieldUV = float2(volumeUV.x, volumeUV.z); float2 heightfieldUV = float2(volumeUV.x, volumeUV.z);
// Sample the heightfield // Sample the heightfield
#if defined(PLATFORM_PS4) || defined(PLATFORM_PS5)
float4 heightmapValue = 0; // TODO: fix shader compilation error
#else
float4 heightmapValue = ObjectsTextures[i].SampleLevel(SamplerLinearClamp, heightfieldUV, objectData.MipOffset); float4 heightmapValue = ObjectsTextures[i].SampleLevel(SamplerLinearClamp, heightfieldUV, objectData.MipOffset);
#endif
bool isHole = (heightmapValue.b + heightmapValue.a) >= 1.9f; bool isHole = (heightmapValue.b + heightmapValue.a) >= 1.9f;
if (isHole || any(heightfieldUV < 0.0f) || any(heightfieldUV > 1.0f)) if (isHole || any(heightfieldUV < 0.0f) || any(heightfieldUV > 1.0f))
continue; continue;
@@ -198,7 +206,7 @@ Texture3D<float> GlobalSDFTex : register(t0);
float SampleSDF(uint3 voxelCoordMip, int3 offset) float SampleSDF(uint3 voxelCoordMip, int3 offset)
{ {
// Sample SDF // Sample SDF
voxelCoordMip = (uint3)clamp((int3)voxelCoordMip * GenerateMipCoordScale + offset, 0, GenerateMipTexResolution - 1); voxelCoordMip = (uint3)clamp((int3)(voxelCoordMip * GenerateMipCoordScale) + offset, int3(0, 0, 0), (int3)(GenerateMipTexResolution - 1));
voxelCoordMip.x += GenerateMipTexOffsetX; voxelCoordMip.x += GenerateMipTexOffsetX;
float result = GlobalSDFTex[voxelCoordMip].r; float result = GlobalSDFTex[voxelCoordMip].r;

View File

@@ -8,7 +8,7 @@
META_CB_BEGIN(0, Data) META_CB_BEGIN(0, Data)
float2 Dummy0; float2 Dummy0;
int CubeFace; int CubeFace;
int SourceMipIndex; float SourceMipIndex;
META_CB_END META_CB_END
TextureCube Cube : register(t0); TextureCube Cube : register(t0);

View File

@@ -199,11 +199,11 @@ float4 PS_ResolvePass(Quad_VS2PS input) : SV_Target0
{ {
float2 offsetUV = Offsets[i] * SSRtexelSize; float2 offsetUV = Offsets[i] * SSRtexelSize;
offsetUV = mul(offsetRotationMatrix, offsetUV); offsetUV = mul(offsetRotationMatrix, offsetUV);
float4 sample = Texture0.SampleLevel(SamplerLinearClamp, uv + offsetUV, 0); float4 value = Texture0.SampleLevel(SamplerLinearClamp, uv + offsetUV, 0);
#if SSR_REDUCE_HIGHLIGHTS #if SSR_REDUCE_HIGHLIGHTS
sample.rgb /= 1 + Luminance(sample.rgb); value.rgb /= 1 + Luminance(value.rgb);
#endif #endif
result += sample; result += value;
} }
// Calculate final result value // Calculate final result value

View File

@@ -145,7 +145,7 @@ float SampleShadowMapFixedSizePCF(Texture2DArray shadowMap, float2 shadowMapSize
s.x += (1.0f - fc.y) * (v1[0].w * (CSMFilterWeights[row + FS_2][col + FS_2] s.x += (1.0f - fc.y) * (v1[0].w * (CSMFilterWeights[row + FS_2][col + FS_2]
- CSMFilterWeights[row + FS_2][col + FS_2] * fc.x) - CSMFilterWeights[row + FS_2][col + FS_2] * fc.x)
+ v1[0].z * (fc.x * (CSMFilterWeights[row + FS_2][col + FS_2] + v1[0].z * (fc.x * (CSMFilterWeights[row + FS_2][col + FS_2]
- CSMFilterWeights[row + FS_2][col + FS_2 + 1.0f]) - CSMFilterWeights[row + FS_2][col + FS_2 + 1])
+ CSMFilterWeights[row + FS_2][col + FS_2 + 1])); + CSMFilterWeights[row + FS_2][col + FS_2 + 1]));
s.y += fc.y * (v1[0].x * (CSMFilterWeights[row + FS_2][col + FS_2] s.y += fc.y * (v1[0].x * (CSMFilterWeights[row + FS_2][col + FS_2]
- CSMFilterWeights[row + FS_2][col + FS_2] * fc.x) - CSMFilterWeights[row + FS_2][col + FS_2] * fc.x)

View File

@@ -69,7 +69,7 @@ float4 PS(Quad_VS2PS input) : SV_Target0
// Sample history by clamp it to the nearby colors range to reduce artifacts // Sample history by clamp it to the nearby colors range to reduce artifacts
float4 history = SAMPLE_RT_LINEAR(InputHistory, prevUV); float4 history = SAMPLE_RT_LINEAR(InputHistory, prevUV);
float lumaOffset = abs(Luminance(neighborhoodAvg) - Luminance(current)); float lumaOffset = abs(Luminance(neighborhoodAvg.rgb) - Luminance(current.rgb));
float aabbMargin = lerp(4.0, 0.25, saturate(velocityLength * 100.0)) * lumaOffset; float aabbMargin = lerp(4.0, 0.25, saturate(velocityLength * 100.0)) * lumaOffset;
history = ClipToAABB(history, neighborhoodMin - aabbMargin, neighborhoodMax + aabbMargin); history = ClipToAABB(history, neighborhoodMin - aabbMargin, neighborhoodMax + aabbMargin);
//history = clamp(history, neighborhoodMin, neighborhoodMax); //history = clamp(history, neighborhoodMin, neighborhoodMax);