Tech Lingo like Shaders Explained
Tech Lingo like Shaders Explained
With each new article it's good to always look back and explain terms that have become common in our vocabulary, yet a lot of you might not know what they mean. On this page I like to explain the basics inside a graphics card and as such explain shaders and shader processors. Just so you know what we are talking about. And if you know all this, please head on over to the next page. But to understand what we are writing, you need to understand what's going on inside a GPU.
To understand what is going on inside that graphics card of yours, please allow me to explain what is actually happening inside that graphics processor and explain terminology like shaders in a very easy to understand manner (I hope). That and how it relates to rendering all that gaming goodness on your screen.
What does it take to get a game rendered? E.g. What do we need to render a three dimensional object, in 2D on your monitor? We start off by building some sort of structure that has a surface, and that surface is built from triangles. Triangles are great as they are really quick and easy to compute. Now we need to process each triangle. Each triangle has to be transformed according to its relative position and orientation to the viewer.
The next step is to light the triangle by taking the transformed vertices and applying a lighting calculation for every light defined in the scene. At last the triangle needs to be projected to the screen in order to rasterize it. During rasterization the triangle will be shaded and textured.
Graphics processors like the Radeon and GeForce series are able to perform a large sum of these tasks. Actually, the first generation (say ten years ago) was able to draw shaded and textured triangles in hardware, which was a revolution.
The CPU still had the burden of feeding the graphics processor with transformed and lit vertices, triangle gradients for shading and texturing, etc. Integrating the triangle setup into the chip logic was the next step and finally even transformation and lighting (TnL) was possible in hardware, reducing the CPU load considerably (surely everyone remembers the GeForce 256 right?).
The big disadvantage at that time was that a game programmer had no direct (i.e. program driven) control over transformation, lighting and pixel rendering, because all the calculation models were fixed on the chip. This is the point in time where shader design surfaced, limiting the programmer to get the best graphics out of the graphics card.
We now finally get to the stage where we can explain shaders and shader processors.
In the year 2000 DirectX 8 was released, vertex and pixel shaders arrived at and in the scene and allowed software and game developers to program tailored transformation and lighting calculations as well as pixel coloring functionality which gave a new graphics dimension to the gaming experience, and games slowly started to look much more realistic.
Each shader is basically nothing more than a relatively small program (programming code) executed on the graphics processor to control either vertex, pixel or geometry processing. So a shader processor is in fact a small floating point processor inside your GPU.
When we advance to the year 2002, we see the release of DirectX 9 which most games still use. DX9 had the advantage of using much longer shader programs than before, with pixel and vertex shader version 2.0. However there still was a limitation. In the past, graphics processors have had dedicated units for diverse types of operations in the rendering pipeline, such as vertex processing and pixel shading.
With the introduction of DirectX 10 it was time to move away from that somewhat inefficient fixed pipeline and create a new unified architecture, unified shader architecture; shader processors that can handle a variety of shaders.
- A shader processor: Each time we mention a shader processor, this is one of the many little shader processors inside your GPU. We also call these units stream processors.
- Once I mention a shader... that's the program executed on the shader engine (the accumulated shader processor domain).
As stated, GPU manufacturers like to call the shader processors... stream processors. Same idea, slightly different context. GPUs are stream processors; processors that can operate in parallel, aka many independent vertices and fragments at once. A stream is simply a set of records that require similar computation.
With the birth of DX11 we now have several types of shaders: pixel, vertex, geometry and new is a compute shader (DirectCompute) allowing GPGPU functionality directly over the GPU, and for Tessellation a domain and hull shader instruction set has been added.
I do hope you now understand the concept of the GPU, what it is doing and the definition of shaders and shader (aka stream) processors.