Skip to content

Commit 54fa1b5

Browse files
moar cleanup
1 parent dd73f5b commit 54fa1b5

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

examples_tests/49.ComputeFFT/fft_convolve_ifft.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void convolve(in uint item_per_thread_count, in uint ch)
2929

3030
nbl_glsl_complex sourceSpectrum = nbl_glsl_ext_FFT_impl_values[t];
3131

32-
// TODO: do push constants here
32+
//
3333
const uvec3 coords = nbl_glsl_ext_FFT_getCoordinates(tid);
3434
vec2 uv = vec2(bitfieldReverse(coords.xy))/vec2(4294967296.f)+pc.params.kernel_half_pixel_size;
3535
//

examples_tests/49.ComputeFFT/normalization.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void main()
1919
{
2020
nbl_glsl_complex value = nbl_glsl_ext_FFT_storage_t_get(in_data[nbl_glsl_dot(gl_GlobalInvocationID,pc.strides.xyz)]);
2121

22-
const float power = length(nbl_glsl_ext_FFT_storage_t_get(in_data[0]));
22+
const float power = abs(nbl_glsl_ext_FFT_storage_t_get(in_data[0]).x); // imaginary component will be 0
2323

2424
const uvec2 coord = bitfieldReverse(gl_GlobalInvocationID.xy)>>pc.bitreverse_shift.xy;
2525
const nbl_glsl_complex shift = nbl_glsl_expImaginary(-nbl_glsl_PI*float(coord.x+coord.y));

include/nbl/builtin/glsl/ext/FFT/default_compute_fft.comp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ void nbl_glsl_ext_FFT_setData(in uvec3 coordinate, in uint channel, in nbl_glsl_
7171
#define _NBL_GLSL_EXT_FFT_SET_DATA_DEFINED_
7272
#endif
7373

74-
#ifndef _NBL_GLSL_EXT_FFT_GET_PADDED_DATA_DEFINED_
75-
nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(ivec3 coordinate, in uint channel)
74+
bool nbl_glsl_ext_FFT_wrap_coord(inout ivec3 coordinate)
7675
{
7776
const ivec3 dimensions = ivec3(nbl_glsl_ext_FFT_Parameters_t_getDimensions());
7877
const ivec3 max_coord = dimensions-ivec3(1u);
@@ -84,7 +83,7 @@ nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(ivec3 coordinate, in uint channe
8483
{
8584
case _NBL_GLSL_EXT_FFT_PAD_CLAMP_TO_BORDER_:
8685
if (any(bvec3(coordinate!=clamped_coord)))
87-
return nbl_glsl_complex(0,0);
86+
return false;
8887
coordinate = clamped_coord;
8988
break;
9089
case _NBL_GLSL_EXT_FFT_PAD_CLAMP_TO_EDGE_:
@@ -107,7 +106,14 @@ nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(ivec3 coordinate, in uint channe
107106
}
108107
break;
109108
}
109+
return true;
110+
}
110111

112+
#ifndef _NBL_GLSL_EXT_FFT_GET_PADDED_DATA_DEFINED_
113+
nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(ivec3 coordinate, in uint channel)
114+
{
115+
if (!nbl_glsl_ext_FFT_wrap_coord(coordinate))
116+
return nbl_glsl_complex(0.f,0.f);
111117
const uint index = nbl_glsl_dot(uvec4(coordinate,channel),nbl_glsl_ext_FFT_Parameters_t_getInputStrides());
112118
return nbl_glsl_ext_FFT_storage_t_get(inData[index]);
113119
}

include/nbl/ext/FFT/FFT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class FFT final : public core::IReferenceCounted
5050
static inline uint32_t buildParameters(
5151
bool isInverse, uint32_t numChannels, const asset::VkExtent3D& inputDimensions,
5252
Parameters_t* outParams, DispatchInfo_t* outInfos, const asset::ISampler::E_TEXTURE_CLAMP* paddingType,
53-
const asset::VkExtent3D& extraPaddedInputDimensions
53+
const asset::VkExtent3D& extraPaddedInputDimensions, bool realInput = false
5454
)
5555
{
5656
uint32_t passesRequired = 0u;

0 commit comments

Comments
 (0)