Jump to content
  • Advertisement
Sign in to follow this  
BuraCULa

DX11 [DX11] Buffer reading problem

This topic is 2562 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :/

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;
}
}

}

Share this post


Link to post
Share on other sites
Advertisement
Are you talking about the wValues buffer? Because it looks like you are mixing the types of the variables and what will be returned by your buffer. wValues is declared as a float, but you are reading it into a float2... That could be correct if you are only loading the real portion of the complex number, but if so then you should explicitly do that with matching types.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!