Jump to content

  • Log In with Google      Sign In   
  • Create Account

[DX11] Buffer reading problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 BuraCULa   Members   -  Reputation: 105

Like
0Likes
Like

Posted 09 December 2011 - 04:04 AM

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[i]		=	wValues[i];
		}
	}

	

	if(FFT_DIR==0){
		for (int i = 0; i < FFT_DIM; i++){
			hTValues[i + FFT_DIM*threadIDInGroup.x].re = c[i].x;
			hTValues[i + FFT_DIM*threadIDInGroup.x].im = c[i].y;
		}
	}
	
}


Sponsor:

#2 Jason Z   Crossbones+   -  Reputation: 5054

Like
0Likes
Like

Posted 10 December 2011 - 11:40 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS