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
238 GPGPU Programming for Games and Science
struct MyMatrix { float4x4 A; } ;
StructuredBuffer<MyMatrix> input ; // 1 e l em en t
RWTexture1D<float> output ; // 16 elements
[numthreads(1,1,1)]
void CSMai n ( i nt3 t : S V
DispatchThreadID)
{
for ( int j=0,k=0; j< 4; ++j )
{
for ( int i=0; i< 4 ; ++ i , ++k )
{
output [k] = input [0].A[ j ][ i ];
}
}
}
LISTING 5.4: A compute shader program that fetches a matrix from a
structured buffer with a struct that has a single member
float4x4.
The output from
FXC using /Zpr is shown in Listing 5.5. The ld structured indexable
instruction was manually split across lines to fit in the width of the page.
//
// Generated by Microsoft ...
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