diff --git a/data/shader/ddgi/ddgi.hsh b/data/shader/ddgi/ddgi.hsh index 6a2b6eb24..fa471ef67 100644 --- a/data/shader/ddgi/ddgi.hsh +++ b/data/shader/ddgi/ddgi.hsh @@ -63,9 +63,8 @@ layout(std140, set = 2, binding = 27) uniform DDGIBuffer { struct RayHit { #ifndef AE_HALF_FLOAT - vec3 direction; - vec3 radiance; - float hitDistance; + vec4 direction; + vec4 radiance; #else AeF16x4 direction; AeF16x4 radiance; @@ -92,7 +91,7 @@ RayHit UnpackRayHit(PackedRayHit compressed) { hit.direction.z = comn.x; hit.radiance.z = comn.y; - hit.hitDistance = compressed.data.w; + hit.radiance.w = compressed.data.w; #else hit.direction = compressed.direction; hit.radiance = compressed.radiance; @@ -111,7 +110,7 @@ PackedRayHit PackRayHit(RayHit hit) { compressed.data.x = uintBitsToFloat(packHalf2x16(hit.direction.xy)); compressed.data.y = uintBitsToFloat(packHalf2x16(hit.radiance.xy)); compressed.data.z = uintBitsToFloat(packHalf2x16(comn)); - compressed.data.w = hit.hitDistance; + compressed.data.w = hit.radiance.a; #else compressed.direction = hit.direction; compressed.radiance = hit.radiance; diff --git a/data/shader/ddgi/probeUpdate.csh b/data/shader/ddgi/probeUpdate.csh index 32fe30c34..906dfd8bd 100644 --- a/data/shader/ddgi/probeUpdate.csh +++ b/data/shader/ddgi/probeUpdate.csh @@ -197,11 +197,11 @@ void main() { for (uint j = 0; j < loadRayCount; j++) { #if defined(IRRADIANCE) - AeF16 weight = max(0.0hf, dot(N, rayData[j].direction.rgb)); + AeF16 weight = max(AeF16(0.0), dot(N, rayData[j].direction.rgb)); - if (weight >= 0.00001hf) { + if (weight >= AeF16(0.00001)) { AeF16x3 radiance = AeF16x3(rayData[j].radiance); - result += AeF16x4(radiance, 1.0hf) * weight; + result += AeF16x4(radiance, AeF16(1.0)) * weight; } const float probeOffsetDistance = max(ddgiData.cascades[cascadeIndex].cellSize.w * 0.05, 0.5); @@ -224,21 +224,21 @@ void main() { } } #elif defined(RADIANCE) - AeF16 weight = max(0.0hf, dot(N, rayData[j].direction.rgb)); - weight = pow(weight, 256.0hf); + AeF16 weight = max(AeF16(0.0), dot(N, rayData[j].direction.rgb)); + weight = pow(weight, AeF16(256.0)); AeF16x3 radiance = rayData[j].radiance.xyz; if (weight > 0.15) - result += AeF16x4(radiance, 1.0hf) * weight; + result += AeF16x4(radiance, AeF16(1.0)) * weight; #else - AeF16 weight = max(0.0hf, dot(N, rayData[j].direction.xyz)); + AeF16 weight = max(AeF16(0.0), dot(N, rayData[j].direction.xyz)); AeF16 hitDistance = rayData[j].direction.w; weight = pow(weight, depthSharpness); - if (weight >= 0.00000001hf) { - result += AeF16x4(hitDistance, sqr(hitDistance), 0.0hf, 1.0hf) * weight; + if (weight >= AeF16(0.00000001)) { + result += AeF16x4(hitDistance, sqr(hitDistance), AeF16(0.0), AeF16(1.0)) * weight; } #endif } diff --git a/data/shader/ddgi/rayHit.csh b/data/shader/ddgi/rayHit.csh index 794c05929..15a40f6aa 100644 --- a/data/shader/ddgi/rayHit.csh +++ b/data/shader/ddgi/rayHit.csh @@ -57,9 +57,9 @@ void main() { RayHit hit; #ifndef AE_HALF_FLOAT - hit.radiance = radiance; - hit.direction = ray.direction; - hit.hitDistance = ray.hitDistance; + hit.radiance.rgb = radiance; + hit.direction.xyz = ray.direction; + hit.radiance.a = ray.hitDistance; #else hit.radiance = AeF16x4(radiance, ray.hitDistance); hit.direction = AeF16x4(ray.direction, 1.0);