This article relies too much on references to primary sources. Please improve this by adding secondary or tertiary sources. July Parts of this article those related to Shader Model 5. Please update this article to reflect recent events or newly available information.
The language is insprired by HLSLthe dominant shading language for graphics app developers. Background Over the past few decades, 3D graphics have changed significantly, and the APIs programmers use to write 3D applications have also changed accordingly. Five years ago, state-of-the-art graphics applications would use OpenGL to perform their rendering.
However, the past few years have seen a shift in the 3D graphics industry toward newer, lower-level graphics frameworks that better match the behavior of real hardware. InMicrosoft created Direct3D 12a major update to Direct3D which allows for console-level efficiency for rendering and compute.
All of the major browser vendors are participating and contributing to the standardization effort. Shaders are programs that take advantage of the specialized architecture of GPUs.
By leveraging the best traits of each, modern graphics APIs provide a powerful framework for developers to create complex, rich, and fast 3D apps.
This language needs to meet several requirements that make it well-tailored for the Web platform. The language needs to be safe. Without this guarantee, a malicious website could run a shader that reads pixels out of other parts of your screen, even from native apps.
The language needs to be well-specified. The language specification has to be explicit about whether every single possible string of characters is a valid program or not.
As with all other Web formats, a shading language for the Web must be precisely specified to guarantee interoperability between browsers.
The language also needs to be well-specified so that it can be used as a compilation target. Many rendering teams write shaders in their own custom in-house language, and then cross-compile to whichever language is necessary.
For this reason, the language should have a reasonably small set of unambiguous grammar and type checking rules that compiler writers can reference when emitting this language. The language needs to be performant. The entire reason developers want to use the GPU in the first place is for performance.
The compiler itself needs to run quickly, and programs produced by the compiler need to run efficiently on real GPUs. WebGPU features such as the binding model and tessellation model interact deeply with the shading language. Though it is feasible to have the language developed independently of the API, having the WebGPU API and shading language in the same forum ensures the goals are shared, and makes development more streamlined.
The language needs to be easy for a developer to read and write. There are two pieces to this: GPU programmers are important clients because they have experience writing shaders. CPU programmers are important because GPUs are increasingly being used for purposes beyond rendering, including machine learning, computer vision, and neural networks.
For them, the language should be compatible with familiar programming language concepts and syntax. The second piece to this is that the language should be human-readable. The culture of the Web is one where anyone can start writing a webpage with just a text editor and a browser.
This culture has created a rich ecosystem of tools and inspectors, where tinkerers can investigate how any webpage works simply by View-Source. All the major languages used on the web today are human-readable, with one exception.
The WebAssembly Community Group expected that parsing a bytecode would be more performant than parsing a text language. However, that turned out not to be true; Asm. Every major browser runs optimization passes on the bytecode prior to execution.
Unfortunately, the desires of simpler compilers never ended up panning out. While there are a number of existing languages, none have been designed with both the Web and modern graphics applications in mind, and none that address the requirements listed above.High-level shading languages were introduced to make shader development manageable.
Today, Microsoft high-level shader language (HLSL) is the standard language used by all Microsoft 3D APIs, including the XNA Framework/5(1). High-Level Shader Language (HLSL) • C like language with special shader constructs • All the usual advantages of high level languages – Faster, easier development – Code re-use – Optimization • Industry standard which will run on cards from any vendor.
High Level Shading Language (HLSL), a programming language for Graphic Processing Unit (GPU) in DirectX , supports the shader construction with C-like syntax.
High-level shading languages were introduced to make shader development manageable. Today, Microsoft high-level shader language (HLSL) is the standard language used by all Microsoft 3D APIs, including the XNA Framework.
HLSL is the High Level Shading Language for DirectX. Using HLSL, you can create C like programmable shaders for the Direct3D pipeline. HLSL was created, starting with DirectX 9, to set up the programmable 3D pipeline.
High-Level Shading LanguagesHigh-Level Shading Languages Randy Fernando Developer Technology Group. Shading Language (Stanford, ) HLSL (Microsoft, ) Cg (NVIDIA, ) GLSL (ARB, ) of a high-level language: Easier programming Easier code reuse.