Re: CPU and GPU



Hi Stefan,

>The set of SIMD instructions in pixel shader 3.0 looks very suitable to
>perform computations "inside" each memory block but combining of
>results from several blocks does not fit well to GPU and should be
>performed on CPU. So, pixel shader may be run several times per one
>computation session with CPU involvement between.

Actually, you should do whatever you can to keep data on the GPU -
there is almost never any benefit to reading back data to the CPU
because it's such a huge bottleneck.
Combining results from several computations on the GPU is referred to
as a "reduction" operation in GPGPU parlance. A reduction operation is
a process which combines results from multiple threads (fragments,
pixels, however you want to think about it) into a single result.

For instance, if you had a large texture of scalar values and wanted to
determine the average (mean) you might run a fragment shader which
averages four texels at a time, putting the result in a texture 1/2 the
size of the original. You would repeat this process until you reached
a texture of size 1x1, at which point you'd have your result. This
kind of scheme requires log(N) passes for an NxN texture, but there are
more clever schemes.

I'd suggest checking out the forums on http://www.gpgpu.org if you
haven't already - these folks should be more than willing to answer any
questions you have about the specifics.
Good luck,


-Trevor

.



Relevant Pages

  • Re: calling IDirect3DDevice9::StretchRect failed
    ... per CPU using lock, and finally use it as a texture-map? ... I could not find way to do that in pixel shader. ... texture in CPU, I want to add extra pixels with some kind characters ... pirvate video texture will be read and written. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Delibrately increasing vertices for Normals realism
    ... with the rendered geometry to produce realistic lighting effects. ... texture coordinates for the light map's texture stage determine how the ... interpolated for each fragment passed to the pixel shader. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Disable Sampling
    ... The point is that I want to run a pixel shader over each pixel of the ... and check out the texture alignment rules in the D3D ... >> save to a .bmp file. ... >> Felix Arends ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Calculate window position in pixel shader for point sprites?
    ... sprites. ... of the point in the structure passed to the pixel shader. ... normal simple case you can map a texture to the point's surface ... i.e. for a given texture coordinate translate that coordinate to ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Sorry, I want to say TCI, D3D texture coordinate generation
    ... indeed I just don't know how to use Direct3D. ... how to compute the static texture ... geometry, making some equation of U V,but I want to do it more automaitc ... Dose TCI or Pixel Shader do this good? ...
    (microsoft.public.win32.programmer.directx.graphics)