ARB assembly language is a low-level
shading language
A shading language is a graphics programming language adapted to programming shader effects (characterizing surfaces, volumes, and objects). Such language forms usually consist of special data types, like "vector", "matrix", "color" and " normal". ...
, which can be characterized as an
assembly language. It was created by the
OpenGL Architecture Review Board
The OpenGL Architecture Review Board (ARB) was an industry consortium that governed the OpenGL specification.
It was formed in 1992, and defined the conformance tests, approved the OpenGL specification and advanced the standard. On July 31, 2006, ...
(ARB) to standardize
GPU
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mob ...
instructions controlling the hardware
graphics pipeline
In computer graphics, a computer graphics pipeline, rendering pipeline or simply graphics pipeline, is a conceptual model that describes what steps a graphics system needs to perform to render a 3D scene to a 2D screen. Once ...
.
History
Texas Instruments
Texas Instruments Incorporated (TI) is an American technology company headquartered in Dallas, Texas, that designs and manufactures semiconductors and various integrated circuits, which it sells to electronics designers and manufacturers globa ...
created the first programmable
graphics processor
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobi ...
in 1985: the
TMS34010
The TMS34010, developed by Texas Instruments and released in 1986, was the first programmable graphics processor integrated circuit. While specialized graphics hardware existed earlier, such as blitters, the TMS34010 chip is a microprocessor ...
, which allowed developers to load and execute code on the processor to control
pixel
In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device.
In most digital display devices, pixels are the s ...
output on a video display. This was followed by the TMS34020 and TMS34082 in 1989, providing programmable 3D graphics output.
NVIDIA
Nvidia CorporationOfficially written as NVIDIA and stylized in its logo as VIDIA with the lowercase "n" the same height as the uppercase "VIDIA"; formerly stylized as VIDIA with a large italicized lowercase "n" on products from the mid 1990s to ...
released its first video card
NV1 in 1995, which supported quadratic texture mapping. This was followed by the
Riva 128
Released in August 1997 by Nvidia, the RIVA 128, or "NV3", was one of the first consumer graphics processing units to integrate 3D acceleration in addition to traditional 2D and video acceleration. Its name is an acronym for ''Real-time Interactiv ...
(NV3) in 1997, providing the first hardware acceleration for
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 ...
.
Various video card vendors released their own accelerated boards, each with their own instruction set for
GPU
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mob ...
operations. The
OpenGL Architecture Review Board
The OpenGL Architecture Review Board (ARB) was an industry consortium that governed the OpenGL specification.
It was formed in 1992, and defined the conformance tests, approved the OpenGL specification and advanced the standard. On July 31, 2006, ...
(ARB) was formed in 1992, in part to establish standards for the
GPU
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mob ...
industry.
The ARB and
NVIDIA
Nvidia CorporationOfficially written as NVIDIA and stylized in its logo as VIDIA with the lowercase "n" the same height as the uppercase "VIDIA"; formerly stylized as VIDIA with a large italicized lowercase "n" on products from the mid 1990s to ...
established a number of
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
extensions to standardize GPU programming:
* EXT_texture_env_combine - provided a programmable method of combining textures.
* NV_register_combiners - GeForce 256
* NV_vertex_program - GeForce 3
* NV_texture_shader - GeForce 3
* NV_texture_shader3 - GeForce 4
* NV_vertex_program2 - GeForce FX
* NV_fragment_program - GeForce FX
This culminated with
ARB's 2002 release of
* ARB_vertex_program
* ARB_fragment_program
These two extensions provided an industry standard for an assembly language that controlled the
GPU
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mob ...
pipeline for 3D vertex and interpolated pixel properties, respectively.
Subsequent high-level
shading language
A shading language is a graphics programming language adapted to programming shader effects (characterizing surfaces, volumes, and objects). Such language forms usually consist of special data types, like "vector", "matrix", "color" and " normal". ...
s sometimes compile to this ARB standard. While 3D developers are now more likely to use a C-like, high-level shading language for
GPU
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mob ...
programming, ARB assembly has the advantage of being supported on a wide range of hardware.
Note however that some features, such as loops and conditionals, are not available in ARB assembly, and using them requires to adopt either the NV_gpu_program4 extension, or the GLSL shading language.
All major graphics card manufacturers have supported ARB assembly language for years, since the
NVIDIA Geforce FX series, the
AMD R300-based cards (Radeon 9500 series and higher), and the
Intel GMA 900. However, standard ARB assembly language is only at the level of
Pixel Shader 2.0
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 speci ...
and predates
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 pip ...
, so it has very few features. While nVidia has made proprietary extensions to ARB assembly languages that combine the fast compile speed of ARB assembly with modern OpenGL 3.x features, introduced with the
GeForce 8 Series, most non-nVidia OpenGL implementations do not provide the proprietary nVidia extensions to ARB assembly language
and do not offer any other way to access all the shader features directly in assembly, forcing the use of GLSL even for machine generated shaders where assembly would be more appropriate.
Details
ARB_vertex_program
The ARB Vertex Program extension provides APIs to load ARBvp1.0 assembly instructions, enable selected programs, and to set various GPU parameters.
Vertex programs are used to modify vertex properties, such as position, normals and texture coordinates, that are passed to the next pipeline process: often a fragment shader; more recently, a geometry shader.
ARB_fragment_program
The ARB Fragment Program extension provides APIs to load ARBfp1.0 assembly instructions, enable selected programs, and to set various GPU parameters.
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
fragments are interpolated pixel definitions. The
GPU
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mob ...
's vertex processor calculates all the pixels controlled by a set of vertices, interpolates their position and other properties and passes them onto its fragment process. Fragment programs allow developers to modify these pixel properties before they are rendered to a frame buffer for display.
OpenGL Parameters
* Attrib parameters are per-vertex attributes such as vertex normals.
* Local parameters are applied across a program's entire data set for a given shader pass.
* Env parameters are applied across all programs.
ARB Variables
All ARB assembly variables are float4 vectors, which may be addressed by xyzw or rgba suffixes.
Registers are scalar variables where only one element may be addressed.
* ADDRESS variables are registers.
* ATTRIB are per-vertex attributes.
* PARAM are uniform properties - constants, Env or Local.
* TEMP temporary variables.
* ALIAS provides alternate names for variables.
* OUTPUT designates variables that are passed back to the pipeline.
Vertex Attributes
ARB assembly supports the following suffixes for vertex attributes:
* position
* weight
* normal
* color
*
* texcoord
* matrixindex
* attrib
State Matrices
ARB assembly supports the following state matrices:
* modelview
* projection
* texture
* palette
* program
The following modifiers may be used:
* inverse
* transpose
*
ARB Assembly Instructions
ARB assembly supports the following instructions:
* ABS - absolute value
* ADD - add
* ARL - address register load
* DP3 - 3-component
dot product
In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a scalar as a result". It is also used sometimes for other symmetric bilinear forms, for example in a pseudo-Euclidean space. is an alg ...
* DP4 - 4-component
dot product
In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a scalar as a result". It is also used sometimes for other symmetric bilinear forms, for example in a pseudo-Euclidean space. is an alg ...
* DPH - homogeneous
dot product
In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a scalar as a result". It is also used sometimes for other symmetric bilinear forms, for example in a pseudo-Euclidean space. is an alg ...
* DST - distance vector
* EX2 - exponential base 2
* EXP - exponential base 2 (approximate)
* FLR - floor
* FRC - fraction
* LG2 - logarithm base 2
* LIT - compute light coefficients
* LOG - logarithm base 2 (approximate)
* MAD - multiply and add
* MAX - maximum
* MIN - minimum
* MOV - move
* MUL - multiply
* POW - exponentiate
* RCP - reciprocal
* RSQ -
reciprocal square root
* SGE - set on greater than or equal
* SLT - set on less than
* SUB - subtract
* SWZ - extended
swizzle
* TEX - Texture lookup
* XPD -
cross product
In mathematics, the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a binary operation on two vectors in a three-dimensional oriented Euclidean vector space (named here E), and i ...
This is only a partial list of assembly instructions ; a reference can be found here
Shader Assembly Language (ARB/NV) Quick Reference Guide for OpenGL
ARB assembly provides no instructions for flow control or branching. SGE and SLT may be used to conditionally set or clear vectors or registers.
ARB interfaces provide no compiling step for assembly language.
GL_NV_fragment_program_option extends the ARB_fragment_program language with additional instructions.
GL_NV_fragment_program2, GL_NV_vertex_program2_option and GL_NV_vertex_program3 extend it further.
Sample code
A sample trivial ARB Vertex Shader
!!ARBvp1.0
TEMP vertexClip;
DP4 vertexClip.x, state.matrix.mvp.row vertex.position;
DP4 vertexClip.y, state.matrix.mvp.row vertex.position;
DP4 vertexClip.z, state.matrix.mvp.row vertex.position;
DP4 vertexClip.w, state.matrix.mvp.row vertex.position;
MOV result.position, vertexClip;
MOV result.color, vertex.color;
MOV result.texcoord vertex.texcoord;
END
A sample trivial ARB Fragment Shader
!!ARBfp1.0
TEMP color;
MUL color, fragment.texcoord y, 2.0;
ADD color, 1.0, -color;
ABS color, color;
ADD result.color, 1.0, -color;
MOV result.color.a, 1.0;
END
See also
*
OpenGL Architecture Review Board
The OpenGL Architecture Review Board (ARB) was an industry consortium that governed the OpenGL specification.
It was formed in 1992, and defined the conformance tests, approved the OpenGL specification and advanced the standard. On July 31, 2006, ...
*
Shader languages
*
SPIR-V
Standard Portable Intermediate Representation (SPIR) is an intermediate language for parallel compute and graphics by Khronos Group. It is used in multiple execution environments, including the Vulkan graphics API and the OpenCL compute API, to re ...
*
Comparison of assemblers
References
{{Reflist
Assembly languages
OpenGL
Shading languages