Corbin Simpson | c686e17 | 2009-12-20 15:00:40 -0800 | [diff] [blame] | 1 | TGSI |
| 2 | ==== |
| 3 | |
| 4 | TGSI, Tungsten Graphics Shader Instructions, is an intermediate language |
| 5 | for describing shaders. Since Gallium is inherently shaderful, shaders are |
| 6 | an important part of the API. TGSI is the only intermediate representation |
| 7 | used by all drivers. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 8 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 9 | From GL_NV_vertex_program |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 10 | ------------------------- |
| 11 | |
| 12 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 13 | ARL - Address Register Load |
| 14 | |
| 15 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 16 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 17 | dst.x = \lfloor src.x\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 18 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 19 | dst.y = \lfloor src.y\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 20 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 21 | dst.z = \lfloor src.z\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 22 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 23 | dst.w = \lfloor src.w\rfloor |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 24 | |
| 25 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 26 | MOV - Move |
| 27 | |
| 28 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 29 | |
| 30 | dst.x = src.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 31 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 32 | dst.y = src.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 33 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 34 | dst.z = src.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 35 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 36 | dst.w = src.w |
| 37 | |
| 38 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 39 | LIT - Light Coefficients |
| 40 | |
| 41 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 42 | |
| 43 | dst.x = 1.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 44 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 45 | dst.y = max(src.x, 0.0) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 46 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 47 | dst.z = (src.x > 0.0) ? max(src.y, 0.0)^{clamp(src.w, -128.0, 128.0))} : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 48 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 49 | dst.w = 1.0 |
| 50 | |
| 51 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 52 | RCP - Reciprocal |
| 53 | |
| 54 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 55 | |
| 56 | dst.x = 1.0 / src.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 57 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 58 | dst.y = 1.0 / src.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 59 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 60 | dst.z = 1.0 / src.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 61 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 62 | dst.w = 1.0 / src.x |
| 63 | |
| 64 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 65 | RSQ - Reciprocal Square Root |
| 66 | |
| 67 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 68 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 69 | dst.x = 1.0 / \sqrt{abs(src.x)} |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 70 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 71 | dst.y = 1.0 / \sqrt{abs(src.x)} |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 72 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 73 | dst.z = 1.0 / \sqrt{abs(src.x)} |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 74 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 75 | dst.w = 1.0 / \sqrt{abs(src.x)} |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 76 | |
| 77 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 78 | EXP - Approximate Exponential Base 2 |
| 79 | |
| 80 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 81 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 82 | dst.x = 2^{\lfloor src.x\rfloor} |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 83 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 84 | dst.y = src.x - \lfloor src.x\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 85 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 86 | dst.z = 2^{src.x} |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 87 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 88 | dst.w = 1.0 |
| 89 | |
| 90 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 91 | LOG - Approximate Logarithm Base 2 |
| 92 | |
| 93 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 94 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 95 | dst.x = \lfloor lg2(abs(src.x)))\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 96 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 97 | dst.y = abs(src.x) / 2^{\lfloor lg2(abs(src.x))\rfloor} |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 98 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 99 | dst.z = lg2(abs(src.x)) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 100 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 101 | dst.w = 1.0 |
| 102 | |
| 103 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 104 | MUL - Multiply |
| 105 | |
| 106 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 107 | |
| 108 | dst.x = src0.x * src1.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 109 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 110 | dst.y = src0.y * src1.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 111 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 112 | dst.z = src0.z * src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 113 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 114 | dst.w = src0.w * src1.w |
| 115 | |
| 116 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 117 | ADD - Add |
| 118 | |
| 119 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 120 | |
| 121 | dst.x = src0.x + src1.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 122 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 123 | dst.y = src0.y + src1.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 124 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 125 | dst.z = src0.z + src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 126 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 127 | dst.w = src0.w + src1.w |
| 128 | |
| 129 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 130 | DP3 - 3-component Dot Product |
| 131 | |
| 132 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 133 | |
| 134 | dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 135 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 136 | dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 137 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 138 | dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 139 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 140 | dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z |
| 141 | |
| 142 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 143 | DP4 - 4-component Dot Product |
| 144 | |
| 145 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 146 | |
| 147 | dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 148 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 149 | dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 150 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 151 | dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 152 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 153 | dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w |
| 154 | |
| 155 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 156 | DST - Distance Vector |
| 157 | |
| 158 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 159 | |
| 160 | dst.x = 1.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 161 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 162 | dst.y = src0.y * src1.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 163 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 164 | dst.z = src0.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 165 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 166 | dst.w = src1.w |
| 167 | |
| 168 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 169 | MIN - Minimum |
| 170 | |
| 171 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 172 | |
| 173 | dst.x = min(src0.x, src1.x) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 174 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 175 | dst.y = min(src0.y, src1.y) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 176 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 177 | dst.z = min(src0.z, src1.z) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 178 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 179 | dst.w = min(src0.w, src1.w) |
| 180 | |
| 181 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 182 | MAX - Maximum |
| 183 | |
| 184 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 185 | |
| 186 | dst.x = max(src0.x, src1.x) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 187 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 188 | dst.y = max(src0.y, src1.y) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 189 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 190 | dst.z = max(src0.z, src1.z) |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 191 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 192 | dst.w = max(src0.w, src1.w) |
| 193 | |
| 194 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 195 | SLT - Set On Less Than |
| 196 | |
| 197 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 198 | |
| 199 | dst.x = (src0.x < src1.x) ? 1.0 : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 200 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 201 | dst.y = (src0.y < src1.y) ? 1.0 : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 202 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 203 | dst.z = (src0.z < src1.z) ? 1.0 : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 204 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 205 | dst.w = (src0.w < src1.w) ? 1.0 : 0.0 |
| 206 | |
| 207 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 208 | SGE - Set On Greater Equal Than |
| 209 | |
| 210 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 211 | |
| 212 | dst.x = (src0.x >= src1.x) ? 1.0 : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 213 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 214 | dst.y = (src0.y >= src1.y) ? 1.0 : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 215 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 216 | dst.z = (src0.z >= src1.z) ? 1.0 : 0.0 |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 217 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 218 | dst.w = (src0.w >= src1.w) ? 1.0 : 0.0 |
| 219 | |
| 220 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 221 | MAD - Multiply And Add |
| 222 | |
| 223 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 224 | |
| 225 | dst.x = src0.x * src1.x + src2.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 226 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 227 | dst.y = src0.y * src1.y + src2.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 228 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 229 | dst.z = src0.z * src1.z + src2.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 230 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 231 | dst.w = src0.w * src1.w + src2.w |
| 232 | |
| 233 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 234 | SUB - Subtract |
| 235 | |
| 236 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 237 | |
| 238 | dst.x = src0.x - src1.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 239 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 240 | dst.y = src0.y - src1.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 241 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 242 | dst.z = src0.z - src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 243 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 244 | dst.w = src0.w - src1.w |
| 245 | |
| 246 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 247 | LRP - Linear Interpolate |
| 248 | |
| 249 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 250 | |
| 251 | dst.x = src0.x * (src1.x - src2.x) + src2.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 252 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 253 | dst.y = src0.y * (src1.y - src2.y) + src2.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 254 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 255 | dst.z = src0.z * (src1.z - src2.z) + src2.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 256 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 257 | dst.w = src0.w * (src1.w - src2.w) + src2.w |
| 258 | |
| 259 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 260 | CND - Condition |
| 261 | |
| 262 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 263 | |
| 264 | dst.x = (src2.x > 0.5) ? src0.x : src1.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 265 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 266 | dst.y = (src2.y > 0.5) ? src0.y : src1.y |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 267 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 268 | dst.z = (src2.z > 0.5) ? src0.z : src1.z |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 269 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 270 | dst.w = (src2.w > 0.5) ? src0.w : src1.w |
| 271 | |
| 272 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 273 | DP2A - 2-component Dot Product And Add |
| 274 | |
| 275 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 276 | |
| 277 | dst.x = src0.x * src1.x + src0.y * src1.y + src2.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 278 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 279 | dst.y = src0.x * src1.x + src0.y * src1.y + src2.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 280 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 281 | dst.z = src0.x * src1.x + src0.y * src1.y + src2.x |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 282 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 283 | dst.w = src0.x * src1.x + src0.y * src1.y + src2.x |
| 284 | |
| 285 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 286 | FRAC - Fraction |
| 287 | |
| 288 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 289 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 290 | dst.x = src.x - \lfloor src.x\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 291 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 292 | dst.y = src.y - \lfloor src.y\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 293 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 294 | dst.z = src.z - \lfloor src.z\rfloor |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 295 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 296 | dst.w = src.w - \lfloor src.w\rfloor |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 297 | |
| 298 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 299 | CLAMP - Clamp |
| 300 | |
| 301 | .. math:: |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 302 | |
| 303 | dst.x = clamp(src0.x, src1.x, src2.x) |
| 304 | dst.y = clamp(src0.y, src1.y, src2.y) |
| 305 | dst.z = clamp(src0.z, src1.z, src2.z) |
| 306 | dst.w = clamp(src0.w, src1.w, src2.w) |
| 307 | |
| 308 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 309 | FLR - Floor |
| 310 | |
| 311 | This is identical to ARL. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 312 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 313 | .. math:: |
| 314 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 315 | dst.x = \lfloor src.x\rfloor |
| 316 | |
| 317 | dst.y = \lfloor src.y\rfloor |
| 318 | |
| 319 | dst.z = \lfloor src.z\rfloor |
| 320 | |
| 321 | dst.w = \lfloor src.w\rfloor |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 322 | |
| 323 | |
| 324 | 1.3.9 ROUND - Round |
| 325 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 326 | .. math:: |
| 327 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 328 | dst.x = round(src.x) |
| 329 | dst.y = round(src.y) |
| 330 | dst.z = round(src.z) |
| 331 | dst.w = round(src.w) |
| 332 | |
| 333 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 334 | EX2 - Exponential Base 2 |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 335 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 336 | .. math:: |
| 337 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 338 | dst.x = 2^{src.x} |
| 339 | |
| 340 | dst.y = 2^{src.x} |
| 341 | |
| 342 | dst.z = 2^{src.x} |
| 343 | |
| 344 | dst.w = 2^{src.x} |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 345 | |
| 346 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 347 | 1.3.11 LG2 - Logarithm Base 2 |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 348 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 349 | .. math:: |
| 350 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 351 | dst.x = lg2(src.x) |
| 352 | dst.y = lg2(src.x) |
| 353 | dst.z = lg2(src.x) |
| 354 | dst.w = lg2(src.x) |
| 355 | |
| 356 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 357 | POW - Power |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 358 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 359 | .. math:: |
| 360 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 361 | dst.x = src0.x^{src1.x} |
| 362 | |
| 363 | dst.y = src0.x^{src1.x} |
| 364 | |
| 365 | dst.z = src0.x^{src1.x} |
| 366 | |
| 367 | dst.w = src0.x^{src1.x} |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 368 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 369 | 1.3.15 XPD - Cross Product |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 370 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 371 | .. math:: |
| 372 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 373 | dst.x = src0.y * src1.z - src1.y * src0.z |
| 374 | dst.y = src0.z * src1.x - src1.z * src0.x |
| 375 | dst.z = src0.x * src1.y - src1.x * src0.y |
| 376 | dst.w = 1.0 |
| 377 | |
| 378 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 379 | 1.4.1 ABS - Absolute |
| 380 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 381 | .. math:: |
| 382 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 383 | dst.x = abs(src.x) |
| 384 | dst.y = abs(src.y) |
| 385 | dst.z = abs(src.z) |
| 386 | dst.w = abs(src.w) |
| 387 | |
| 388 | |
| 389 | 1.4.2 RCC - Reciprocal Clamped |
| 390 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 391 | .. math:: |
| 392 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 393 | dst.x = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) |
| 394 | dst.y = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) |
| 395 | dst.z = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) |
| 396 | dst.w = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) |
| 397 | |
| 398 | |
| 399 | 1.4.3 DPH - Homogeneous Dot Product |
| 400 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 401 | .. math:: |
| 402 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 403 | dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w |
| 404 | dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w |
| 405 | dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w |
| 406 | dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w |
| 407 | |
| 408 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 409 | COS - Cosine |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 410 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 411 | .. math:: |
| 412 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 413 | dst.x = \cos{src.x} |
| 414 | |
| 415 | dst.y = \cos{src.x} |
| 416 | |
| 417 | dst.z = \cos{src.x} |
| 418 | |
| 419 | dst.w = \cos{src.w} |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 420 | |
| 421 | |
| 422 | 1.5.2 DDX - Derivative Relative To X |
| 423 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 424 | .. math:: |
| 425 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 426 | dst.x = partialx(src.x) |
| 427 | dst.y = partialx(src.y) |
| 428 | dst.z = partialx(src.z) |
| 429 | dst.w = partialx(src.w) |
| 430 | |
| 431 | |
| 432 | 1.5.3 DDY - Derivative Relative To Y |
| 433 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 434 | .. math:: |
| 435 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 436 | dst.x = partialy(src.x) |
| 437 | dst.y = partialy(src.y) |
| 438 | dst.z = partialy(src.z) |
| 439 | dst.w = partialy(src.w) |
| 440 | |
| 441 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 442 | 1.5.7 KILP - Predicated Discard |
| 443 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 444 | .. math:: |
| 445 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 446 | discard |
| 447 | |
| 448 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 449 | 1.5.10 PK2H - Pack Two 16-bit Floats |
| 450 | |
| 451 | TBD |
| 452 | |
| 453 | |
| 454 | 1.5.11 PK2US - Pack Two Unsigned 16-bit Scalars |
| 455 | |
| 456 | TBD |
| 457 | |
| 458 | |
| 459 | 1.5.12 PK4B - Pack Four Signed 8-bit Scalars |
| 460 | |
| 461 | TBD |
| 462 | |
| 463 | |
| 464 | 1.5.13 PK4UB - Pack Four Unsigned 8-bit Scalars |
| 465 | |
| 466 | TBD |
| 467 | |
| 468 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 469 | 1.5.15 RFL - Reflection Vector |
| 470 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 471 | .. math:: |
| 472 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 473 | dst.x = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.x - src1.x |
| 474 | dst.y = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.y - src1.y |
| 475 | dst.z = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.z - src1.z |
| 476 | dst.w = 1.0 |
| 477 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 478 | Considered for removal. |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 479 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 480 | |
| 481 | 1.5.16 SEQ - Set On Equal |
| 482 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 483 | .. math:: |
| 484 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 485 | dst.x = (src0.x == src1.x) ? 1.0 : 0.0 |
| 486 | dst.y = (src0.y == src1.y) ? 1.0 : 0.0 |
| 487 | dst.z = (src0.z == src1.z) ? 1.0 : 0.0 |
| 488 | dst.w = (src0.w == src1.w) ? 1.0 : 0.0 |
| 489 | |
| 490 | |
| 491 | 1.5.17 SFL - Set On False |
| 492 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 493 | .. math:: |
| 494 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 495 | dst.x = 0.0 |
| 496 | dst.y = 0.0 |
| 497 | dst.z = 0.0 |
| 498 | dst.w = 0.0 |
| 499 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 500 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 501 | |
| 502 | 1.5.18 SGT - Set On Greater Than |
| 503 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 504 | .. math:: |
| 505 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 506 | dst.x = (src0.x > src1.x) ? 1.0 : 0.0 |
| 507 | dst.y = (src0.y > src1.y) ? 1.0 : 0.0 |
| 508 | dst.z = (src0.z > src1.z) ? 1.0 : 0.0 |
| 509 | dst.w = (src0.w > src1.w) ? 1.0 : 0.0 |
| 510 | |
| 511 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 512 | SIN - Sine |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 513 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 514 | .. math:: |
| 515 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 516 | dst.x = \sin{src.x} |
| 517 | |
| 518 | dst.y = \sin{src.x} |
| 519 | |
| 520 | dst.z = \sin{src.x} |
| 521 | |
| 522 | dst.w = \sin{src.w} |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 523 | |
| 524 | |
| 525 | 1.5.20 SLE - Set On Less Equal Than |
| 526 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 527 | .. math:: |
| 528 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 529 | dst.x = (src0.x <= src1.x) ? 1.0 : 0.0 |
| 530 | dst.y = (src0.y <= src1.y) ? 1.0 : 0.0 |
| 531 | dst.z = (src0.z <= src1.z) ? 1.0 : 0.0 |
| 532 | dst.w = (src0.w <= src1.w) ? 1.0 : 0.0 |
| 533 | |
| 534 | |
| 535 | 1.5.21 SNE - Set On Not Equal |
| 536 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 537 | .. math:: |
| 538 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 539 | dst.x = (src0.x != src1.x) ? 1.0 : 0.0 |
| 540 | dst.y = (src0.y != src1.y) ? 1.0 : 0.0 |
| 541 | dst.z = (src0.z != src1.z) ? 1.0 : 0.0 |
| 542 | dst.w = (src0.w != src1.w) ? 1.0 : 0.0 |
| 543 | |
| 544 | |
| 545 | 1.5.22 STR - Set On True |
| 546 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 547 | .. math:: |
| 548 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 549 | dst.x = 1.0 |
| 550 | dst.y = 1.0 |
| 551 | dst.z = 1.0 |
| 552 | dst.w = 1.0 |
| 553 | |
| 554 | |
| 555 | 1.5.23 TEX - Texture Lookup |
| 556 | |
| 557 | TBD |
| 558 | |
| 559 | |
| 560 | 1.5.24 TXD - Texture Lookup with Derivatives |
| 561 | |
| 562 | TBD |
| 563 | |
| 564 | |
| 565 | 1.5.25 TXP - Projective Texture Lookup |
| 566 | |
| 567 | TBD |
| 568 | |
| 569 | |
| 570 | 1.5.26 UP2H - Unpack Two 16-Bit Floats |
| 571 | |
| 572 | TBD |
| 573 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 574 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 575 | |
| 576 | 1.5.27 UP2US - Unpack Two Unsigned 16-Bit Scalars |
| 577 | |
| 578 | TBD |
| 579 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 580 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 581 | |
| 582 | 1.5.28 UP4B - Unpack Four Signed 8-Bit Values |
| 583 | |
| 584 | TBD |
| 585 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 586 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 587 | |
| 588 | 1.5.29 UP4UB - Unpack Four Unsigned 8-Bit Scalars |
| 589 | |
| 590 | TBD |
| 591 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 592 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 593 | |
| 594 | 1.5.30 X2D - 2D Coordinate Transformation |
| 595 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 596 | .. math:: |
| 597 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 598 | dst.x = src0.x + src1.x * src2.x + src1.y * src2.y |
| 599 | dst.y = src0.y + src1.x * src2.z + src1.y * src2.w |
| 600 | dst.z = src0.x + src1.x * src2.x + src1.y * src2.y |
| 601 | dst.w = src0.y + src1.x * src2.z + src1.y * src2.w |
| 602 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 603 | Considered for removal. |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 604 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 605 | |
| 606 | 1.6 GL_NV_vertex_program2 |
| 607 | -------------------------- |
| 608 | |
| 609 | |
| 610 | 1.6.1 ARA - Address Register Add |
| 611 | |
| 612 | TBD |
| 613 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 614 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 615 | |
| 616 | 1.6.2 ARR - Address Register Load With Round |
| 617 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 618 | .. math:: |
| 619 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 620 | dst.x = round(src.x) |
| 621 | dst.y = round(src.y) |
| 622 | dst.z = round(src.z) |
| 623 | dst.w = round(src.w) |
| 624 | |
| 625 | |
| 626 | 1.6.3 BRA - Branch |
| 627 | |
| 628 | pc = target |
| 629 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 630 | Considered for removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 631 | |
| 632 | 1.6.4 CAL - Subroutine Call |
| 633 | |
| 634 | push(pc) |
| 635 | pc = target |
| 636 | |
| 637 | |
| 638 | 1.6.5 RET - Subroutine Call Return |
| 639 | |
| 640 | pc = pop() |
| 641 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 642 | Potential restrictions: |
| 643 | * Only occurs at end of function. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 644 | |
| 645 | 1.6.6 SSG - Set Sign |
| 646 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 647 | .. math:: |
| 648 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 649 | dst.x = (src.x > 0.0) ? 1.0 : (src.x < 0.0) ? -1.0 : 0.0 |
| 650 | dst.y = (src.y > 0.0) ? 1.0 : (src.y < 0.0) ? -1.0 : 0.0 |
| 651 | dst.z = (src.z > 0.0) ? 1.0 : (src.z < 0.0) ? -1.0 : 0.0 |
| 652 | dst.w = (src.w > 0.0) ? 1.0 : (src.w < 0.0) ? -1.0 : 0.0 |
| 653 | |
| 654 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 655 | 1.8.1 CMP - Compare |
| 656 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 657 | .. math:: |
| 658 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 659 | dst.x = (src0.x < 0.0) ? src1.x : src2.x |
| 660 | dst.y = (src0.y < 0.0) ? src1.y : src2.y |
| 661 | dst.z = (src0.z < 0.0) ? src1.z : src2.z |
| 662 | dst.w = (src0.w < 0.0) ? src1.w : src2.w |
| 663 | |
| 664 | |
| 665 | 1.8.2 KIL - Conditional Discard |
| 666 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 667 | .. math:: |
| 668 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 669 | if (src.x < 0.0 || src.y < 0.0 || src.z < 0.0 || src.w < 0.0) |
| 670 | discard |
| 671 | endif |
| 672 | |
| 673 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 674 | SCS - Sine Cosine |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 675 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 676 | .. math:: |
| 677 | |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 678 | dst.x = \cos{src.x} |
| 679 | |
| 680 | dst.y = \sin{src.x} |
| 681 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 682 | dst.z = 0.0 |
Corbin Simpson | d92a685 | 2009-12-21 19:30:29 -0800 | [diff] [blame] | 683 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 684 | dst.y = 1.0 |
| 685 | |
| 686 | |
| 687 | 1.8.4 TXB - Texture Lookup With Bias |
| 688 | |
| 689 | TBD |
| 690 | |
| 691 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 692 | 1.9.1 NRM - 3-component Vector Normalise |
| 693 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 694 | .. math:: |
| 695 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 696 | dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z) |
| 697 | dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z) |
| 698 | dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z) |
| 699 | dst.w = 1.0 |
| 700 | |
| 701 | |
| 702 | 1.9.2 DIV - Divide |
| 703 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 704 | .. math:: |
| 705 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 706 | dst.x = src0.x / src1.x |
| 707 | dst.y = src0.y / src1.y |
| 708 | dst.z = src0.z / src1.z |
| 709 | dst.w = src0.w / src1.w |
| 710 | |
| 711 | |
| 712 | 1.9.3 DP2 - 2-component Dot Product |
| 713 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 714 | .. math:: |
| 715 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 716 | dst.x = src0.x * src1.x + src0.y * src1.y |
| 717 | dst.y = src0.x * src1.x + src0.y * src1.y |
| 718 | dst.z = src0.x * src1.x + src0.y * src1.y |
| 719 | dst.w = src0.x * src1.x + src0.y * src1.y |
| 720 | |
| 721 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 722 | 1.9.5 TXL - Texture Lookup With LOD |
| 723 | |
| 724 | TBD |
| 725 | |
| 726 | |
| 727 | 1.9.6 BRK - Break |
| 728 | |
| 729 | TBD |
| 730 | |
| 731 | |
| 732 | 1.9.7 IF - If |
| 733 | |
| 734 | TBD |
| 735 | |
| 736 | |
| 737 | 1.9.8 BGNFOR - Begin a For-Loop |
| 738 | |
| 739 | dst.x = floor(src.x) |
| 740 | dst.y = floor(src.y) |
| 741 | dst.z = floor(src.z) |
| 742 | |
| 743 | if (dst.y <= 0) |
| 744 | pc = [matching ENDFOR] + 1 |
| 745 | endif |
| 746 | |
| 747 | Note: The destination must be a loop register. |
| 748 | The source must be a constant register. |
| 749 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 750 | Considered for cleanup / removal. |
| 751 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 752 | |
| 753 | 1.9.9 REP - Repeat |
| 754 | |
| 755 | TBD |
| 756 | |
| 757 | |
| 758 | 1.9.10 ELSE - Else |
| 759 | |
| 760 | TBD |
| 761 | |
| 762 | |
| 763 | 1.9.11 ENDIF - End If |
| 764 | |
| 765 | TBD |
| 766 | |
| 767 | |
| 768 | 1.9.12 ENDFOR - End a For-Loop |
| 769 | |
| 770 | dst.x = dst.x + dst.z |
| 771 | dst.y = dst.y - 1.0 |
| 772 | |
| 773 | if (dst.y > 0) |
| 774 | pc = [matching BGNFOR instruction] + 1 |
| 775 | endif |
| 776 | |
| 777 | Note: The destination must be a loop register. |
| 778 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 779 | Considered for cleanup / removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 780 | |
| 781 | 1.9.13 ENDREP - End Repeat |
| 782 | |
| 783 | TBD |
| 784 | |
| 785 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 786 | 1.10.1 PUSHA - Push Address Register On Stack |
| 787 | |
| 788 | push(src.x) |
| 789 | push(src.y) |
| 790 | push(src.z) |
| 791 | push(src.w) |
| 792 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 793 | Considered for cleanup / removal. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 794 | |
| 795 | 1.10.2 POPA - Pop Address Register From Stack |
| 796 | |
| 797 | dst.w = pop() |
| 798 | dst.z = pop() |
| 799 | dst.y = pop() |
| 800 | dst.x = pop() |
| 801 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 802 | Considered for cleanup / removal. |
| 803 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 804 | |
| 805 | 1.11 GL_NV_gpu_program4 |
| 806 | ------------------------ |
| 807 | |
Keith Whitwell | 14eacb0 | 2009-12-21 23:38:29 +0000 | [diff] [blame] | 808 | Support for these opcodes indicated by a special pipe capability bit (TBD). |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 809 | |
| 810 | 1.11.1 CEIL - Ceiling |
| 811 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 812 | .. math:: |
| 813 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 814 | dst.x = ceil(src.x) |
| 815 | dst.y = ceil(src.y) |
| 816 | dst.z = ceil(src.z) |
| 817 | dst.w = ceil(src.w) |
| 818 | |
| 819 | |
| 820 | 1.11.2 I2F - Integer To Float |
| 821 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 822 | .. math:: |
| 823 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 824 | dst.x = (float) src.x |
| 825 | dst.y = (float) src.y |
| 826 | dst.z = (float) src.z |
| 827 | dst.w = (float) src.w |
| 828 | |
| 829 | |
| 830 | 1.11.3 NOT - Bitwise Not |
| 831 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 832 | .. math:: |
| 833 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 834 | dst.x = ~src.x |
| 835 | dst.y = ~src.y |
| 836 | dst.z = ~src.z |
| 837 | dst.w = ~src.w |
| 838 | |
| 839 | |
| 840 | 1.11.4 TRUNC - Truncate |
| 841 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 842 | .. math:: |
| 843 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 844 | dst.x = trunc(src.x) |
| 845 | dst.y = trunc(src.y) |
| 846 | dst.z = trunc(src.z) |
| 847 | dst.w = trunc(src.w) |
| 848 | |
| 849 | |
| 850 | 1.11.5 SHL - Shift Left |
| 851 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 852 | .. math:: |
| 853 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 854 | dst.x = src0.x << src1.x |
| 855 | dst.y = src0.y << src1.x |
| 856 | dst.z = src0.z << src1.x |
| 857 | dst.w = src0.w << src1.x |
| 858 | |
| 859 | |
| 860 | 1.11.6 SHR - Shift Right |
| 861 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 862 | .. math:: |
| 863 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 864 | dst.x = src0.x >> src1.x |
| 865 | dst.y = src0.y >> src1.x |
| 866 | dst.z = src0.z >> src1.x |
| 867 | dst.w = src0.w >> src1.x |
| 868 | |
| 869 | |
| 870 | 1.11.7 AND - Bitwise And |
| 871 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 872 | .. math:: |
| 873 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 874 | dst.x = src0.x & src1.x |
| 875 | dst.y = src0.y & src1.y |
| 876 | dst.z = src0.z & src1.z |
| 877 | dst.w = src0.w & src1.w |
| 878 | |
| 879 | |
| 880 | 1.11.8 OR - Bitwise Or |
| 881 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 882 | .. math:: |
| 883 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 884 | dst.x = src0.x | src1.x |
| 885 | dst.y = src0.y | src1.y |
| 886 | dst.z = src0.z | src1.z |
| 887 | dst.w = src0.w | src1.w |
| 888 | |
| 889 | |
| 890 | 1.11.9 MOD - Modulus |
| 891 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 892 | .. math:: |
| 893 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 894 | dst.x = src0.x % src1.x |
| 895 | dst.y = src0.y % src1.y |
| 896 | dst.z = src0.z % src1.z |
| 897 | dst.w = src0.w % src1.w |
| 898 | |
| 899 | |
| 900 | 1.11.10 XOR - Bitwise Xor |
| 901 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 902 | .. math:: |
| 903 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 904 | dst.x = src0.x ^ src1.x |
| 905 | dst.y = src0.y ^ src1.y |
| 906 | dst.z = src0.z ^ src1.z |
| 907 | dst.w = src0.w ^ src1.w |
| 908 | |
| 909 | |
| 910 | 1.11.11 SAD - Sum Of Absolute Differences |
| 911 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 912 | .. math:: |
| 913 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 914 | dst.x = abs(src0.x - src1.x) + src2.x |
| 915 | dst.y = abs(src0.y - src1.y) + src2.y |
| 916 | dst.z = abs(src0.z - src1.z) + src2.z |
| 917 | dst.w = abs(src0.w - src1.w) + src2.w |
| 918 | |
| 919 | |
| 920 | 1.11.12 TXF - Texel Fetch |
| 921 | |
| 922 | TBD |
| 923 | |
| 924 | |
| 925 | 1.11.13 TXQ - Texture Size Query |
| 926 | |
| 927 | TBD |
| 928 | |
| 929 | |
| 930 | 1.11.14 CONT - Continue |
| 931 | |
| 932 | TBD |
| 933 | |
| 934 | |
| 935 | 1.12 GL_NV_geometry_program4 |
| 936 | ----------------------------- |
| 937 | |
| 938 | |
| 939 | 1.12.1 EMIT - Emit |
| 940 | |
| 941 | TBD |
| 942 | |
| 943 | |
| 944 | 1.12.2 ENDPRIM - End Primitive |
| 945 | |
| 946 | TBD |
| 947 | |
| 948 | |
| 949 | 1.13 GLSL |
| 950 | ---------- |
| 951 | |
| 952 | |
| 953 | 1.13.1 BGNLOOP - Begin a Loop |
| 954 | |
| 955 | TBD |
| 956 | |
| 957 | |
| 958 | 1.13.2 BGNSUB - Begin Subroutine |
| 959 | |
| 960 | TBD |
| 961 | |
| 962 | |
| 963 | 1.13.3 ENDLOOP - End a Loop |
| 964 | |
| 965 | TBD |
| 966 | |
| 967 | |
| 968 | 1.13.4 ENDSUB - End Subroutine |
| 969 | |
| 970 | TBD |
| 971 | |
| 972 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 973 | |
| 974 | 1.13.10 NOP - No Operation |
| 975 | |
| 976 | Do nothing. |
| 977 | |
| 978 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 979 | |
| 980 | 1.16.7 NRM4 - 4-component Vector Normalise |
| 981 | |
Corbin Simpson | e8ed3b9 | 2009-12-21 19:12:55 -0800 | [diff] [blame] | 982 | .. math:: |
| 983 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 984 | dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w) |
| 985 | dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w) |
| 986 | dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w) |
| 987 | dst.w = src.w / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w) |
| 988 | |
| 989 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 990 | 1.17 ps_2_x |
| 991 | ------------ |
| 992 | |
| 993 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 994 | 1.17.2 CALLNZ - Subroutine Call If Not Zero |
| 995 | |
| 996 | TBD |
| 997 | |
| 998 | |
| 999 | 1.17.3 IFC - If |
| 1000 | |
| 1001 | TBD |
| 1002 | |
| 1003 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 1004 | 1.17.5 BREAKC - Break Conditional |
| 1005 | |
| 1006 | TBD |
| 1007 | |
| 1008 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 1009 | 2 Explanation of symbols used |
| 1010 | ============================== |
| 1011 | |
| 1012 | |
| 1013 | 2.1 Functions |
| 1014 | -------------- |
| 1015 | |
| 1016 | |
| 1017 | abs(x) Absolute value of x. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 1018 | (x < 0.0) ? -x : x |
| 1019 | |
| 1020 | ceil(x) Ceiling of x. |
| 1021 | |
| 1022 | clamp(x,y,z) Clamp x between y and z. |
| 1023 | (x < y) ? y : (x > z) ? z : x |
| 1024 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 1025 | :math:`\lfloor x\rfloor` Floor of `x`. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 1026 | |
| 1027 | lg2(x) Logarithm base 2 of x. |
| 1028 | |
| 1029 | max(x,y) Maximum of x and y. |
| 1030 | (x > y) ? x : y |
| 1031 | |
| 1032 | min(x,y) Minimum of x and y. |
| 1033 | (x < y) ? x : y |
| 1034 | |
| 1035 | partialx(x) Derivative of x relative to fragment's X. |
| 1036 | |
| 1037 | partialy(x) Derivative of x relative to fragment's Y. |
| 1038 | |
| 1039 | pop() Pop from stack. |
| 1040 | |
Corbin Simpson | dd801e5 | 2009-12-21 19:41:09 -0800 | [diff] [blame^] | 1041 | :math:`x^y` `x` to the power `y`. |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 1042 | |
| 1043 | push(x) Push x on stack. |
| 1044 | |
| 1045 | round(x) Round x. |
| 1046 | |
Keith Whitwell | a62aaa7 | 2009-12-21 23:25:15 +0000 | [diff] [blame] | 1047 | trunc(x) Truncate x. |
| 1048 | |
| 1049 | |
| 1050 | 2.2 Keywords |
| 1051 | ------------- |
| 1052 | |
| 1053 | |
| 1054 | discard Discard fragment. |
| 1055 | |
| 1056 | dst First destination register. |
| 1057 | |
| 1058 | dst0 First destination register. |
| 1059 | |
| 1060 | pc Program counter. |
| 1061 | |
| 1062 | src First source register. |
| 1063 | |
| 1064 | src0 First source register. |
| 1065 | |
| 1066 | src1 Second source register. |
| 1067 | |
| 1068 | src2 Third source register. |
| 1069 | |
| 1070 | target Label of target instruction. |
| 1071 | |
| 1072 | |
| 1073 | 3 Other tokens |
| 1074 | =============== |
| 1075 | |
| 1076 | |
| 1077 | 3.1 Declaration Semantic |
| 1078 | ------------------------- |
| 1079 | |
| 1080 | |
| 1081 | Follows Declaration token if Semantic bit is set. |
| 1082 | |
| 1083 | Since its purpose is to link a shader with other stages of the pipeline, |
| 1084 | it is valid to follow only those Declaration tokens that declare a register |
| 1085 | either in INPUT or OUTPUT file. |
| 1086 | |
| 1087 | SemanticName field contains the semantic name of the register being declared. |
| 1088 | There is no default value. |
| 1089 | |
| 1090 | SemanticIndex is an optional subscript that can be used to distinguish |
| 1091 | different register declarations with the same semantic name. The default value |
| 1092 | is 0. |
| 1093 | |
| 1094 | The meanings of the individual semantic names are explained in the following |
| 1095 | sections. |
| 1096 | |
| 1097 | |
| 1098 | 3.1.1 FACE |
| 1099 | |
| 1100 | Valid only in a fragment shader INPUT declaration. |
| 1101 | |
| 1102 | FACE.x is negative when the primitive is back facing. FACE.x is positive |
| 1103 | when the primitive is front facing. |