Skip to content

Commit 90f1307

Browse files
prep for new push constants
1 parent 1663ea2 commit 90f1307

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

include/nbl/builtin/glsl/ext/FFT/default_compute_fft.comp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ layout(push_constant) uniform PushConstants
6666
#ifndef _NBL_GLSL_EXT_FFT_SET_DATA_DEFINED_
6767
void nbl_glsl_ext_FFT_setData(in uvec3 coordinate, in uint channel, in nbl_glsl_complex complex_value)
6868
{
69-
uvec3 dimension = nbl_glsl_ext_FFT_Parameters_t_getPaddedDimensions();
70-
uint index = channel * (dimension.x * dimension.y * dimension.z) + coordinate.z * (dimension.x * dimension.y) + coordinate.y * (dimension.x) + coordinate.x;
69+
const uint index = nbl_glsl_dot(uvec4(coordinate,channel),nbl_glsl_ext_FFT_Parameters_t_getOutputStrides());
7170
outData[index] = complex_value;
7271
}
7372
#define _NBL_GLSL_EXT_FFT_SET_DATA_DEFINED_
@@ -87,8 +86,7 @@ nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(in uvec3 coordinate, in uint cha
8786
return nbl_glsl_complex(0, 0);
8887
}
8988

90-
uvec3 dimension = nbl_glsl_ext_FFT_Parameters_t_getDimensions();
91-
uint index = channel * (dimension.x * dimension.y * dimension.z) + clamped_coord.z * (dimension.x * dimension.y) + clamped_coord.y * (dimension.x) + clamped_coord.x;
89+
const uint index = nbl_glsl_dot(uvec4(coordinate,channel),nbl_glsl_ext_FFT_Parameters_t_getInputStrides());
9290
return inData[index];
9391
}
9492
#define _NBL_GLSL_EXT_FFT_GET_PADDED_DATA_DEFINED_

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,21 @@ uvec3 nbl_glsl_ext_FFT_Parameters_t_getPaddedDimensions() {
2525
nbl_glsl_ext_FFT_Parameters_t params = nbl_glsl_ext_FFT_getParameters();
2626
return (params.padded_dimension.xyz);
2727
}
28+
uvec4 nbl_glsl_ext_FFT_Parameters_t_getOutputStrides()
29+
{
30+
uvec3 dimension = nbl_glsl_ext_FFT_Parameters_t_getPaddedDimensions();
31+
return uvec4(1u,dimension.x*uvec3(1u,dimension.y*uvec2(1u,dimension.z)));
32+
}
33+
2834
uvec3 nbl_glsl_ext_FFT_Parameters_t_getDimensions() {
2935
nbl_glsl_ext_FFT_Parameters_t params = nbl_glsl_ext_FFT_getParameters();
3036
return (params.dimension.xyz);
3137
}
38+
uvec4 nbl_glsl_ext_FFT_Parameters_t_getInputStrides()
39+
{
40+
uvec3 dimension = nbl_glsl_ext_FFT_Parameters_t_getDimensions();
41+
return uvec4(1u,dimension.x*uvec3(1u,dimension.y*uvec2(1u,dimension.z)));
42+
}
3243
uint nbl_glsl_ext_FFT_Parameters_t_getDirection() {
3344
nbl_glsl_ext_FFT_Parameters_t params = nbl_glsl_ext_FFT_getParameters();
3445
return (params.dimension.w >> 16) & 0x000000ff;

include/nbl/ext/FFT/FFT.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,19 @@ struct alignas(16) uvec4 {
2929
class FFT : public core::TotalInterface
3030
{
3131
public:
32-
struct Parameters_t alignas(16) : nbl_glsl_ext_FFT_Parameters_t {
32+
struct Parameters_t alignas(16) : nbl_glsl_ext_FFT_Parameters_t
33+
{
3334
};
3435

35-
enum class Direction : uint8_t {
36+
enum class Direction : uint8_t
37+
{
3638
X = 0,
3739
Y = 1,
3840
Z = 2,
3941
};
4042

41-
enum class PaddingType : uint8_t {
43+
enum class PaddingType : uint8_t
44+
{
4245
CLAMP_TO_EDGE = 0,
4346
FILL_WITH_ZERO = 1,
4447
// TODO: mirror?

0 commit comments

Comments
 (0)