Merge branch 'asm-shader-rework-2'
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi-instruction-set.txt
index 939aaf0c2ae02f97b73a5c21bbc654d164dcab33..eb492076b7d2dcaf935d5bdc30406fac0327d762 100644 (file)
@@ -187,11 +187,7 @@ TGSI Instruction Specification
 
 1.2.6  CND0 - Condition Zero
 
-  dst.x = (src2.x >= 0.0) ? src0.x : src1.x
-  dst.y = (src2.y >= 0.0) ? src0.y : src1.y
-  dst.z = (src2.z >= 0.0) ? src0.z : src1.z
-  dst.w = (src2.w >= 0.0) ? src0.w : src1.w
-
+       Removed.  Use (CMP src2, src1, src0) instead.
 
 1.2.7  DOT2ADD - 2-component Dot Product And Add
 
@@ -262,7 +258,7 @@ TGSI Instruction Specification
   dst.w = round(src.w)
 
 
-1.3.10  EXPBASE2 - Exponent Base 2
+1.3.10  EXPBASE2 - Exponential Base 2
 
   dst.x = pow(2.0, src.x)
   dst.y = pow(2.0, src.x)
@@ -382,7 +378,7 @@ TGSI Instruction Specification
 
 1.5.7  KILP - Predicated Discard
 
-  TBD
+  discard
 
 
 1.5.8  LG2 - Logarithm Base 2
@@ -546,7 +542,7 @@ TGSI Instruction Specification
 
 1.6.3  BRA - Branch
 
-  TBD
+  pc = target
 
 
 1.6.4  CAL - Subroutine Call
@@ -599,7 +595,9 @@ TGSI Instruction Specification
 
 1.8.2  KIL - Conditional Discard
 
-  TBD
+  if (src.x < 0.0 || src.y < 0.0 || src.z < 0.0 || src.w < 0.0)
+    discard
+  endif
 
 
 1.8.3  SCS - Sine Cosine
@@ -663,9 +661,18 @@ TGSI Instruction Specification
   TBD
 
 
-1.9.8  LOOP - Loop
+1.9.8  BGNFOR - Begin a For-Loop
 
-  TBD
+  dst.x = floor(src.x)
+  dst.y = floor(src.y)
+  dst.z = floor(src.z)
+
+  if (dst.y <= 0)
+    pc = [matching ENDFOR] + 1
+  endif
+
+  Note: The destination must be a loop register.
+        The source must be a constant register.
 
 
 1.9.9  REP - Repeat
@@ -683,9 +690,16 @@ TGSI Instruction Specification
   TBD
 
 
-1.9.12  ENDLOOP - End Loop
+1.9.12  ENDFOR - End a For-Loop
 
-  TBD
+  dst.x = dst.x + dst.z
+  dst.y = dst.y - 1.0
+
+  if (dst.y > 0)
+    pc = [matching BGNFOR instruction] + 1
+  endif
+
+  Note: The destination must be a loop register.
 
 
 1.9.13  ENDREP - End Repeat
@@ -819,3 +833,299 @@ TGSI Instruction Specification
 
   TBD
 
