Skip to Content
GPGPU Programming for Games and Science
book

GPGPU Programming for Games and Science

by David H. Eberly
August 2014
Intermediate to advanced
469 pages
16h 30m
English
A K Peters/CRC Press
Content preview from GPGPU Programming for Games and Science
158 GPGPU Programming for Games and Science
should be unrolled by the compiler.. Modify the compute shader as shown
next:
[ unroll ]
for ( int r=0; r< 3; ++r)
{
[ unroll ]
for ( int c=0; c< 3; ++c)
{
result += weight[r ][c] input [t + offset [ r ][ c ]];
}
}
which tells the compiler to unroll both loops, if possible. In this case, the
number of loop iterations is known at compile time, and we expect to obtain
nine occurrences of the inner-loop body, say,
re su lt += 0.0625 f input [ int2 (t .x 1, t.y 1)];
re su lt += 0.1250 f input [ int2 (t .x , t .y 1)];
re su lt += 0.0625 f input [ int2 (t .x + 1, t .y 1)];
re su lt += 0.1250 f input [ int2 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Graphics Gems V (IBM Version)

Graphics Gems V (IBM Version)

Alan W. Paeth
GPU Pro 6

GPU Pro 6

Wolfgang Engel

Publisher Resources

ISBN: 9781466595354