|
![](/i/fill.gif) |
> Indeed. And on the GPU, you can say "for all these thirty pixels you're
> processing, multiply each one by the corresponding texture pixel". For
> example. One instruction, executed on 30 different pairs of data values.
> SIMD.
If you've ever done a array processing with eg MatLab you will be familiar
with how to restructure algorithms to work in this sort of environment.
Things like doing "OUTPUT = A * B + (1-A) * C" is a single instruction that
can operate on every value of the array, but essentially lets you choose
output B or C based on the value of A. This is often very useful and fast
for converting typical one-value-at-a-time algorithms.
Reminds me of a built-in MatLab function to convert an RGB image to HSV.
The function was actually looping through every pixel and calling the
convert function (which had several if's in it). I rewrote the conversion
function to work on whole arrays at a time and it was orders of magnitude
faster. That's what you need to do for GPU programming too.
Post a reply to this message
|
![](/i/fill.gif) |