+
+1.12  GL_NV_geometry_program4
+-----------------------------
+
+
+1.12.1  EMIT - Emit
+
+  TBD
+
+
+1.12.2  ENDPRIM - End Primitive
+
+  TBD
+
+
+1.13  GLSL
+----------
+
+
+1.13.1  BGNLOOP - Begin a Loop
+
+  TBD
+
+
+1.13.2  BGNSUB - Begin Subroutine
+
+  TBD
+
+
+1.13.3  ENDLOOP - End a Loop
+
+  TBD
+
+
+1.13.4  ENDSUB - End Subroutine
+
+  TBD
+
+
+1.13.5  INT - Truncate
+
+  Alias for TRUNC.
+
+
+1.13.6  NOISE1 - 1D Noise
+
+  TBD
+
+
+1.13.7  NOISE2 - 2D Noise
+
+  TBD
+
+
+1.13.8  NOISE3 - 3D Noise
+
+  TBD
+
+
+1.13.9  NOISE4 - 4D Noise
+
+  TBD
+
+
+1.13.10  NOP - No Operation
+
+  Do nothing.
+
+
+1.14  ps_1_1
+------------
+
+
+1.14.1  TEXKILL - Conditional Discard
+
+  Alias for KIL.
+
+
+1.15  ps_1_4
+------------
+
+
+1.15.1  TEXLD - Texture Lookup
+
+  Alias for TEX.
+
+
+1.16  ps_2_0
+------------
+
+
+1.16.1  M4X4 - Multiply Matrix
+
+  Alias for MULTIPLYMATRIX.
+
+
+1.16.2  M4X3 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.3  M3X4 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.4  M3X3 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.5  M3X2 - Multiply Matrix
+
+  Considered for removal from language.
+
+
+1.16.6  CRS - Cross Product
+
+  Alias for XPD.
+
+
+1.16.7  NRM4 - 4-component Vector Normalise
+
+  dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+  dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+  dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+  dst.w = src.w / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
+
+
+1.16.8  SINCOS - Sine Cosine
+
+  Alias for SCS.
+
+
+1.16.9  TEXLDB - Texture Lookup With Bias
+
+  Alias for TXB.
+
+
+1.16.10  DP2ADD - 2-component Dot Product And Add
+
+  Alias for DP2A.
+
+
+1.17  ps_2_x
+------------
+
+
+1.17.1  CALL - Subroutine Call
+
+  Alias for CAL.
+
+
+1.17.2  CALLNZ - Subroutine Call If Not Zero
+
+  TBD
+
+
+1.17.3  IFC - If
+
+  TBD
+
+
+1.17.4  BREAK - Break
+
+  Alias for BRK.
+
+
+1.17.5  BREAKC - Break Conditional
+
+  TBD
+
+
+1.17.6  DSX - Derivative Relative To X
+
+  Alias for DDX.
+
+
+1.17.7  DSY - Derivative Relative To Y
+
+  Alias for DDY.
+
+
+1.17.8  TEXLDD - Texture Lookup with Derivatives
+
+  Alias for TXD.
+
+
+1.18  vs_1_1
+------------
+
+
+1.18.1  EXPP - Approximate Exponential Base 2
+
+  Use EXP. See also 1.19.3.
+
+
+1.18.2  LOGP - Logarithm Base 2
+
+  Use LOG. See also 1.19.4.
+
+
+1.19  vs_2_0
+------------
+
+
+1.19.1  SGN - Set Sign
+
+  Alias for SSG.
+
+
+1.19.2  MOVA - Move Address Register
+
+  Alias for ARR.
+
+
+1.19.3  EXPP - Approximate Exponential Base 2
+
+  Use EX2.
+
+
+1.19.4  LOGP - Logarithm Base 2
+
+  Use LG2.
+
+
+2  Explanation of symbols used
+==============================
+
+
+2.1  Functions
+--------------
+
+
+  abs(x)            Absolute value of x.
+                    |x|
+                    (x < 0.0) ? -x : x
+
+  ceil(x)           Ceiling of x.
+
+  clamp(x,y,z)      Clamp x between y and z.
+                    (x < y) ? y : (x > z) ? z : x
+
+  cos(x)            Cosine of x.
+
+  floor(x)          Floor of x.
+
+  lg2(x)            Logarithm base 2 of x.
+
+  max(x,y)          Maximum of x and y.
+                    (x > y) ? x : y
+
+  min(x,y)          Minimum of x and y.
+                    (x < y) ? x : y
+
+  partialx(x)       Derivative of x relative to fragment's X.
+
+  partialy(x)       Derivative of x relative to fragment's Y.
+
+  pop()             Pop from stack.
+
+  pow(x,y)          Raise x to power of y.
+
+  push(x)           Push x on stack.
+
+  round(x)          Round x.
+
+  sin(x)            Sine of x.
+
+  sqrt(x)           Square root of x.
+
+  trunc(x)          Truncate x.
+
+
+2.2  Keywords
+-------------
+
+
+  discard           Discard fragment.
+
+  dst               First destination register.
+
+  dst0              First destination register.
+
+  pc                Program counter.
+
+  src               First source register.
+
+  src0              First source register.
+
+  src1              Second source register.
+
+  src2              Third source register.
+
+  target            Label of target instruction.
+