Skip to main content
gamedev.net
🔒 Locked

[DX11] Buffer reading problem

Started by BuraCULa Dec 9, 2011 at 10:04 AM 0 replies 1.2k views
Original Post
BuraCULa
BuraCULa
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;
}
}

}
Jason Z
Jason Z
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.
Jason Zink :: DirectX MVP   Direct3D 11 engine on CodePlex: Hieroglyph 3 Direct3D Books: 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.