components as integers. Other instructions permit using registers as
two-component vectors with double precision; see :ref:`Double Opcodes`.
+When an instruction has a scalar result, the result is usually copied into
+each of the components of *dst*. When this happens, the result is said to be
+*replicated* to *dst*. :opcode:`RCP` is one such instruction.
+
Instruction Set
---------------
.. opcode:: RCP - Reciprocal
-.. math::
-
- dst.x = \frac{1}{src.x}
+This instruction replicates its result.
- dst.y = \frac{1}{src.x}
-
- dst.z = \frac{1}{src.x}
+.. math::
- dst.w = \frac{1}{src.x}
+ dst = \frac{1}{src.x}
.. opcode:: RSQ - Reciprocal Square Root
-.. math::
+This instruction replicates its result.
- dst.x = \frac{1}{\sqrt{|src.x|}}
-
- dst.y = \frac{1}{\sqrt{|src.x|}}
-
- dst.z = \frac{1}{\sqrt{|src.x|}}
+.. math::
- dst.w = \frac{1}{\sqrt{|src.x|}}
+ dst = \frac{1}{\sqrt{|src.x|}}
.. opcode:: EXP - Approximate Exponential Base 2
.. opcode:: DP3 - 3-component Dot Product
-.. math::
-
- dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
+This instruction replicates its result.
- dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
-
- dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
+.. math::
- dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
+ dst = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
.. opcode:: DP4 - 4-component Dot Product
-.. math::
-
- dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
-
- dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
+This instruction replicates its result.
- dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
+.. math::
- dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
+ dst = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
.. opcode:: DST - Distance Vector
.. opcode:: FLR - Floor
-This is identical to ARL.
+This is identical to :opcode:`ARL`.
.. math::
.. opcode:: EX2 - Exponential Base 2
-.. math::
-
- dst.x = 2^{src.x}
-
- dst.y = 2^{src.x}
+This instruction replicates its result.
- dst.z = 2^{src.x}
+.. math::
- dst.w = 2^{src.x}
+ dst = 2^{src.x}
.. opcode:: LG2 - Logarithm Base 2
-.. math::
-
- dst.x = \log_2{src.x}
-
- dst.y = \log_2{src.x}
+This instruction replicates its result.
- dst.z = \log_2{src.x}
+.. math::
- dst.w = \log_2{src.x}
+ dst = \log_2{src.x}
.. opcode:: POW - Power
-.. math::
-
- dst.x = src0.x^{src1.x}
+This instruction replicates its result.
- dst.y = src0.x^{src1.x}
-
- dst.z = src0.x^{src1.x}
+.. math::
- dst.w = src0.x^{src1.x}
+ dst = src0.x^{src1.x}
.. opcode:: XPD - Cross Product
.. opcode:: RCC - Reciprocal Clamped
+This instruction replicates its result.
+
XXX cleanup on aisle three
.. math::
- dst.x = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
-
- dst.y = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
-
- dst.z = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
-
- dst.w = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
+ dst = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
.. opcode:: DPH - Homogeneous Dot Product
-.. math::
-
- dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
+This instruction replicates its result.
- dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
-
- dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
+.. math::
- dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
+ dst = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
.. opcode:: COS - Cosine
-.. math::
-
- dst.x = \cos{src.x}
+This instruction replicates its result.
- dst.y = \cos{src.x}
-
- dst.z = \cos{src.x}
+.. math::
- dst.w = \cos{src.x}
+ dst = \cos{src.x}
.. opcode:: DDX - Derivative Relative To X
dst.w = 1
-Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: SEQ - Set On Equal
.. opcode:: SFL - Set On False
-.. math::
+This instruction replicates its result.
- dst.x = 0
+.. math::
- dst.y = 0
+ dst = 0
- dst.z = 0
+.. note::
- dst.w = 0
+ Considered for removal.
-Considered for removal.
.. opcode:: SGT - Set On Greater Than
.. opcode:: SIN - Sine
-.. math::
-
- dst.x = \sin{src.x}
+This instruction replicates its result.
- dst.y = \sin{src.x}
-
- dst.z = \sin{src.x}
+.. math::
- dst.w = \sin{src.x}
+ dst = \sin{src.x}
.. opcode:: SLE - Set On Less Equal Than
.. opcode:: STR - Set On True
-.. math::
-
- dst.x = 1
-
- dst.y = 1
+This instruction replicates its result.
- dst.z = 1
+.. math::
- dst.w = 1
+ dst = 1
.. opcode:: TEX - Texture Lookup
TBD
- Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: UP2US - Unpack Two Unsigned 16-Bit Scalars
TBD
- Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: UP4B - Unpack Four Signed 8-Bit Values
TBD
- Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: UP4UB - Unpack Four Unsigned 8-Bit Scalars
TBD
- Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: X2D - 2D Coordinate Transformation
dst.w = src0.y + src1.x \times src2.z + src1.y \times src2.w
-Considered for removal.
+.. note::
+
+ Considered for removal.
From GL_NV_vertex_program2
TBD
- Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: ARR - Address Register Load With Round
pc = target
- Considered for removal.
+.. note::
+
+ Considered for removal.
.. opcode:: CAL - Subroutine Call
.. opcode:: DP2 - 2-component Dot Product
-.. math::
-
- dst.x = src0.x \times src1.x + src0.y \times src1.y
+This instruction replicates its result.
- dst.y = src0.x \times src1.x + src0.y \times src1.y
-
- dst.z = src0.x \times src1.x + src0.y \times src1.y
+.. math::
- dst.w = src0.x \times src1.x + src0.y \times src1.y
+ dst = src0.x \times src1.x + src0.y \times src1.y
.. opcode:: TXL - Texture Lookup With LOD
Note: The destination must be a loop register.
The source must be a constant register.
- Considered for cleanup / removal.
+.. note::
+
+ Considered for cleanup.
+
+.. note::
+
+ Considered for removal.
.. opcode:: REP - Repeat
Note: The destination must be a loop register.
- Considered for cleanup / removal.
+.. note::
+
+ Considered for cleanup.
+
+.. note::
+
+ Considered for removal.
.. opcode:: ENDREP - End Repeat
push(src.z)
push(src.w)
- Considered for cleanup / removal.
+.. note::
+
+ Considered for cleanup.
+
+.. note::
+
+ Considered for removal.
.. opcode:: POPA - Pop Address Register From Stack
dst.y = pop()
dst.x = pop()
- Considered for cleanup / removal.
+.. note::
+
+ Considered for cleanup.
+
+.. note::
+
+ Considered for removal.
From GL_NV_gpu_program4
.. opcode:: NRM4 - 4-component Vector Normalise
-.. math::
-
- dst.x = \frac{src.x}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
+This instruction replicates its result.
- dst.y = \frac{src.y}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
-
- dst.z = \frac{src.z}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
+.. math::
- dst.w = \frac{src.w}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
+ dst = \frac{src.x}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
ps_2_x