Skip to content

Commit 7dd0fdb

Browse files
committed
using "nbl_glsl_complex"
1 parent b3cc63e commit 7dd0fdb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

examples_tests/49.ComputeFFT/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static inline void dispatchHelper_Convolution(
160160
COpenGLExtensionHandler::pGlMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
161161
}
162162
static inline DispatchInfo_t getDispatchInfo_Convolution(
163-
asset::VkExtent3D const & inputDimensions,
163+
asset::VkExtent3D const & paddedDimension,
164164
uint32_t numChannels)
165165
{
166166
DispatchInfo_t ret = {};
@@ -169,7 +169,7 @@ static inline DispatchInfo_t getDispatchInfo_Convolution(
169169
ret.workGroupDims[1] = 1;
170170
ret.workGroupDims[2] = 1;
171171

172-
ret.workGroupCount[0] = core::ceil(float(inputDimensions.width * inputDimensions.height * inputDimensions.depth * numChannels) / ret.workGroupDims[0]);
172+
ret.workGroupCount[0] = core::ceil(float(paddedDimension.width * paddedDimension.height * paddedDimension.depth * numChannels) / ret.workGroupDims[0]);
173173
ret.workGroupCount[1] = 1;
174174
ret.workGroupCount[2] = 1;
175175

include/nbl/builtin/glsl/ext/FFT/fft.glsl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ uint nbl_glsl_ext_FFT_calculateTwiddlePower(in uint threadId, in uint iteration,
9999
return (threadId & suffixMask) << shiftSuffix;
100100
}
101101

102-
vec2 nbl_glsl_ext_FFT_twiddle(in uint threadId, in uint iteration, in uint logTwoN, in uint N)
102+
nbl_glsl_complex nbl_glsl_ext_FFT_twiddle(in uint threadId, in uint iteration, in uint logTwoN, in uint N)
103103
{
104104
uint k = nbl_glsl_ext_FFT_calculateTwiddlePower(threadId, iteration, logTwoN);
105105
return nbl_glsl_expImaginary(-1 * 2 * nbl_glsl_PI * k / N);
106106
}
107107

108-
vec2 nbl_gnbl_glsl_ext_FFT_twiddleInverse(in uint threadId, in uint iteration, in uint logTwoN, in uint N)
108+
nbl_glsl_complex nbl_glsl_ext_FFT_twiddleInverse(in uint threadId, in uint iteration, in uint logTwoN, in uint N)
109109
{
110110
return nbl_glsl_complex_conjugate(nbl_glsl_ext_FFT_twiddle(threadId, iteration, logTwoN, N));
111111
}
@@ -148,8 +148,8 @@ void nbl_glsl_ext_FFT()
148148
uint leadingZeroes = nbl_glsl_ext_FFT_clz(dataLength) + 1u;
149149
uint logTwo = 32u - leadingZeroes;
150150

151-
vec2 current_values[_NBL_GLSL_EXT_FFT_MAX_ITEMS_PER_THREAD];
152-
vec2 shuffled_values[_NBL_GLSL_EXT_FFT_MAX_ITEMS_PER_THREAD];
151+
nbl_glsl_complex current_values[_NBL_GLSL_EXT_FFT_MAX_ITEMS_PER_THREAD];
152+
nbl_glsl_complex shuffled_values[_NBL_GLSL_EXT_FFT_MAX_ITEMS_PER_THREAD];
153153

154154
// Load Initial Values into Local Mem (bit reversed indices)
155155
for(uint t = 0u; t < num_virtual_threads; t++)
@@ -200,18 +200,18 @@ void nbl_glsl_ext_FFT()
200200
for(uint t = 0u; t < num_virtual_threads; t++)
201201
{
202202
uint tid = thread_offset + t * _NBL_GLSL_EXT_FFT_BLOCK_SIZE_X_DEFINED_;
203-
vec2 shuffled_value = shuffled_values[t];
203+
nbl_glsl_complex shuffled_value = shuffled_values[t];
204204

205-
vec2 nbl_glsl_ext_FFT_twiddle = (0u == pc.is_inverse)
205+
nbl_glsl_complex twiddle = (0u == pc.is_inverse)
206206
? nbl_glsl_ext_FFT_twiddle(tid, i, logTwo, dataLength)
207-
: nbl_gnbl_glsl_ext_FFT_twiddleInverse(tid, i, logTwo, dataLength);
207+
: nbl_glsl_ext_FFT_twiddleInverse(tid, i, logTwo, dataLength);
208208

209-
vec2 this_value = current_values[t];
209+
nbl_glsl_complex this_value = current_values[t];
210210

211211
if(0u < uint(tid & mask)) {
212-
current_values[t] = shuffled_value + nbl_glsl_complex_mul(nbl_glsl_ext_FFT_twiddle, this_value);
212+
current_values[t] = shuffled_value + nbl_glsl_complex_mul(twiddle, this_value);
213213
} else {
214-
current_values[t] = this_value + nbl_glsl_complex_mul(nbl_glsl_ext_FFT_twiddle, shuffled_value);
214+
current_values[t] = this_value + nbl_glsl_complex_mul(twiddle, shuffled_value);
215215
}
216216
}
217217
}
@@ -220,7 +220,7 @@ void nbl_glsl_ext_FFT()
220220
{
221221
uint tid = thread_offset + t * _NBL_GLSL_EXT_FFT_BLOCK_SIZE_X_DEFINED_;
222222
uvec3 coords = nbl_glsl_ext_FFT_getCoordinates(tid);
223-
vec2 complex_value = (0u == pc.is_inverse)
223+
nbl_glsl_complex complex_value = (0u == pc.is_inverse)
224224
? current_values[t]
225225
: current_values[t] / dataLength;
226226

0 commit comments

Comments
 (0)