1
1
layout(local_size_x=_NBL_GLSL_WORKGROUP_SIZE_, local_size_y=1, local_size_z=1) in;
2
2
3
- #define _NBL_GLSL_EXT_FFT_GET_PARAMETERS_DEFINED_
4
- #define _NBL_GLSL_EXT_FFT_SET_DATA_DEFINED_
5
- #define _NBL_GLSL_EXT_FFT_GET_PADDED_DATA_DEFINED_
6
- #include "nbl/builtin/glsl/ext/FFT/fft.glsl"
7
-
8
3
// Input Descriptor
9
4
layout(set=0, binding=0) uniform sampler2D inputImage;
5
+ #define _NBL_GLSL_EXT_FFT_INPUT_DESCRIPTOR_DEFINED_
10
6
11
- // output
12
- layout(set=0, binding=1) restrict buffer OutputBuffer
13
- {
14
- nbl_glsl_complex outData[];
15
- };
16
-
17
- // Get/Set Data Function
18
- layout(push_constant) uniform PushConstants
19
- {
20
- nbl_glsl_ext_FFT_Parameters_t params;
21
- } pc;
22
-
23
- nbl_glsl_ext_FFT_Parameters_t nbl_glsl_ext_FFT_getParameters()
24
- {
25
- nbl_glsl_ext_FFT_Parameters_t ret;
26
- ret = pc.params;
27
- return ret;
28
- }
29
-
30
- void nbl_glsl_ext_FFT_setData(in uvec3 coordinate, in uint channel, in nbl_glsl_complex complex_value)
31
- {
32
- uvec3 dimension = nbl_glsl_ext_FFT_Parameters_t_getPaddedDimensions();
33
- uint index = channel * (dimension.x * dimension.y * dimension.z) + coordinate.z * (dimension.x * dimension.y) + coordinate.y * (dimension.x) + coordinate.x;
34
- outData[index] = complex_value;
35
- }
36
-
7
+ #include <nbl/builtin/glsl/math/complex.glsl>
37
8
nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(in uvec3 coordinate, in uint channel)
38
9
{
39
10
ivec2 inputImageSize = textureSize(inputImage, 0);
40
11
vec2 normalizedCoords = (vec2(coordinate.xy) + vec2(0.5f)) / vec2(inputImageSize);
41
12
vec4 texelValue= textureLod(inputImage, normalizedCoords, 0);
42
13
return nbl_glsl_complex(texelValue[channel], 0.0f);
43
14
}
15
+ #define _NBL_GLSL_EXT_FFT_GET_PADDED_DATA_DEFINED_
44
16
45
- void main()
46
- {
47
- const uint numChannels = nbl_glsl_ext_FFT_Parameters_t_getNumChannels();
48
- for(uint ch = 0u; ch < numChannels; ++ch)
49
- {
50
- nbl_glsl_ext_FFT(nbl_glsl_ext_FFT_Parameters_t_getIsInverse(), ch);
51
- }
52
- }
17
+
18
+ #include "nbl/builtin/glsl/ext/FFT/default_compute_fft.comp"
0 commit comments