Cg programs are built for different
shader profiles that stand for GPUs with different capabilities. These profiles decide, among others, how many instructions can be in each shader, how many registers are available, and what kind of resources a shader can use. Even if a program is correct, it might be too complex to work on a profile. Cg supports some of the newer profiles up to Shader Model 5.0 as well as translation to glsl or hlsl. GPUs listed are the hardware that first supported the given specifications. Manufacturers generally support all lower shader models through drivers. Note that games may claim to require a certain DirectX version, but don't necessarily require a GPU conforming to the full specification of that version, as developers can use a higher DirectX API version to target lower-Direct3D-spec hardware; for instance DirectX 9 exposes features of DirectX7-level hardware that DirectX7 did not, targeting their fixed-function T&L pipeline.
Pixel shader comparison •
PS 1.0 — Unreleased
3dfx Rampage, DirectX 8 •
PS 1.1 —
GeForce 3, DirectX 8 •
PS 1.2 —
3Dlabs Wildcat VP, DirectX 8.1 •
PS 1.3 —
GeForce 4 Ti, DirectX 8.1 •
PS 1.4 —
Radeon 8500–9250,
Matrox Parhelia, DirectX 8.1 •
Shader Model 2.0 —
Radeon 9500–9800/X300–X600, DirectX 9 •
Shader Model 2.0a —
GeForce FX/PCX-optimized model, DirectX 9.0a •
Shader Model 2.0b —
Radeon X700–X850 shader model, DirectX 9.0b •
Shader Model 3.0 —
Radeon X1000 and
GeForce 6, DirectX 9.0c •
Shader Model 4.0 —
Radeon HD 2000 and
GeForce 8, DirectX 10 •
Shader Model 4.1 —
Radeon HD 3000 and
GeForce 200, DirectX 10.1 •
Shader Model 5.0 —
Radeon HD 5000 and
GeForce 400, DirectX 11 •
Shader Model 5.1 —
GCN 1+, Fermi+, DirectX 12 (11_0+) with WDDM 2.0 •
Shader Model 6.0 — GCN 1+, Kepler+, DirectX 12 (11_0+) with WDDM 2.1 •
Shader Model 6.1 — GCN 1+, Kepler+, DirectX 12 (11_0+) with WDDM 2.3 •
Shader Model 6.2 — GCN 1+, Kepler+, DirectX 12 (11_0+) with WDDM 2.4 •
Shader Model 6.3 — GCN 1+, Kepler+, DirectX 12 (11_0+) with WDDM 2.5 •
Shader Model 6.4 — GCN 1+, Kepler+, Skylake+, DirectX 12 (11_0+) with WDDM 2.6 •
Shader Model 6.5 — GCN 1+, Kepler+, Skylake+, DirectX 12 (11_0+) with WDDM 2.7 •
Shader Model 6.6 — GCN 4+, Maxwell+, DirectX 12 (11_0+) with WDDM 3.0 •
Shader Model 6.7 — GCN 4+, Maxwell+, DirectX 12 (12_0+) with WDDM 3.1 •
Shader Model 6.8 — RDNA 1+, Maxwell 2+, DirectX 12 (12_0+) with WDDM 3.1 / 3.2 with Agility SDK "32 + 64" for
Executed Instructions means "32 texture instructions and 64 arithmetic instructions."
Vertex shader comparison The standard library As in C, Cg/HLSL features a set of functions for common tasks in GPU programming. Some of the functions have equivalents in C, like the mathematical functions abs and sin, while others are specialized in GPU programming tasks, like the
texture mapping functions tex1D and tex2D.
The Cg/HLSL runtime library Cg/HLSL programs are merely vertex and pixel shaders, and they need supporting programs that handle the rest of the rendering process. Cg can be used with two graphics
APIs:
OpenGL or
DirectX. Each has its own set of Cg functions to communicate with the Cg program, like setting the current Cg shader, passing parameters, and such tasks. (HLSL only targets DirectX.) In addition to being able to compile Cg source to assembly code, the Cg runtime also has the ability to compile shaders during execution of the supporting program. This allows the runtime to compile the shader using the latest optimizations available for hardware that the program is currently executing on. However, this technique requires that the source code for the shader be available in plain text to the compiler, allowing the user of the program to access the source-code for the shader. Some developers view this as a major drawback of this technique. To avoid exposing the source code of the shader, and still maintain some of the hardware specific optimizations, the concept of profiles was developed. Shaders can be compiled to suit different graphics hardware platforms (according to profiles). When executing the supporting program, the best/most optimized shader is loaded according to its profile. For instance there might be a profile for a graphics card that supports complex pixel shaders, and another profile for one that supports only minimal pixel shaders. By creating a pixel shader for each of these profiles a supporting program enlarges the number of supported hardware platforms without sacrificing picture quality on powerful systems.' == Compilers and dialects ==