Hello and sorry for the obscure title :}
I`ll try to explain the best i can.
First of all, i am new to HLSL but i understand about the pipeline and stuff that are from the fairy world. What i`m trying to do is use the gpu for general computations (GPGPU).
What i don`t know is: how can i read* the vertices (that have been transformed using vertex shaders) back to my xna application? I read something about using the texture memory of the gpu but i can’t find anything solid…
Thanks in advance for any info/tip! 🙂
*not sure if possible bacause of the rasterizer and the pixel shader (if any), i mean, in the end it’s all about pixels, right?
As far as I know this isn’t generally possible.
What exactly are you trying to do? There is probably another solution
EDIT:: Taking into account the comment. If all you want to do is general vector calculations on the GPU try doing them in the pixel shader rather than the vertex shader.
So for example, say you want to do cross two vectors, first we need to write the data into a texture
So now we’ve got a 2*1 texture with the data in, render the texture simply using spritebatch and an effect:
All we need now is the gpgpu effect I’ve shown above. That’s just a standard post processing shader, looking something like this:
This will write out the dot product of A and B into the first pixel, and the dot product of B and B into the second pixel. Then you can read these answers back (ignoring the useless ones)
tada!
There are a whole load of little issues with trying to do this on a larger scale, comment here and I’ll try to help you with any you run into 🙂