Skip to content

Commit 3ed273c

Browse files
committed
Changed Global Accessors to follow templated gettter/setters
1 parent f4f5aef commit 3ed273c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

28_FFTBloom/app_resources/fft_common.hlsl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ struct PreloadedAccessorCommonBase
4141

4242
struct PreloadedAccessorBase : PreloadedAccessorCommonBase
4343
{
44-
void set(uint32_t idx, complex_t<scalar_t> value)
44+
template <typename IndexType, typename AccessType>
45+
void set(IndexType idx, AccessType value)
4546
{
4647
preloaded[idx >> WorkgroupSizeLog2] = value;
4748
}
4849

49-
void get(uint32_t idx, NBL_REF_ARG(complex_t<scalar_t>) value)
50+
template <typename IndexType, typename AccessType>
51+
void get(IndexType idx, NBL_REF_ARG(AccessType) value)
5052
{
5153
value = preloaded[idx >> WorkgroupSizeLog2];
5254
}
@@ -57,12 +59,14 @@ struct PreloadedAccessorBase : PreloadedAccessorCommonBase
5759
// In the case for preloading all channels at once we make it stateful so we track which channel we're running FFT on
5860
struct MultiChannelPreloadedAccessorBase : PreloadedAccessorCommonBase
5961
{
60-
void set(uint32_t idx, complex_t<scalar_t> value)
62+
template <typename IndexType, typename AccessType>
63+
void set(IndexType idx, AccessType value)
6164
{
6265
preloaded[currentChannel][idx >> WorkgroupSizeLog2] = value;
6366
}
6467

65-
void get(uint32_t idx, NBL_REF_ARG(complex_t<scalar_t>) value)
68+
template <typename IndexType, typename AccessType>
69+
void get(IndexType idx, NBL_REF_ARG(AccessType) value)
6670
{
6771
value = preloaded[currentChannel][idx >> WorkgroupSizeLog2];
6872
}

28_FFTBloom/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,11 @@ class FFTBloomApp final : public examples::SimpleWindowedApplication, public app
583583

584584
deviceLocalBufferParams.queueFamilyIndexCount = 1;
585585
deviceLocalBufferParams.queueFamilyIndices = &queueFamilyIndex;
586-
uint32_t2 sourceDimensions = { m_marginSrcDim.width, m_marginSrcDim.height };
586+
uint32_t2 imageDimensions = { srcDim.width, srcDim.height };
587+
uint32_t2 kernelDimensions = { kerDim.width, kerDim.height };
587588
// Y-axis goes first in the FFT
588589
hlsl::vector <uint16_t, 2> axisPassOrder = { 1, 0 };
589-
deviceLocalBufferParams.size = fft::getOutputBufferSize<2>(3, sourceDimensions, 0, axisPassOrder, true, m_useHalfFloats);
590+
deviceLocalBufferParams.size = fft::getOutputBufferSizeConvolution<2>(3, imageDimensions, kernelDimensions, 0, axisPassOrder, true, m_useHalfFloats);
590591
deviceLocalBufferParams.usage = asset::IBuffer::E_USAGE_FLAGS::EUF_STORAGE_BUFFER_BIT | asset::IBuffer::E_USAGE_FLAGS::EUF_SHADER_DEVICE_ADDRESS_BIT;
591592

592593
for (auto i = 0u; i < MaxFramesInFlight; i++)

0 commit comments

Comments
 (0)