Standard Portable Intermediate Representation ( SPIR ) is an intermediate language for parallel computing and graphics by Khronos Group . It is used in multiple execution environments, including the Vulkan graphics API and the OpenCL compute API, to represent a shader or kernel . It is also used as an interchange language for cross compilation.
29-578: SPIR-V is a new version of SPIR which was introduced in 2015 by the Khronos Group , and has since replaced the original SPIR, which was introduced in 2012. On September 19th 2024, Microsoft has announced plans to adopt SPIR-V as the Direct3D Interchange format in place of DXIL, beginning support from Shader Model 7 on. The purposes of SPIR-V are to natively represent the primitives needed by compute and graphics; to separate high-level language from
58-511: A 3D content creation tool and exporting the scene to a format that is readable by the viewer or helper library. Desktop 3D authoring software such as Blender , Autodesk Maya or SimLab Composer can be used for this purpose. In particular, Blend4Web allows a WebGL scene to be authored entirely in Blender and exported to a browser with a single click, even as a standalone web page. There are also some WebGL-specific software such as CopperCube and
87-477: A Khronos API standard must pass conformance tests. An API Adopter Program enables companies to test their products for conformance. Membership in Khronos Group provides access to an IP framework designed to protect participant IP. Khronos members agree not to assert IP rights against adopters implementing Khronos specifications. The IP framework protects Khronos members from exposure to patent lawsuits and reduces
116-421: A client API can reject modules that declare unsupported capabilities. SPIR-V has been used to help deal with multiple versions of source-level languages. For example, the multiple versions of OpenGL Shading Language (GLSL) require distribution of multiple versions of shaders, due to implementations that are pegged to a specific older version of GLSL, such as for WebGL 1.0 and Apple's OpenGL implementation. One of
145-404: A project called X3DOM to make X3D and VRML content run on WebGL. There has been an emergence of 2D and 3D game engines for WebGL, such as Unreal Engine 4 and Unity . The Stage3D /Flash-based Away3D high-level library also has a port to WebGL via TypeScript . A more light-weight utility library that provides just the vector and matrix math utilities for shaders is sylvester.js. It
174-491: A wide variety of platforms and devices. The group is based in Beaverton, Oregon . The Khronos Group was founded in 2000 by companies including 3Dlabs , ATI , Discreet , Evans & Sutherland , Intel , SGI , and Sun Microsystems . Promoter members include AMD , Apple , Arm , Epic Games , Google , Huawei , Nokia , Imagination , Intel , NVIDIA , Qualcomm , Samsung , Sony , Valve and Verisilicon. Its president
203-498: Is Neil Trevett . Typically, Khronos first creates an exploratory group to gauge industry interest before creating a working group, which companies can join as members to assist in the development of the standard. Each specification / standard is managed by a working group which is established to define the requirements, solicit input, discuss, and create a specification. There are currently 16 working groups. A timeline of API Specification ratification and releases can be found on
232-512: Is an open source graphic engine which implements WebGL 1.0 (2.0 which closely conforms to ES 3.0) and OpenGL ES 2.0 and 3.0 standards. It is a default backend for both Google Chrome and Mozilla Firefox on Windows platforms and works by translating WebGL and OpenGL calls to available platform-specific APIs. ANGLE currently provides access to OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11 APIs. ″[Google] Chrome uses ANGLE for all graphics rendering on Windows, including
261-457: Is based on OpenGL ES 2.0 and provides an API for 3D graphics. It uses the HTML5 canvas element and is accessed using Document Object Model (DOM) interfaces. WebGL 2.0 is based on OpenGL ES 3.0 . It guarantees the availability of many optional extensions of WebGL 1.0, and exposes new APIs. Automatic memory management is provided implicitly by JavaScript . Like OpenGL ES 2.0, WebGL lacks
290-550: Is not lossy like previous byte-code or virtual machine-like intermediate representations used for graphical shaders. This allows closer to optimum performance on the target devices. SPIR-V can be extended by writing extensions to add semantics, or reserving ranges of the token values for the party's use. Vendors can independently add desired semantics to SPIR-V. Additional sets of extended instruction sets can be provided in separate specifications. Multiple sets can be imported without issue, as extended instructions are used by specifying
319-529: Is sometimes used in conjunction with a WebGL specific extension called glUtils.js. There are also some 2D libraries built atop WebGL, like Cocos2d -x or Pixi.js , which were implemented this way for performance reasons in a move that parallels what happened with the Starling Framework over Stage3D in the Flash world. The WebGL-based 2D libraries fall back to HTML5 canvas when WebGL is not available. Removing
SECTION 10
#1733085353941348-669: The fixed-function APIs introduced in OpenGL 1.0 and deprecated in OpenGL 3.0. This functionality, if required, has to be implemented by the developer using shader code and JavaScript. Shaders in WebGL are written in GLSL and passed to the WebGL API as text strings. The WebGL implementation compiles these strings to GPU code. This code is executed for each vertex sent through the API and for each pixel rasterized to
377-523: The ID of the set and of the instruction within the set. Debuggers include RenderDoc , SwiftShader, and Amber. Graphical shaders use structured control flow in SPIR-V to state how control flow nests. This helps in defining divergence and reconvergence of control flow on parallel execution environments. Specialization reduces the number of variants of a shader that need to be distributed. The SPIR-V specification states
406-499: The Khronos Group allows for interconversion with LLVM IR. Support for ingestion of SPIR-V is incorporated in the core specification of OpenCL 2.1, the Vulkan API , and OpenGL version 4.6. SPIR-V is a high-level intermediate language, exchanged in binary form. Functions are represented by a control-flow graph of basic blocks, using static single assignment (SSA) form. Data structures retain high-level hierarchical representation. It
435-426: The Khronos Group website. Khronos members may contribute to the development of Khronos API specifications, vote at various stages before public deployment, and accelerate delivery of their platforms and applications through early access to specification drafts and conformance tests. To ensure that the standards are consistently implemented and to create a reliable platform for developers, any product that implements
464-558: The WebGL API, which provides little on its own to quickly create desirable 3D graphics, motivated the creation of higher-level libraries that abstract common operations (e.g. loading scene graphs and 3D objects in certain formats; applying linear transformations to shaders or view frustums ). Some such libraries were ported to JavaScript from other languages. Examples of libraries that provide high-level features include A-Frame (VR) , BabylonJS, PlayCanvas , three.js , OSG.JS , Google ’s model-viewer and CopperLicht . Web3D also made
493-635: The WebGL specification was released March 2011. An early application of WebGL was Zygote Body . In November 2012 Autodesk announced that they ported most of their applications to the cloud running on local WebGL clients. These applications included Fusion 360 and AutoCAD 360. Development of the WebGL 2 specification started in 2013 and finished in January 2017. The specification is based on OpenGL ES 3.0. First implementations are in Firefox 51, Chrome 56 and Opera 43. Almost Native Graphics Layer Engine (ANGLE)
522-549: The accelerated Canvas2D implementation and the Native Client sandbox environment.″ WebGL is widely supported by modern browsers. However, its availability depends on other factors, too, like whether the GPU supports it. The official WebGL website offers a simple test page. More detailed information (like what renderer the browser uses, and what extensions are available) can be found at third-party websites. The low-level nature of
551-553: The amount of IP that needs to be licensed from other group members. WebGL WebGL (short for Web Graphics Library ) is a JavaScript API for rendering interactive 2D and 3D graphics within any compatible web browser without the use of plug-ins . WebGL is fully integrated with other web standards , allowing GPU -accelerated usage of physics, image processing, and effects in the HTML canvas . WebGL elements can be mixed with other HTML elements and composited with other parts of
580-838: The format from being easily used for separate compilation, where complex shaders could be assembled by a series of partial compile steps followed by a linking step. This runs counter to the stated goals of some SPIR-V tools such as spirv-link , which aims to provide full linking functionality for SPIR-V binary code. Khronos Group The Khronos Group, Inc. is an open , non-profit , member-driven consortium of 170 organizations developing, publishing and maintaining royalty-free interoperability standards for 3D graphics , virtual reality , augmented reality , parallel computation , vision acceleration and machine learning . The open standards and associated conformance tests enable software applications and middleware to effectively harness authoring and accelerated playback of dynamic media across
609-408: The graphical APIs want fully linked into a single SPIR-V module. There are extensions available to allow tools to temporarily use partially linked shaders and also kernels. A SPIR-V module is used by a client API to support that module's features, which are classified through capabilities, and declared early in the module. A validator can confirm that the module uses only its declared capabilities, and
SECTION 20
#1733085353941638-656: The interface to compute and graphics drivers; to be the distribution form, or distribute fully compiled binaries; to be a fully self-contained specification; and to support multiple APIs. It is also used as an intermediate target for cross-compilation tools. For example, SPIR-V allows the Vulkan API to use any shading language , including GLSL and HLSL . SPIR-V can be decompiled into several shading languages ( GLSL , GLSL ES , MSL , HLSL ) using SPIRV-Cross, so that these languages can be interconverted. It also has paths to and/or from WebGPU , OpenCL , SYCL , C++ , and Rust . In target platforms, ingesting SPIR-V removes
667-538: The need to build a high-level language source compiler into device drivers, which reduces driver complexity. SPIR was originally introduced in 2011 and SPIR-V was introduced in 2015. SPIR prior to the 2015 SPIR-V release was based on the LLVM Intermediate Representation . A provisional specification for SPIR 1.0 was announced in 2012. On July 22, 2013, a provisional specification SPIR 1.2 was announced at SIGGRAPH 2013 . The final SPIR 1.2 specification
696-486: The notable use cases of SPIR-V is its ability to be used as an interchange format between GLSL versions, using tools maintained by the Khronos Group for compiling GLSL to SPIR-V glslangValidator , optimizing SPIR-V spirv-opt , and cross-compiling to SPIR-V to different GLSL targets spirv-cross . As a format, however, SPIR-V has some limitations for cross-compilation, including the requirement that every SPIR-V module have at least one entry-point symbol. This prevents
725-568: The page or page background. WebGL programs consist of control code written in JavaScript, and shader code written in OpenGL ES Shading Language (GLSL ES, sometimes referred to as ESSL), a language similar to C or C++ . WebGL code is executed on a computer's GPU. WebGL is designed and maintained by the non-profit Khronos Group . On February 9, 2022, Khronos Group announced WebGL 2.0 support from all major browsers. WebGL 1.0
754-471: The rendering bottleneck by giving almost direct access to the GPU has exposed performance limitations in the JavaScript implementations. Some were addressed by asm.js and WebAssembly (similarly, the introduction of Stage3D exposed performance problems within ActionScript , which were addressed by projects like CrossBridge ). As with any other graphics API, creating content for WebGL scenes requires using
783-508: The rules that must be followed to have a valid SPIR-V module. This allows for offline validation. Drivers are not obligated to handle invalid SPIR-V modules. In testing, conformance testing verifies that drivers behave correctly when consuming valid SPIR-V, while validators verify that front-ends properly generate SPIR-V. SPIR-V can express calls to functions in a different compilation unit. The standard version of SPIR-V uses this feature for OpenCL compute kernels, but not for shader stages, which
812-572: The screen. WebGL evolved out of the Canvas 3D experiments started by Vladimir Vukićević at Mozilla . Vukićević first demonstrated a Canvas 3D prototype in 2006. By the end of 2007, both Mozilla and Opera had made their own separate implementations. In early 2009, the non-profit technology consortium Khronos Group started the WebGL Working Group, with initial participation from Apple , Google , Mozilla, Opera , and others. Version 1.0 of
841-478: Was released at HiPEAC 2014 on January 21, 2014. On August 11, 2014, a provisional specification for SPIR 2.0 was released at SIGGRAPH 2014 . SPIR-V does not use LLVM. SPIR-V 1.0 is a new version of SPIR announced in March 2015, and released on November 16, 2015. The SPIR family now includes a true cross-API standard that is fully defined by Khronos with native support for shader and kernel features. A separate program by
#940059