Skip to content

Commit df814d2

Browse files
got rudimentary scaling working
1 parent 5f9aa40 commit df814d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples_tests/49.ComputeFFT/fft_convolve_ifft.comp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(in uvec3 coordinate, in uint cha
6565
return nbl_glsl_ext_FFT_getData(clamped_coord, channel);
6666
}
6767

68+
6869
void convolve(in uint item_per_thread_count, in uint ch)
6970
{
7071
// TODO: decouple kernel size from image size
@@ -79,8 +80,11 @@ void convolve(in uint item_per_thread_count, in uint ch)
7980
coords = bitfieldReverse(coords)>>(uvec3(32u)-log2_size);
8081

8182
vec2 uv = (vec2(coords.xy))/vec2(uvec2(1u)<<log2_size.xy)+vec2(0.5f)/vec2(textureSize(NormalizedKernel[ch],0));
83+
const float scaling = 0.2;
84+
uv = mix(uv,uv-1.0,greaterThan(uv,vec2(0.5)))*scaling;
8285
//
83-
nbl_glsl_ext_FFT_impl_values[t] = nbl_glsl_complex_mul(nbl_glsl_ext_FFT_impl_values[t],textureLod(NormalizedKernel[ch],uv,0).xy);
86+
nbl_glsl_complex convSpectrum = textureLod(NormalizedKernel[ch],uv,0).xy;
87+
nbl_glsl_ext_FFT_impl_values[t] = nbl_glsl_complex_mul(nbl_glsl_ext_FFT_impl_values[t],convSpectrum);
8488
}
8589
}
8690

0 commit comments

Comments
 (0)