Skip to content

Commit 238074c

Browse files
forgotten file
1 parent 5c53659 commit 238074c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
layout(local_size_x=_NBL_GLSL_WORKGROUP_SIZE_, local_size_y=1, local_size_z=1) in;
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+
// Input Descriptor
9+
layout(set=0, binding=0) uniform sampler2D inputImage;
10+
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+
37+
nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(in uvec3 coordinate, in uint channel)
38+
{
39+
ivec2 inputImageSize = textureSize(inputImage, 0);
40+
vec2 normalizedCoords = (vec2(coordinate.xy) + vec2(0.5f)) / vec2(inputImageSize);
41+
vec4 texelValue= textureLod(inputImage, normalizedCoords, 0);
42+
return nbl_glsl_complex(texelValue[channel], 0.0f);
43+
}
44+
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+
}

0 commit comments

Comments
 (0)