// Compute Mip-Chain Generator for Dual Paraboloid Rgba16Float hemispheres. // Downsamples mip N -> mip N+1 with a 9-tap tent filter so rough surfaces sample soft reflections. @group(0) @binding(0) var src_tex: texture_2d; @group(0) @binding(1) var src_samp: sampler; @group(0) @binding(2) var dst_tex: texture_storage_2d; @compute @workgroup_size(8, 8, 1) fn main(@builtin(global_invocation_id) gid: vec3) { let dst_dims = textureDimensions(dst_tex); if (gid.x >= dst_dims.x || gid.y >= dst_dims.y) { return; } let uv = (vec2(gid.xy) + 0.5) / vec2(dst_dims); let step = 1.25 / vec2(dst_dims); var acc = textureSampleLevel(src_tex, src_samp, uv, 0.0) * 4.0; acc += textureSampleLevel(src_tex, src_samp, uv + vec2(-step.x, 0.0), 0.0) * 2.0; acc += textureSampleLevel(src_tex, src_samp, uv + vec2( step.x, 0.0), 0.0) * 2.0; acc += textureSampleLevel(src_tex, src_samp, uv + vec2(0.0, -step.y), 0.0) * 2.0; acc += textureSampleLevel(src_tex, src_samp, uv + vec2(0.0, step.y), 0.0) * 2.0; acc += textureSampleLevel(src_tex, src_samp, uv + vec2(-step.x, -step.y), 0.0); acc += textureSampleLevel(src_tex, src_samp, uv + vec2( step.x, -step.y), 0.0); acc += textureSampleLevel(src_tex, src_samp, uv + vec2(-step.x, step.y), 0.0); acc += textureSampleLevel(src_tex, src_samp, uv + vec2( step.x, step.y), 0.0); textureStore(dst_tex, vec2(gid.xy), acc / 16.0); }