@@ -160,20 +160,6 @@ static inline core::smart_refctd_ptr<video::IGPUPipelineLayout> getPipelineLayou
160
160
161
161
using FFTClass = ext::FFT::FFT;
162
162
163
- static const asset::SPushConstantRange ranges[2 ] =
164
- {
165
- {
166
- ISpecializedShader::ESS_COMPUTE,
167
- 0u ,
168
- sizeof (FFTClass::Parameters_t)
169
- },
170
- {
171
- ISpecializedShader::ESS_COMPUTE,
172
- sizeof (FFTClass::Parameters_t),
173
- sizeof (uint32_t ) * 3
174
- },
175
- };
176
-
177
163
static IGPUDescriptorSetLayout::SBinding bnd[] =
178
164
{
179
165
{
@@ -191,8 +177,9 @@ static inline core::smart_refctd_ptr<video::IGPUPipelineLayout> getPipelineLayou
191
177
nullptr
192
178
},
193
179
};
194
-
195
- core::SRange<const asset::SPushConstantRange> pcRange = {ranges, ranges+2 };
180
+
181
+ using FFTClass = ext::FFT::FFT;
182
+ core::SRange<const asset::SPushConstantRange> pcRange = FFTClass::getDefaultPushConstantRanges ();
196
183
core::SRange<const video::IGPUDescriptorSetLayout::SBinding> bindings = {bnd, bnd+sizeof (bnd)/sizeof (IGPUDescriptorSetLayout::SBinding)};;
197
184
198
185
return driver->createGPUPipelineLayout (
@@ -362,9 +349,7 @@ int main()
362
349
}
363
350
// TODO: re-examine
364
351
const VkExtent3D paddedDim = FFTClass::padDimensionToNextPOT (srcDim);
365
- uint32_t maxPaddedDimensionSize = core::max (core::max (paddedDim.width , paddedDim.height ), paddedDim.depth );
366
- auto fftGPUSpecializedShader_SSBOInput = FFTClass::createShader (driver, FFTClass::DataType::SSBO, maxPaddedDimensionSize);
367
- auto fftGPUSpecializedShader_ImageInput = FFTClass::createShader (driver, FFTClass::DataType::TEXTURE2D, maxPaddedDimensionSize);
352
+ auto fftGPUSpecializedShader_ImageInput = FFTClass::createShader (driver, FFTClass::DataType::TEXTURE2D, paddedDim.width );
368
353
auto fftGPUSpecializedShader_KernelNormalization = [&]() -> auto
369
354
{
370
355
IAssetLoader::SAssetLoadParams lp;
@@ -373,7 +358,6 @@ int main()
373
358
return *stuff->begin ();
374
359
}();
375
360
376
- auto fftPipelineLayout_SSBOInput = FFTClass::getDefaultPipelineLayout (driver, FFTClass::DataType::SSBO);
377
361
auto fftPipelineLayout_ImageInput = FFTClass::getDefaultPipelineLayout (driver, FFTClass::DataType::TEXTURE2D);
378
362
auto fftPipelineLayout_KernelNormalization = [&]() -> auto
379
363
{
@@ -400,18 +384,17 @@ int main()
400
384
);
401
385
}();
402
386
403
- auto fftPipeline_SSBOInput = driver->createGPUComputePipeline (nullptr , core::smart_refctd_ptr (fftPipelineLayout_SSBOInput), std::move (fftGPUSpecializedShader_SSBOInput));
404
387
auto fftPipeline_ImageInput = driver->createGPUComputePipeline (nullptr , core::smart_refctd_ptr (fftPipelineLayout_ImageInput), std::move (fftGPUSpecializedShader_ImageInput));
405
388
auto fftPipeline_KernelNormalization = driver->createGPUComputePipeline (nullptr , core::smart_refctd_ptr (fftPipelineLayout_KernelNormalization), std::move (fftGPUSpecializedShader_KernelNormalization));
406
389
407
390
auto fftDispatchInfo_Horizontal = FFTClass::buildParameters (paddedDim, FFTClass::Direction::X);
408
391
auto fftDispatchInfo_Vertical = FFTClass::buildParameters (paddedDim, FFTClass::Direction::Y);
409
392
410
- auto convolveShader = createShader_Convolution (driver, am, maxPaddedDimensionSize );
393
+ auto convolveShader = createShader_Convolution (driver, am, paddedDim. height );
411
394
auto convolvePipelineLayout = getPipelineLayout_Convolution (driver);
412
395
auto convolvePipeline = driver->createGPUComputePipeline (nullptr , core::smart_refctd_ptr (convolvePipelineLayout), std::move (convolveShader));
413
396
414
- auto lastFFTShader = createShader_LastFFT (driver, am, maxPaddedDimensionSize );
397
+ auto lastFFTShader = createShader_LastFFT (driver, am, paddedDim. width );
415
398
auto lastFFTPipelineLayout = getPipelineLayout_LastFFT (driver);
416
399
auto lastFFTPipeline = driver->createGPUComputePipeline (nullptr , core::smart_refctd_ptr (lastFFTPipelineLayout), std::move (lastFFTShader));
417
400
@@ -452,6 +435,7 @@ int main()
452
435
FFTClass::updateDescriptorSet (driver, fftDescriptorSet_Ker_FFT_X.get (), kerImageView, fftOutputBuffer_0, ISampler::ETC_CLAMP_TO_BORDER);
453
436
454
437
// Ker FFT Y
438
+ auto fftPipelineLayout_SSBOInput = FFTClass::getDefaultPipelineLayout (driver, FFTClass::DataType::SSBO);
455
439
auto fftDescriptorSet_Ker_FFT_Y = driver->createGPUDescriptorSet (core::smart_refctd_ptr<const IGPUDescriptorSetLayout>(fftPipelineLayout_SSBOInput->getDescriptorSetLayout (0u )));
456
440
FFTClass::updateDescriptorSet (driver, fftDescriptorSet_Ker_FFT_Y.get (), fftOutputBuffer_0, fftOutputBuffer_1);
457
441
@@ -502,6 +486,7 @@ int main()
502
486
FFTClass::dispatchHelper (driver, fftDispatchInfo_Horizontal);
503
487
504
488
// Ker Image FFT Y
489
+ auto fftPipeline_SSBOInput = driver->createGPUComputePipeline (nullptr , core::smart_refctd_ptr (fftPipelineLayout_SSBOInput), FFTClass::createShader (driver,FFTClass::DataType::SSBO,paddedDim.height ));
505
490
driver->bindComputePipeline (fftPipeline_SSBOInput.get ());
506
491
driver->bindDescriptorSets (EPBP_COMPUTE, fftPipelineLayout_SSBOInput.get (), 0u , 1u , &fftDescriptorSet_Ker_FFT_Y.get (), nullptr );
507
492
FFTClass::pushConstants (driver, fftPipelineLayout_SSBOInput.get (), paddedDim, paddedDim, FFTClass::Direction::Y, false , srcNumChannels);
@@ -559,7 +544,6 @@ int main()
559
544
driver->bindComputePipeline (lastFFTPipeline.get ());
560
545
driver->bindDescriptorSets (EPBP_COMPUTE, lastFFTPipelineLayout.get (), 0u , 1u , &lastFFTDescriptorSet.get (), nullptr );
561
546
FFTClass::pushConstants (driver, lastFFTPipelineLayout.get (), paddedDim, paddedDim, FFTClass::Direction::X, true , srcNumChannels);
562
- driver->pushConstants (lastFFTPipelineLayout.get (), nbl::video::IGPUSpecializedShader::ESS_COMPUTE, sizeof (FFTClass::Parameters_t), sizeof (uint32_t ) * 3 , &kerDim); // numSrcChannels
563
547
FFTClass::dispatchHelper (driver, fftDispatchInfo_Horizontal);
564
548
565
549
if (false == savedToFile) {
0 commit comments