@@ -83,6 +83,7 @@ inline OptimalFFTParameters optimalFFTParameters(const uint32_t maxWorkgroupSize
83
83
#include "nbl/builtin/hlsl/mpl.hlsl"
84
84
#include "nbl/builtin/hlsl/memory_accessor.hlsl"
85
85
#include "nbl/builtin/hlsl/bit.hlsl"
86
+ #include "nbl/builtin/hlsl/workgroup/fft/accessor_concepts.hlsl"
86
87
87
88
// Caveats
88
89
// - Sin and Cos in HLSL take 32-bit floats. Using this library with 64-bit floats works perfectly fine, but DXC will emit warnings
@@ -276,11 +277,11 @@ struct FFT;
276
277
// - Accessor is a global memory accessor to an array fitting 2 * WorkgroupSize elements of type complex_t<Scalar>, used to get inputs / set outputs of the FFT,
277
278
// that is, one "lo" and one "hi" complex numbers per thread, essentially 4 Scalars per thread. The arrays it accesses with `get` and `set` can optionally be
278
279
// different, if you don't want the FFT to be done in-place.
280
+ // The Accessor MUST provide a typename `Accessor::scalar_t`, and this type MUST be the same as the `Scalar` template parameter of the FFT struct's consteval parameters
279
281
// The Accessor MUST provide the following methods:
280
282
// * void get(uint32_t index, inout complex_t<Scalar> value);
281
283
// * void set(uint32_t index, in complex_t<Scalar> value);
282
284
// * void memoryBarrier();
283
- // You might optionally want to provide a `workgroupExecutionAndMemoryBarrier()` method on it to wait on to be sure the whole FFT pass is done
284
285
285
286
// - SharedMemoryAccessor accesses a workgroup-shared memory array of size `2 * sizeof(Scalar) * WorkgroupSize`.
286
287
// The SharedMemoryAccessor MUST provide the following methods:
@@ -304,7 +305,7 @@ struct FFT<false, fft::ConstevalParameters<1, WorkgroupSizeLog2, Scalar>, device
304
305
}
305
306
306
307
307
- template<typename Accessor, typename SharedMemoryAccessor>
308
+ template<typename Accessor, typename SharedMemoryAccessor NBL_FUNC_REQUIRES (fft::FFTAccessor<Accessor> && fft::FFTSharedMemoryAccessor<SharedMemoryAccessor>)
308
309
static void __call (NBL_REF_ARG (Accessor) accessor, NBL_REF_ARG (SharedMemoryAccessor) sharedmemAccessor)
309
310
{
310
311
NBL_CONSTEXPR_STATIC_INLINE uint16_t WorkgroupSize = consteval_params_t::WorkgroupSize;
@@ -370,7 +371,7 @@ struct FFT<true, fft::ConstevalParameters<1, WorkgroupSizeLog2, Scalar>, device_
370
371
}
371
372
372
373
373
- template<typename Accessor, typename SharedMemoryAccessor>
374
+ template<typename Accessor, typename SharedMemoryAccessor NBL_FUNC_REQUIRES (fft::FFTAccessor<Accessor> && fft::FFTSharedMemoryAccessor<SharedMemoryAccessor>)
374
375
static void __call (NBL_REF_ARG (Accessor) accessor, NBL_REF_ARG (SharedMemoryAccessor) sharedmemAccessor)
375
376
{
376
377
NBL_CONSTEXPR_STATIC_INLINE uint16_t WorkgroupSize = consteval_params_t::WorkgroupSize;
@@ -431,7 +432,7 @@ struct FFT<false, fft::ConstevalParameters<ElementsPerInvocationLog2, WorkgroupS
431
432
using consteval_params_t = fft::ConstevalParameters<ElementsPerInvocationLog2, WorkgroupSizeLog2, Scalar>;
432
433
using small_fft_consteval_params_t = fft::ConstevalParameters<1 , WorkgroupSizeLog2, Scalar>;
433
434
434
- template<typename Accessor, typename SharedMemoryAccessor>
435
+ template<typename Accessor, typename SharedMemoryAccessor NBL_FUNC_REQUIRES (fft::FFTAccessor<Accessor> && fft::FFTSharedMemoryAccessor<SharedMemoryAccessor>)
435
436
static void __call (NBL_REF_ARG (Accessor) accessor, NBL_REF_ARG (SharedMemoryAccessor) sharedmemAccessor)
436
437
{
437
438
NBL_CONSTEXPR_STATIC_INLINE uint16_t WorkgroupSize = consteval_params_t::WorkgroupSize;
@@ -480,7 +481,7 @@ struct FFT<true, fft::ConstevalParameters<ElementsPerInvocationLog2, WorkgroupSi
480
481
using consteval_params_t = fft::ConstevalParameters<ElementsPerInvocationLog2, WorkgroupSizeLog2, Scalar>;
481
482
using small_fft_consteval_params_t = fft::ConstevalParameters<1 , WorkgroupSizeLog2, Scalar>;
482
483
483
- template<typename Accessor, typename SharedMemoryAccessor>
484
+ template<typename Accessor, typename SharedMemoryAccessor NBL_FUNC_REQUIRES (fft::FFTAccessor<Accessor> && fft::FFTSharedMemoryAccessor<SharedMemoryAccessor>)
484
485
static void __call (NBL_REF_ARG (Accessor) accessor, NBL_REF_ARG (SharedMemoryAccessor) sharedmemAccessor)
485
486
{
486
487
NBL_CONSTEXPR_STATIC_INLINE uint16_t WorkgroupSize = consteval_params_t::WorkgroupSize;
0 commit comments