Original Post
hi. I am trying to implement fft algorithm on gpu via compute shader. Actually i am trying to convert my working c++ code to hlsl code.
Since i couldn't do it, i tried to make code as simple as i can,and deleted and updated some parts of the shader function.But still i cant read from the buffers correctly. It reads zeros from the buffers although the buffers were initialized correctly(wValues and rIndices buffers have correct values). I am usin pix to view the buffers. I am new to hlsl and i guess i am making very stupid mistake somewhere.Where is my mistake :/
Since i couldn't do it, i tried to make code as simple as i can,and deleted and updated some parts of the shader function.But still i cant read from the buffers correctly. It reads zeros from the buffers although the buffers were initialized correctly(wValues and rIndices buffers have correct values). I am usin pix to view the buffers. I am new to hlsl and i guess i am making very stupid mistake somewhere.Where is my mistake :/
struct Complex{
float re;
float im;
};
// group sizes
#define FFT_DIM 16
#define log_2_n 4
cbuffer Algo{
int FFT_DIR;
float time;
};
Buffer<uint> rIndices:register(t0);
Buffer<float> wValues:register(t1);
RWStructuredBuffer<Complex> hTValues:register(u0);
[numthreads(FFT_DIM,1, 1 )]
void FFTShader( uint3 threadIDInGroup : SV_GroupThreadID){
float2 c[FFT_DIM];
int w_c=0;
int w_cc=1;
int loops = FFT_DIM>>1;
int size = 1<<1;
int size_over_2 = 1;
int toffset=0;
if(FFT_DIR==0){
for(int i=0 ; i<FFT_DIM ; i++){
c = wValues;
}
}
if(FFT_DIR==0){
for (int i = 0; i < FFT_DIM; i++){
hTValues[i + FFT_DIM*threadIDInGroup.x].re = c.x;
hTValues[i + FFT_DIM*threadIDInGroup.x].im = c.y;
}
}
}