WHAT’S A SHADER?

Maximum PC - - GPGPUS -

A shader is a small pro­gram that is run within the GPU’s pipe­line and ma­nip­u­lates ei­ther in­di­vid­ual pix­els or the ge­om­e­try in the world in some way. The term comes from shaders’ first im­ple­men­ta­tions, which were for shad­ing al­go­rithms, such as the Phong shader to pro­duce smooth im­ages.

There are ef­fec­tively two dis­tinc­tive types of shaders: pixel (or “frag­ment” in OpenGL/ Vulkan par­lance) shaders and ver­tex shaders. Pixel shaders work at the end of the pipe­line, and their out­put is an in­di­vid­ual pixel’s RGB and Al­pha value.

What we’re call­ing ver­tex shaders work on ma­nip­u­lat­ing point ver­tices of mod­els (three ver­tices make a tri­an­gle) for light­ing and warp­ing. Other shaders—ge­om­e­try, tes­sel­la­tion (fixed func­tion), hull, do­main—are all about ma­nip­u­lat­ing ge­om­e­try within the world. Im­por­tantly, shaders are able to process ba­sic in­put and out­put back to shared mem­ory, called Stream Out­put. In the con­text of graph­ics, Stream Out­put en­ables the GPU to cre­ate and an­i­mate par­ti­cle sys­tems with­out CPU in­ter­ven­tion.

With a GPGPU, shaders be­come the pro­gram­mable pro­ces­sors of the GPU. Tex­ture units are the read-only mem­ory in­ter­face, and the out­put frame buf­fer is the write-only mem­ory in­ter­face. The ba­sic op­er­a­tions of a shader and the lim­ited in­put mean that GPGPU ex­cels when there is a large dataset that re­quires repet­i­tive pro­cess­ing with min­i­mal de­pen­dency be­tween data el­e­ments.

Newspapers in English

Newspapers from Australia

© PressReader. All rights reserved.