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

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 Mu1 = (radius * Mu + D) / R1;
if (Mu > 0.0)
{
result = min(Transmittance(radius, Mu) / Transmittance(R1, Mu1), 1.0);
}
else
{
result = min(Transmittance(R1, -Mu1) / Transmittance(radius, -Mu), 1.0);
}
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 a = sqrt(0.5 / H * radius);
float2 A01 = a * float2(Mu, Mu + D / radius);
float2 A01Sign = sign(A01);
float2 A01Sign = (float2)sign(A01);
float2 A01Squared = A01 * A01;
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)));

View File

@@ -232,7 +232,7 @@ float3 SampleDDGIIrradiance(DDGIData data, Texture2D<snorm float4> probesData, T
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
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);
// 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)
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));
}
@@ -307,7 +307,7 @@ void CS_TraceRays(uint3 DispatchThreadId : SV_DispatchThreadID)
else
{
// 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
}

View File

@@ -153,7 +153,7 @@ float4 SampleGlobalSurfaceAtlasTile(const GlobalSurfaceAtlasData data, GlobalSur
bilinearWeights.w = (1 - bilinearWeightsUV.x) * (1 - bilinearWeightsUV.y);
// 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;
float4 depthVisibility = 1.0f;
UNROLL

View File

@@ -330,7 +330,7 @@ float4 PS_Debug(Quad_VS2PS input) : SV_Target
else
{
// 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);
color = lerp(sky, skybox, SkyboxIntensity);
}

View File

@@ -34,7 +34,7 @@ VS2PS VS(Render2DVertex input)
// Render2D::RenderingFeatures::VertexSnapping
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.Color = input.Color;

View File

@@ -34,7 +34,7 @@ META_CB_BEGIN(1, ModelsRasterizeData)
int3 ChunkCoord;
float MaxDistance;
float3 CascadeCoordToPosMul;
int ObjectsCount;
uint ObjectsCount;
float3 CascadeCoordToPosAdd;
int CascadeResolution;
int CascadeIndex;
@@ -91,7 +91,11 @@ float DistanceToModelSDF(float minDistance, ObjectRasterizeData modelData, Textu
BRANCH if (minDistance <= distanceToVolume) return distanceToVolume;
// 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;
#endif
volumeDistance *= volumeScale; // Apply uniform instance scale (non-uniform is not supported)
// 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);
// 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);
#endif
bool isHole = (heightmapValue.b + heightmapValue.a) >= 1.9f;
if (isHole || any(heightfieldUV < 0.0f) || any(heightfieldUV > 1.0f))
continue;
@@ -198,7 +206,7 @@ Texture3D<float> GlobalSDFTex : register(t0);
float SampleSDF(uint3 voxelCoordMip, int3 offset)
{
// 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;
float result = GlobalSDFTex[voxelCoordMip].r;

View File

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

View File

@@ -199,11 +199,11 @@ float4 PS_ResolvePass(Quad_VS2PS input) : SV_Target0
{
float2 offsetUV = Offsets[i] * SSRtexelSize;
offsetUV = mul(offsetRotationMatrix, offsetUV);
float4 sample = Texture0.SampleLevel(SamplerLinearClamp, uv + offsetUV, 0);
float4 value = Texture0.SampleLevel(SamplerLinearClamp, uv + offsetUV, 0);
#if SSR_REDUCE_HIGHLIGHTS
sample.rgb /= 1 + Luminance(sample.rgb);
value.rgb /= 1 + Luminance(value.rgb);
#endif
result += sample;
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]
- CSMFilterWeights[row + FS_2][col + FS_2] * fc.x)
+ 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]));
s.y += fc.y * (v1[0].x * (CSMFilterWeights[row + FS_2][col + FS_2]
- 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
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;
history = ClipToAABB(history, neighborhoodMin - aabbMargin, neighborhoodMax + aabbMargin);
//history = clamp(history, neighborhoodMin, neighborhoodMax);