High-Level Shader Language
   HOME

TheInfoList



OR:

The High-Level Shader Language or High-Level Shading Language (HLSL) is a proprietary shading language developed by
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
for the
Direct3D Direct3D is a graphics application programming interface (API) for Microsoft Windows. Part of DirectX, Direct3D is used to render three-dimensional graphics in applications where performance is important, such as games. Direct3D uses hardware ...
9
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
to augment the shader assembly language, and went on to become the required shading language for the unified shader model of Direct3D 10 and higher. HLSL is analogous to the
GLSL OpenGL Shading Language (GLSL) is a high-level shading language with a syntax based on the C programming language. It was created by the OpenGL ARB (OpenGL Architecture Review Board) to give developers more direct control of the graphics pipe ...
shading language used with the
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
standard. It is very similar to the Nvidia Cg shading language, as it was developed alongside it. Early versions of the two languages were considered identical, only marketed differently. HLSL shaders can enable profound speed and detail increases as well as many
special effects Special effects (often abbreviated as F/X or simply FX) are illusions or visual tricks used in the theatre, film, television, video game, amusement park and simulator industries to simulate the fictional events in a story or virtual world. ...
in both 2D and 3D
computer graphics Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
. HLSL programs come in six forms:
pixel shader In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as '' shading''. Shaders have evolved to perform a variety of s ...
s (fragment in GLSL),
vertex shader In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as '' shading''. Shaders have evolved to perform a variety of s ...
s,
geometry shader In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as '' shading''. Shaders have evolved to perform a variety of sp ...
s,
compute shader In computing, a compute kernel is a routine compiled for high throughput accelerators (such as graphics processing units (GPUs), digital signal processors (DSPs) or field-programmable gate arrays (FPGAs)), separate from but used by a main pro ...
s,
tessellation shader In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as '' shading''. Shaders have evolved to perform a variety of sp ...
s (Hull and Domain shaders), and ray tracing shaders (Ray Generation Shaders, Intersection Shaders, Any Hit/Closest Hit/Miss Shaders). A vertex shader is executed for each vertex that is submitted by the application, and is primarily responsible for transforming the vertex from object space to view space, generating texture coordinates, and calculating lighting coefficients such as the vertex's normal, tangent, and bitangent vectors. When a group of vertices (normally 3, to form a triangle) come through the vertex shader, their output position is interpolated to form pixels within its area; this process is known as rasterization. Optionally, an application using a Direct3D 10/11/12 interface and Direct3D 10/11/12 hardware may also specify a geometry shader. This shader takes as its input some vertices of a primitive (triangle/line/point) and uses this data to generate/degenerate (or tessellate) additional primitives or to change the type of primitives, which are each then sent to the rasterizer. D3D11.3 and D3D12 introduced Shader Model 5.1 and later 6.0.


Shader model comparison

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 3dfx Interactive, Inc. was an American computer hardware company headquartered in San Jose, California, founded in 1994, that specialized in the manufacturing of 3D graphics processing units, and later, video cards. It was a pioneer in the f ...
Rampage, DirectX 8 *PS 1.1 —
GeForce 3 The GeForce 3 series (NV20) is the third generation of Nvidia's GeForce line of graphics processing units (GPUs). Introduced in February 2001, it advanced the GeForce architecture by adding programmable pixel and vertex shaders, multisample ant ...
, 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


See also

*
Direct3D Direct3D is a graphics application programming interface (API) for Microsoft Windows. Part of DirectX, Direct3D is used to render three-dimensional graphics in applications where performance is important, such as games. Direct3D uses hardware ...
*
DirectX Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct" ...
* DirectX Raytracing


Footnotes


External links


Programming guide for HLSL
at
Microsoft Docs Microsoft Docs was a library of technical documentation for end users, developers, and IT professionals who work with Microsoft products. The Microsoft Docs website provided technical specifications, conceptual articles, tutorials, guides, API ...

Introduction to the DirectX 9 High Level Shading Language
(ATI) AMD developer central
Riemer's HLSL Introduction & Tutorial (includes sample code)
{{Webarchive, url=https://web.archive.org/web/20081119034954/http://www.riemers.net/Tutorials/DirectX/Csharp3/index.php , date=November 19, 2008


DirectX Intermediate Language
(DXIL) specification C programming language family DirectX Microsoft application programming interfaces Shading languages