From 4533560b208ddac0b29ddb29b018cf6c086b362e Mon Sep 17 00:00:00 2001 From: HumanlyDev Date: Fri, 27 Nov 2026 06:54:15 +0200 Subject: [PATCH] Revert "fix(gpu): fix ambient solid-angle distance clamp and SRV table binding" --- crates/victory-gpu/src/ambient.rs | 9 +++------ crates/victory-gpu/src/draw.rs | 20 ++++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/crates/victory-gpu/src/ambient.rs b/crates/victory-gpu/src/ambient.rs index 427dd8f..5f821e9 100644 --- a/crates/victory-gpu/src/ambient.rs +++ b/crates/victory-gpu/src/ambient.rs @@ -218,8 +218,7 @@ void place(uint3 at : SV_DispatchThreadID) { float2 size = float2(width, height); float3 p = seen(int2((float2(at.xy) + 0.5) * size / float2(CX, CY)), size); float wz = min(p.z, 50.0); - float3 pc = p * (wz / max(p.z, 1e-6)); - cells[CELLS + 1 + at.y * CX + at.x] = float4(pc, wz * wz); + cells[CELLS + 1 + at.y * CX + at.x] = float4(p, wz * wz); } #endif @@ -465,7 +464,7 @@ pub(crate) struct Views { /// The image the title's program just wrote. pub(crate) image: D3D12_GPU_DESCRIPTOR_HANDLE, /// The scene's depth, for [`Role::Resolve`]. - pub(crate) depth: Option, + pub(crate) depth: D3D12_GPU_DESCRIPTOR_HANDLE, /// The size of the image, the size of the depth texture, and how many slices it has. pub(crate) size: [u32; 2], pub(crate) depth_size: [u32; 2], @@ -523,9 +522,7 @@ pub(crate) fn after(list: &HostList, role: Role, views: &Views) -> bool { uav_barrier(l); l.SetComputeRootSignature(&pass.root); l.SetComputeRoot32BitConstants(0, 16, words.as_ptr().cast(), 0); - if let Some(depth) = views.depth { - l.SetComputeRootDescriptorTable(1, depth); - } + l.SetComputeRootDescriptorTable(1, views.depth); l.SetComputeRootDescriptorTable(2, views.image); l.SetComputeRootUnorderedAccessView(3, pass.cells.GetGPUVirtualAddress()); l.SetComputeRootUnorderedAccessView(4, pass.points.GetGPUVirtualAddress()); diff --git a/crates/victory-gpu/src/draw.rs b/crates/victory-gpu/src/draw.rs index 036ae0e..872eb6c 100644 --- a/crates/victory-gpu/src/draw.rs +++ b/crates/victory-gpu/src/draw.rs @@ -3234,23 +3234,19 @@ impl State { Role::Radiance => RADIANCE, Role::Air => AIR, }; - let Some((of, image)) = entry(ResourceType::Uav, at) else { + let image = entry(ResourceType::Uav, at); + let depth = match role { + Role::Resolve => entry(ResourceType::Srv, DEPTH), + Role::Radiance | Role::Air => image, + }; + let (Some((of, image)), Some((seen, depth))) = (image, depth) else { once!(?role, "no stand-in for the indirect light: other tables"); return false; }; - let (depth, depth_size) = if role == Role::Resolve { - let Some((seen, depth)) = entry(ResourceType::Srv, DEPTH) else { - once!(?role, "no stand-in for the indirect light: other tables"); - return false; - }; - (Some(depth), [seen.Width as u32, seen.Height]) - } else { - (None, [of.Width as u32, of.Height]) - }; // (R32_UINT holding R9G9B9E5; R11G11B10_FLOAT.) let format = if role == Role::Resolve { 42 } else { 26 }; let volume = of.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D; - if of.Format.0 != format || depth_size[0] == 0 || depth_size[1] == 0 || volume != (role == Role::Air) { + if of.Format.0 != format || seen.Width == 0 || seen.Height == 0 || volume != (role == Role::Air) { once!(?role, format = of.Format.0, "no stand-in for the indirect light: another image"); return false; } @@ -3258,7 +3254,7 @@ impl State { image, depth, size: [of.Width as u32, of.Height], - depth_size, + depth_size: [seen.Width as u32, seen.Height], slices: u32::from(of.DepthOrArraySize), }) }