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
386 GPGPU Programming for Games and Science
void CSMai n ( i nt2 dt : SV DispatchThreadID)
{
// Load the neighborhood of the pixel .
float data [NUM
DATA ] ;
int i=0;
int2 offset ;
[ unroll ]
for (offset.y =RADIUS ; o f f s e t . y <= RADIUS ; ++o f f s e t . y )
{
[ unroll ]
for (offset.x =RADIUS ; o f f s e t . x <= RADIUS ; ++o f f s e t . x )
{
data[ i ] = input [dt + offset ];
++ i ;
}
}
// Use an i ns er ti o n s or t to lo cate the median value .
for ( int i0 = 1; i0 < NUM
DATA ; + +i 0 )
{
float value = data [ i0 ];
int i1 ;
for (i1 = i0; i1 > 0; −− i1)
{
if (value < data [ i1 1])
{
data [ i1 ] = data [ i1 1];
}
else
{
break ;
}
}
data [ i1 ] = value ;
}
output
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