blob: b7180f85df43f927589ae839bee8ba3ba94e6a20 [file] [log] [blame]
Corbin Simpsonc686e172009-12-20 15:00:40 -08001TGSI
2====
3
Michal Krolb6659682010-01-04 12:52:43 +01004TGSI, Tungsten Graphics Shader Infrastructure, is an intermediate language
Corbin Simpsonc686e172009-12-20 15:00:40 -08005for describing shaders. Since Gallium is inherently shaderful, shaders are
6an important part of the API. TGSI is the only intermediate representation
7used by all drivers.
Keith Whitwella62aaa72009-12-21 23:25:15 +00008
Corbin Simpson62ca7b82010-02-02 16:36:34 -08009Basics
10------
11
12All TGSI instructions, known as *opcodes*, operate on arbitrary-precision
13floating-point four-component vectors. An opcode may have up to one
14destination register, known as *dst*, and between zero and three source
15registers, called *src0* through *src2*, or simply *src* if there is only
16one.
17
18Some instructions, like :opcode:`I2F`, permit re-interpretation of vector
19components as integers. Other instructions permit using registers as
20two-component vectors with double precision; see :ref:`Double Opcodes`.
21
Corbin Simpson17c2a442010-02-02 17:02:28 -080022When an instruction has a scalar result, the result is usually copied into
23each of the components of *dst*. When this happens, the result is said to be
24*replicated* to *dst*. :opcode:`RCP` is one such instruction.
25
Roland Scheideggercb2e6782013-02-16 02:26:14 +010026Modifiers
27^^^^^^^^^^^^^^^
28
29TGSI supports modifiers on inputs (as well as saturate modifier on instructions).
30
31For inputs which have a floating point type, both absolute value and negation
32modifiers are supported (with absolute value being applied first).
33TGSI_OPCODE_MOV is considered to have float input type for applying modifiers.
34
35For inputs which have signed type only the negate modifier is supported. This
36includes instructions which are otherwise ignorant if the type is signed or
37unsigned, such as TGSI_OPCODE_UADD.
38
39For inputs with unsigned type no modifiers are allowed.
40
Corbin Simpson5bcd26c2009-12-21 21:04:10 -080041Instruction Set
42---------------
43
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -070044Core ISA
Corbin Simpson5bcd26c2009-12-21 21:04:10 -080045^^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +000046
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -070047These opcodes are guaranteed to be available regardless of the driver being
48used.
Keith Whitwella62aaa72009-12-21 23:25:15 +000049
Corbin Simpson85805222010-02-02 16:20:12 -080050.. opcode:: ARL - Address Register Load
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080051
52.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000053
Corbin Simpsond92a6852009-12-21 19:30:29 -080054 dst.x = \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080055
Corbin Simpsond92a6852009-12-21 19:30:29 -080056 dst.y = \lfloor src.y\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080057
Corbin Simpsond92a6852009-12-21 19:30:29 -080058 dst.z = \lfloor src.z\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080059
Corbin Simpsond92a6852009-12-21 19:30:29 -080060 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +000061
62
Corbin Simpson85805222010-02-02 16:20:12 -080063.. opcode:: MOV - Move
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080064
65.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000066
67 dst.x = src.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080068
Keith Whitwella62aaa72009-12-21 23:25:15 +000069 dst.y = src.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080070
Keith Whitwella62aaa72009-12-21 23:25:15 +000071 dst.z = src.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080072
Keith Whitwella62aaa72009-12-21 23:25:15 +000073 dst.w = src.w
74
75
Corbin Simpson85805222010-02-02 16:20:12 -080076.. opcode:: LIT - Light Coefficients
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080077
78.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000079
Corbin Simpsonda65ac62009-12-21 20:32:46 -080080 dst.x = 1
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080081
Corbin Simpsonda65ac62009-12-21 20:32:46 -080082 dst.y = max(src.x, 0)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080083
Corbin Simpsonda65ac62009-12-21 20:32:46 -080084 dst.z = (src.x > 0) ? max(src.y, 0)^{clamp(src.w, -128, 128))} : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080085
Corbin Simpsonda65ac62009-12-21 20:32:46 -080086 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +000087
88
Corbin Simpson85805222010-02-02 16:20:12 -080089.. opcode:: RCP - Reciprocal
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080090
Corbin Simpson17c2a442010-02-02 17:02:28 -080091This instruction replicates its result.
92
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080093.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000094
Corbin Simpson17c2a442010-02-02 17:02:28 -080095 dst = \frac{1}{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +000096
97
Corbin Simpson85805222010-02-02 16:20:12 -080098.. opcode:: RSQ - Reciprocal Square Root
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080099
Corbin Simpson17c2a442010-02-02 17:02:28 -0800100This instruction replicates its result.
101
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800102.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000103
Corbin Simpson17c2a442010-02-02 17:02:28 -0800104 dst = \frac{1}{\sqrt{|src.x|}}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000105
106
Brian Pauld276a402013-02-01 10:59:43 -0700107.. opcode:: SQRT - Square Root
108
109This instruction replicates its result.
110
111.. math::
112
113 dst = {\sqrt{src.x}}
114
115
Corbin Simpson85805222010-02-02 16:20:12 -0800116.. opcode:: EXP - Approximate Exponential Base 2
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800117
118.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000119
Corbin Simpsondd801e52009-12-21 19:41:09 -0800120 dst.x = 2^{\lfloor src.x\rfloor}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800121
Corbin Simpsond92a6852009-12-21 19:30:29 -0800122 dst.y = src.x - \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800123
Corbin Simpsondd801e52009-12-21 19:41:09 -0800124 dst.z = 2^{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800125
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800126 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000127
128
Corbin Simpson85805222010-02-02 16:20:12 -0800129.. opcode:: LOG - Approximate Logarithm Base 2
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800130
131.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000132
Corbin Simpson14743ac2009-12-21 19:57:56 -0800133 dst.x = \lfloor\log_2{|src.x|}\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800134
Corbin Simpson14743ac2009-12-21 19:57:56 -0800135 dst.y = \frac{|src.x|}{2^{\lfloor\log_2{|src.x|}\rfloor}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800136
Corbin Simpson14743ac2009-12-21 19:57:56 -0800137 dst.z = \log_2{|src.x|}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800138
Corbin Simpson14743ac2009-12-21 19:57:56 -0800139 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000140
141
Corbin Simpson85805222010-02-02 16:20:12 -0800142.. opcode:: MUL - Multiply
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800143
144.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000145
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800146 dst.x = src0.x \times src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800147
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800148 dst.y = src0.y \times src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800149
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800150 dst.z = src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800151
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800152 dst.w = src0.w \times src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000153
154
Corbin Simpson85805222010-02-02 16:20:12 -0800155.. opcode:: ADD - Add
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800156
157.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000158
159 dst.x = src0.x + src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800160
Keith Whitwella62aaa72009-12-21 23:25:15 +0000161 dst.y = src0.y + src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800162
Keith Whitwella62aaa72009-12-21 23:25:15 +0000163 dst.z = src0.z + src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800164
Keith Whitwella62aaa72009-12-21 23:25:15 +0000165 dst.w = src0.w + src1.w
166
167
Corbin Simpson85805222010-02-02 16:20:12 -0800168.. opcode:: DP3 - 3-component Dot Product
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800169
Corbin Simpson17c2a442010-02-02 17:02:28 -0800170This instruction replicates its result.
171
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800172.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000173
Corbin Simpson17c2a442010-02-02 17:02:28 -0800174 dst = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Keith Whitwella62aaa72009-12-21 23:25:15 +0000175
176
Corbin Simpson85805222010-02-02 16:20:12 -0800177.. opcode:: DP4 - 4-component Dot Product
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800178
Corbin Simpson17c2a442010-02-02 17:02:28 -0800179This instruction replicates its result.
180
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800181.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000182
Corbin Simpson17c2a442010-02-02 17:02:28 -0800183 dst = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000184
185
Corbin Simpson85805222010-02-02 16:20:12 -0800186.. opcode:: DST - Distance Vector
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800187
188.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000189
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800190 dst.x = 1
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800191
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800192 dst.y = src0.y \times src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800193
Keith Whitwella62aaa72009-12-21 23:25:15 +0000194 dst.z = src0.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800195
Keith Whitwella62aaa72009-12-21 23:25:15 +0000196 dst.w = src1.w
197
198
Corbin Simpson85805222010-02-02 16:20:12 -0800199.. opcode:: MIN - Minimum
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800200
201.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000202
203 dst.x = min(src0.x, src1.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800204
Keith Whitwella62aaa72009-12-21 23:25:15 +0000205 dst.y = min(src0.y, src1.y)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800206
Keith Whitwella62aaa72009-12-21 23:25:15 +0000207 dst.z = min(src0.z, src1.z)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800208
Keith Whitwella62aaa72009-12-21 23:25:15 +0000209 dst.w = min(src0.w, src1.w)
210
211
Corbin Simpson85805222010-02-02 16:20:12 -0800212.. opcode:: MAX - Maximum
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800213
214.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000215
216 dst.x = max(src0.x, src1.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800217
Keith Whitwella62aaa72009-12-21 23:25:15 +0000218 dst.y = max(src0.y, src1.y)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800219
Keith Whitwella62aaa72009-12-21 23:25:15 +0000220 dst.z = max(src0.z, src1.z)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800221
Keith Whitwella62aaa72009-12-21 23:25:15 +0000222 dst.w = max(src0.w, src1.w)
223
224
Corbin Simpson85805222010-02-02 16:20:12 -0800225.. opcode:: SLT - Set On Less Than
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800226
227.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000228
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800229 dst.x = (src0.x < src1.x) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800230
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800231 dst.y = (src0.y < src1.y) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800232
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800233 dst.z = (src0.z < src1.z) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800234
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800235 dst.w = (src0.w < src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000236
237
Corbin Simpson85805222010-02-02 16:20:12 -0800238.. opcode:: SGE - Set On Greater Equal Than
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800239
240.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000241
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800242 dst.x = (src0.x >= src1.x) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800243
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800244 dst.y = (src0.y >= src1.y) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800245
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800246 dst.z = (src0.z >= src1.z) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800247
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800248 dst.w = (src0.w >= src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000249
250
Corbin Simpson85805222010-02-02 16:20:12 -0800251.. opcode:: MAD - Multiply And Add
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800252
253.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000254
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800255 dst.x = src0.x \times src1.x + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800256
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800257 dst.y = src0.y \times src1.y + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800258
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800259 dst.z = src0.z \times src1.z + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800260
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800261 dst.w = src0.w \times src1.w + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000262
263
Corbin Simpson85805222010-02-02 16:20:12 -0800264.. opcode:: SUB - Subtract
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800265
266.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000267
268 dst.x = src0.x - src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800269
Keith Whitwella62aaa72009-12-21 23:25:15 +0000270 dst.y = src0.y - src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800271
Keith Whitwella62aaa72009-12-21 23:25:15 +0000272 dst.z = src0.z - src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800273
Keith Whitwella62aaa72009-12-21 23:25:15 +0000274 dst.w = src0.w - src1.w
275
276
Corbin Simpson85805222010-02-02 16:20:12 -0800277.. opcode:: LRP - Linear Interpolate
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800278
279.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000280
Michal Krolb3567fc2010-01-04 12:59:17 +0100281 dst.x = src0.x \times src1.x + (1 - src0.x) \times src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800282
Michal Krolb3567fc2010-01-04 12:59:17 +0100283 dst.y = src0.y \times src1.y + (1 - src0.y) \times src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800284
Michal Krolb3567fc2010-01-04 12:59:17 +0100285 dst.z = src0.z \times src1.z + (1 - src0.z) \times src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800286
Michal Krolb3567fc2010-01-04 12:59:17 +0100287 dst.w = src0.w \times src1.w + (1 - src0.w) \times src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000288
289
Corbin Simpson85805222010-02-02 16:20:12 -0800290.. opcode:: CND - Condition
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800291
292.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000293
294 dst.x = (src2.x > 0.5) ? src0.x : src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800295
Keith Whitwella62aaa72009-12-21 23:25:15 +0000296 dst.y = (src2.y > 0.5) ? src0.y : src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800297
Keith Whitwella62aaa72009-12-21 23:25:15 +0000298 dst.z = (src2.z > 0.5) ? src0.z : src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800299
Keith Whitwella62aaa72009-12-21 23:25:15 +0000300 dst.w = (src2.w > 0.5) ? src0.w : src1.w
301
302
Corbin Simpson85805222010-02-02 16:20:12 -0800303.. opcode:: DP2A - 2-component Dot Product And Add
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800304
305.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000306
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800307 dst.x = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800308
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800309 dst.y = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800310
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800311 dst.z = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800312
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800313 dst.w = src0.x \times src1.x + src0.y \times src1.y + src2.x
Keith Whitwella62aaa72009-12-21 23:25:15 +0000314
315
José Fonsecad9c6ebb2010-06-01 16:25:05 +0100316.. opcode:: FRC - Fraction
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800317
318.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000319
Corbin Simpsond92a6852009-12-21 19:30:29 -0800320 dst.x = src.x - \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800321
Corbin Simpsond92a6852009-12-21 19:30:29 -0800322 dst.y = src.y - \lfloor src.y\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800323
Corbin Simpsond92a6852009-12-21 19:30:29 -0800324 dst.z = src.z - \lfloor src.z\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800325
Corbin Simpsond92a6852009-12-21 19:30:29 -0800326 dst.w = src.w - \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000327
328
Corbin Simpson85805222010-02-02 16:20:12 -0800329.. opcode:: CLAMP - Clamp
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800330
331.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000332
333 dst.x = clamp(src0.x, src1.x, src2.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800334
Keith Whitwella62aaa72009-12-21 23:25:15 +0000335 dst.y = clamp(src0.y, src1.y, src2.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800336
Keith Whitwella62aaa72009-12-21 23:25:15 +0000337 dst.z = clamp(src0.z, src1.z, src2.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800338
Keith Whitwella62aaa72009-12-21 23:25:15 +0000339 dst.w = clamp(src0.w, src1.w, src2.w)
340
341
Corbin Simpson85805222010-02-02 16:20:12 -0800342.. opcode:: FLR - Floor
Corbin Simpsond92a6852009-12-21 19:30:29 -0800343
Corbin Simpson17c2a442010-02-02 17:02:28 -0800344This is identical to :opcode:`ARL`.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000345
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800346.. math::
347
Corbin Simpsond92a6852009-12-21 19:30:29 -0800348 dst.x = \lfloor src.x\rfloor
349
350 dst.y = \lfloor src.y\rfloor
351
352 dst.z = \lfloor src.z\rfloor
353
354 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000355
356
Corbin Simpson85805222010-02-02 16:20:12 -0800357.. opcode:: ROUND - Round
Keith Whitwella62aaa72009-12-21 23:25:15 +0000358
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800359.. math::
360
Keith Whitwella62aaa72009-12-21 23:25:15 +0000361 dst.x = round(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800362
Keith Whitwella62aaa72009-12-21 23:25:15 +0000363 dst.y = round(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800364
Keith Whitwella62aaa72009-12-21 23:25:15 +0000365 dst.z = round(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800366
Keith Whitwella62aaa72009-12-21 23:25:15 +0000367 dst.w = round(src.w)
368
369
Corbin Simpson85805222010-02-02 16:20:12 -0800370.. opcode:: EX2 - Exponential Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000371
Corbin Simpson17c2a442010-02-02 17:02:28 -0800372This instruction replicates its result.
373
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800374.. math::
375
Corbin Simpson17c2a442010-02-02 17:02:28 -0800376 dst = 2^{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000377
378
Corbin Simpson85805222010-02-02 16:20:12 -0800379.. opcode:: LG2 - Logarithm Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000380
Corbin Simpson17c2a442010-02-02 17:02:28 -0800381This instruction replicates its result.
382
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800383.. math::
384
Corbin Simpson17c2a442010-02-02 17:02:28 -0800385 dst = \log_2{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000386
387
Corbin Simpson85805222010-02-02 16:20:12 -0800388.. opcode:: POW - Power
Keith Whitwella62aaa72009-12-21 23:25:15 +0000389
Corbin Simpson17c2a442010-02-02 17:02:28 -0800390This instruction replicates its result.
391
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800392.. math::
393
Corbin Simpson17c2a442010-02-02 17:02:28 -0800394 dst = src0.x^{src1.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000395
Corbin Simpson85805222010-02-02 16:20:12 -0800396.. opcode:: XPD - Cross Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000397
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800398.. math::
399
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800400 dst.x = src0.y \times src1.z - src1.y \times src0.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800401
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800402 dst.y = src0.z \times src1.x - src1.z \times src0.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800403
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800404 dst.z = src0.x \times src1.y - src1.x \times src0.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800405
406 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000407
408
Corbin Simpson85805222010-02-02 16:20:12 -0800409.. opcode:: ABS - Absolute
Keith Whitwella62aaa72009-12-21 23:25:15 +0000410
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800411.. math::
412
Corbin Simpson14743ac2009-12-21 19:57:56 -0800413 dst.x = |src.x|
414
415 dst.y = |src.y|
416
417 dst.z = |src.z|
418
419 dst.w = |src.w|
Keith Whitwella62aaa72009-12-21 23:25:15 +0000420
421
Corbin Simpson85805222010-02-02 16:20:12 -0800422.. opcode:: RCC - Reciprocal Clamped
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800423
Corbin Simpson17c2a442010-02-02 17:02:28 -0800424This instruction replicates its result.
425
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800426XXX cleanup on aisle three
Keith Whitwella62aaa72009-12-21 23:25:15 +0000427
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800428.. math::
429
Corbin Simpson17c2a442010-02-02 17:02:28 -0800430 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)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000431
432
Corbin Simpson85805222010-02-02 16:20:12 -0800433.. opcode:: DPH - Homogeneous Dot Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000434
Corbin Simpson17c2a442010-02-02 17:02:28 -0800435This instruction replicates its result.
436
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800437.. math::
438
Corbin Simpson17c2a442010-02-02 17:02:28 -0800439 dst = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000440
441
Corbin Simpson85805222010-02-02 16:20:12 -0800442.. opcode:: COS - Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000443
Corbin Simpson17c2a442010-02-02 17:02:28 -0800444This instruction replicates its result.
445
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800446.. math::
447
Corbin Simpson17c2a442010-02-02 17:02:28 -0800448 dst = \cos{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000449
450
Corbin Simpson85805222010-02-02 16:20:12 -0800451.. opcode:: DDX - Derivative Relative To X
Keith Whitwella62aaa72009-12-21 23:25:15 +0000452
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800453.. math::
454
Keith Whitwella62aaa72009-12-21 23:25:15 +0000455 dst.x = partialx(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800456
Keith Whitwella62aaa72009-12-21 23:25:15 +0000457 dst.y = partialx(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800458
Keith Whitwella62aaa72009-12-21 23:25:15 +0000459 dst.z = partialx(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800460
Keith Whitwella62aaa72009-12-21 23:25:15 +0000461 dst.w = partialx(src.w)
462
463
Corbin Simpson85805222010-02-02 16:20:12 -0800464.. opcode:: DDY - Derivative Relative To Y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000465
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800466.. math::
467
Keith Whitwella62aaa72009-12-21 23:25:15 +0000468 dst.x = partialy(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800469
Keith Whitwella62aaa72009-12-21 23:25:15 +0000470 dst.y = partialy(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800471
Keith Whitwella62aaa72009-12-21 23:25:15 +0000472 dst.z = partialy(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800473
Keith Whitwella62aaa72009-12-21 23:25:15 +0000474 dst.w = partialy(src.w)
475
476
Corbin Simpson85805222010-02-02 16:20:12 -0800477.. opcode:: KILP - Predicated Discard
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800478
Keith Whitwella62aaa72009-12-21 23:25:15 +0000479 discard
480
481
Corbin Simpson85805222010-02-02 16:20:12 -0800482.. opcode:: PK2H - Pack Two 16-bit Floats
Keith Whitwella62aaa72009-12-21 23:25:15 +0000483
484 TBD
485
486
Corbin Simpson85805222010-02-02 16:20:12 -0800487.. opcode:: PK2US - Pack Two Unsigned 16-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000488
489 TBD
490
491
Corbin Simpson85805222010-02-02 16:20:12 -0800492.. opcode:: PK4B - Pack Four Signed 8-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000493
494 TBD
495
496
Corbin Simpson85805222010-02-02 16:20:12 -0800497.. opcode:: PK4UB - Pack Four Unsigned 8-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000498
499 TBD
500
501
Corbin Simpson85805222010-02-02 16:20:12 -0800502.. opcode:: RFL - Reflection Vector
Keith Whitwella62aaa72009-12-21 23:25:15 +0000503
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800504.. math::
505
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800506 dst.x = 2 \times (src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z) / (src0.x \times src0.x + src0.y \times src0.y + src0.z \times src0.z) \times src0.x - src1.x
507
508 dst.y = 2 \times (src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z) / (src0.x \times src0.x + src0.y \times src0.y + src0.z \times src0.z) \times src0.y - src1.y
509
510 dst.z = 2 \times (src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z) / (src0.x \times src0.x + src0.y \times src0.y + src0.z \times src0.z) \times src0.z - src1.z
511
512 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000513
Corbin Simpson17c2a442010-02-02 17:02:28 -0800514.. note::
515
516 Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000517
Keith Whitwella62aaa72009-12-21 23:25:15 +0000518
Corbin Simpson85805222010-02-02 16:20:12 -0800519.. opcode:: SEQ - Set On Equal
Keith Whitwella62aaa72009-12-21 23:25:15 +0000520
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800521.. math::
522
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800523 dst.x = (src0.x == src1.x) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800524
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800525 dst.y = (src0.y == src1.y) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800526
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800527 dst.z = (src0.z == src1.z) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800528
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800529 dst.w = (src0.w == src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000530
531
Corbin Simpson85805222010-02-02 16:20:12 -0800532.. opcode:: SFL - Set On False
Keith Whitwella62aaa72009-12-21 23:25:15 +0000533
Corbin Simpson17c2a442010-02-02 17:02:28 -0800534This instruction replicates its result.
535
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800536.. math::
537
Corbin Simpson17c2a442010-02-02 17:02:28 -0800538 dst = 0
Corbin Simpson04771912010-01-18 17:31:56 -0800539
Corbin Simpson17c2a442010-02-02 17:02:28 -0800540.. note::
Corbin Simpson04771912010-01-18 17:31:56 -0800541
Corbin Simpson17c2a442010-02-02 17:02:28 -0800542 Considered for removal.
Corbin Simpson04771912010-01-18 17:31:56 -0800543
Keith Whitwella62aaa72009-12-21 23:25:15 +0000544
Corbin Simpson85805222010-02-02 16:20:12 -0800545.. opcode:: SGT - Set On Greater Than
Keith Whitwella62aaa72009-12-21 23:25:15 +0000546
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800547.. math::
548
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800549 dst.x = (src0.x > src1.x) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800550
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800551 dst.y = (src0.y > src1.y) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800552
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800553 dst.z = (src0.z > src1.z) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800554
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800555 dst.w = (src0.w > src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000556
557
Corbin Simpson85805222010-02-02 16:20:12 -0800558.. opcode:: SIN - Sine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000559
Corbin Simpson17c2a442010-02-02 17:02:28 -0800560This instruction replicates its result.
561
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800562.. math::
563
Corbin Simpson17c2a442010-02-02 17:02:28 -0800564 dst = \sin{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000565
566
Corbin Simpson85805222010-02-02 16:20:12 -0800567.. opcode:: SLE - Set On Less Equal Than
Keith Whitwella62aaa72009-12-21 23:25:15 +0000568
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800569.. math::
570
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800571 dst.x = (src0.x <= src1.x) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800572
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800573 dst.y = (src0.y <= src1.y) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800574
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800575 dst.z = (src0.z <= src1.z) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800576
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800577 dst.w = (src0.w <= src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000578
579
Corbin Simpson85805222010-02-02 16:20:12 -0800580.. opcode:: SNE - Set On Not Equal
Keith Whitwella62aaa72009-12-21 23:25:15 +0000581
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800582.. math::
583
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800584 dst.x = (src0.x != src1.x) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800585
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800586 dst.y = (src0.y != src1.y) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800587
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800588 dst.z = (src0.z != src1.z) ? 1 : 0
Corbin Simpson04771912010-01-18 17:31:56 -0800589
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800590 dst.w = (src0.w != src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000591
592
Corbin Simpson85805222010-02-02 16:20:12 -0800593.. opcode:: STR - Set On True
Keith Whitwella62aaa72009-12-21 23:25:15 +0000594
Corbin Simpson17c2a442010-02-02 17:02:28 -0800595This instruction replicates its result.
596
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800597.. math::
598
Corbin Simpson17c2a442010-02-02 17:02:28 -0800599 dst = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000600
601
Corbin Simpson85805222010-02-02 16:20:12 -0800602.. opcode:: TEX - Texture Lookup
Keith Whitwella62aaa72009-12-21 23:25:15 +0000603
Brian Paul2a77c3c2010-12-14 12:45:36 -0700604.. math::
605
606 coord = src0
607
608 bias = 0.0
609
610 dst = texture_sample(unit, coord, bias)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000611
Dave Airlie35db3262011-12-19 16:40:05 +0000612 for array textures src0.y contains the slice for 1D,
613 and src0.z contain the slice for 2D.
614 for shadow textures with no arrays, src0.z contains
615 the reference value.
616 for shadow textures with arrays, src0.z contains
617 the reference value for 1D arrays, and src0.w contains
618 the reference value for 2D arrays.
619 There is no way to pass a bias in the .w value for
620 shadow arrays, and GLSL doesn't allow this.
621 GLSL does allow cube shadows maps to take a bias value,
622 and we have to determine how this will look in TGSI.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000623
Corbin Simpson85805222010-02-02 16:20:12 -0800624.. opcode:: TXD - Texture Lookup with Derivatives
Keith Whitwella62aaa72009-12-21 23:25:15 +0000625
Brian Paul2a77c3c2010-12-14 12:45:36 -0700626.. math::
627
628 coord = src0
629
630 ddx = src1
631
632 ddy = src2
633
634 bias = 0.0
635
636 dst = texture_sample_deriv(unit, coord, bias, ddx, ddy)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000637
638
Corbin Simpson85805222010-02-02 16:20:12 -0800639.. opcode:: TXP - Projective Texture Lookup
Keith Whitwella62aaa72009-12-21 23:25:15 +0000640
Brian Paul2a77c3c2010-12-14 12:45:36 -0700641.. math::
642
643 coord.x = src0.x / src.w
644
645 coord.y = src0.y / src.w
646
647 coord.z = src0.z / src.w
648
649 coord.w = src0.w
650
651 bias = 0.0
652
653 dst = texture_sample(unit, coord, bias)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000654
655
Corbin Simpson85805222010-02-02 16:20:12 -0800656.. opcode:: UP2H - Unpack Two 16-Bit Floats
Keith Whitwella62aaa72009-12-21 23:25:15 +0000657
658 TBD
659
Corbin Simpson17c2a442010-02-02 17:02:28 -0800660.. note::
661
662 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000663
Corbin Simpson85805222010-02-02 16:20:12 -0800664.. opcode:: UP2US - Unpack Two Unsigned 16-Bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000665
666 TBD
667
Corbin Simpson17c2a442010-02-02 17:02:28 -0800668.. note::
669
670 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000671
Corbin Simpson85805222010-02-02 16:20:12 -0800672.. opcode:: UP4B - Unpack Four Signed 8-Bit Values
Keith Whitwella62aaa72009-12-21 23:25:15 +0000673
674 TBD
675
Corbin Simpson17c2a442010-02-02 17:02:28 -0800676.. note::
677
678 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000679
Corbin Simpson85805222010-02-02 16:20:12 -0800680.. opcode:: UP4UB - Unpack Four Unsigned 8-Bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000681
682 TBD
683
Corbin Simpson17c2a442010-02-02 17:02:28 -0800684.. note::
685
686 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000687
Corbin Simpson85805222010-02-02 16:20:12 -0800688.. opcode:: X2D - 2D Coordinate Transformation
Keith Whitwella62aaa72009-12-21 23:25:15 +0000689
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800690.. math::
691
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800692 dst.x = src0.x + src1.x \times src2.x + src1.y \times src2.y
Corbin Simpson04771912010-01-18 17:31:56 -0800693
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800694 dst.y = src0.y + src1.x \times src2.z + src1.y \times src2.w
Corbin Simpson04771912010-01-18 17:31:56 -0800695
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800696 dst.z = src0.x + src1.x \times src2.x + src1.y \times src2.y
Corbin Simpson04771912010-01-18 17:31:56 -0800697
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800698 dst.w = src0.y + src1.x \times src2.z + src1.y \times src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000699
Corbin Simpson17c2a442010-02-02 17:02:28 -0800700.. note::
701
702 Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000703
Keith Whitwella62aaa72009-12-21 23:25:15 +0000704
Corbin Simpson85805222010-02-02 16:20:12 -0800705.. opcode:: ARA - Address Register Add
Keith Whitwella62aaa72009-12-21 23:25:15 +0000706
707 TBD
708
Corbin Simpson17c2a442010-02-02 17:02:28 -0800709.. note::
710
711 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000712
Corbin Simpson85805222010-02-02 16:20:12 -0800713.. opcode:: ARR - Address Register Load With Round
Keith Whitwella62aaa72009-12-21 23:25:15 +0000714
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800715.. math::
716
Keith Whitwella62aaa72009-12-21 23:25:15 +0000717 dst.x = round(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800718
Keith Whitwella62aaa72009-12-21 23:25:15 +0000719 dst.y = round(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800720
Keith Whitwella62aaa72009-12-21 23:25:15 +0000721 dst.z = round(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800722
Keith Whitwella62aaa72009-12-21 23:25:15 +0000723 dst.w = round(src.w)
724
725
Corbin Simpson85805222010-02-02 16:20:12 -0800726.. opcode:: BRA - Branch
Keith Whitwella62aaa72009-12-21 23:25:15 +0000727
728 pc = target
729
Corbin Simpson17c2a442010-02-02 17:02:28 -0800730.. note::
731
732 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000733
Corbin Simpson85805222010-02-02 16:20:12 -0800734.. opcode:: CAL - Subroutine Call
Keith Whitwella62aaa72009-12-21 23:25:15 +0000735
736 push(pc)
737 pc = target
738
739
Corbin Simpson85805222010-02-02 16:20:12 -0800740.. opcode:: RET - Subroutine Call Return
Keith Whitwella62aaa72009-12-21 23:25:15 +0000741
742 pc = pop()
743
744
Corbin Simpson85805222010-02-02 16:20:12 -0800745.. opcode:: SSG - Set Sign
Keith Whitwella62aaa72009-12-21 23:25:15 +0000746
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800747.. math::
748
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800749 dst.x = (src.x > 0) ? 1 : (src.x < 0) ? -1 : 0
750
751 dst.y = (src.y > 0) ? 1 : (src.y < 0) ? -1 : 0
752
753 dst.z = (src.z > 0) ? 1 : (src.z < 0) ? -1 : 0
754
755 dst.w = (src.w > 0) ? 1 : (src.w < 0) ? -1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000756
757
Corbin Simpson85805222010-02-02 16:20:12 -0800758.. opcode:: CMP - Compare
Keith Whitwella62aaa72009-12-21 23:25:15 +0000759
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800760.. math::
761
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800762 dst.x = (src0.x < 0) ? src1.x : src2.x
763
764 dst.y = (src0.y < 0) ? src1.y : src2.y
765
766 dst.z = (src0.z < 0) ? src1.z : src2.z
767
768 dst.w = (src0.w < 0) ? src1.w : src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000769
770
Corbin Simpson85805222010-02-02 16:20:12 -0800771.. opcode:: KIL - Conditional Discard
Keith Whitwella62aaa72009-12-21 23:25:15 +0000772
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800773.. math::
774
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800775 if (src.x < 0 || src.y < 0 || src.z < 0 || src.w < 0)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000776 discard
777 endif
778
779
Corbin Simpson85805222010-02-02 16:20:12 -0800780.. opcode:: SCS - Sine Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000781
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800782.. math::
783
Corbin Simpsond92a6852009-12-21 19:30:29 -0800784 dst.x = \cos{src.x}
785
786 dst.y = \sin{src.x}
787
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800788 dst.z = 0
Corbin Simpsond92a6852009-12-21 19:30:29 -0800789
Tilman Sauerbeckd3231182010-09-19 09:03:11 +0200790 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000791
792
Corbin Simpson85805222010-02-02 16:20:12 -0800793.. opcode:: TXB - Texture Lookup With Bias
Keith Whitwella62aaa72009-12-21 23:25:15 +0000794
Brian Paul2a77c3c2010-12-14 12:45:36 -0700795.. math::
796
797 coord.x = src.x
798
799 coord.y = src.y
800
801 coord.z = src.z
802
803 coord.w = 1.0
804
805 bias = src.z
806
807 dst = texture_sample(unit, coord, bias)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000808
809
Corbin Simpson85805222010-02-02 16:20:12 -0800810.. opcode:: NRM - 3-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +0000811
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800812.. math::
813
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800814 dst.x = src.x / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800815
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800816 dst.y = src.y / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800817
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800818 dst.z = src.z / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800819
820 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000821
822
Corbin Simpson85805222010-02-02 16:20:12 -0800823.. opcode:: DIV - Divide
Keith Whitwella62aaa72009-12-21 23:25:15 +0000824
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800825.. math::
826
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800827 dst.x = \frac{src0.x}{src1.x}
828
829 dst.y = \frac{src0.y}{src1.y}
830
831 dst.z = \frac{src0.z}{src1.z}
832
833 dst.w = \frac{src0.w}{src1.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000834
835
Corbin Simpson85805222010-02-02 16:20:12 -0800836.. opcode:: DP2 - 2-component Dot Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000837
Corbin Simpson17c2a442010-02-02 17:02:28 -0800838This instruction replicates its result.
839
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800840.. math::
841
Corbin Simpson17c2a442010-02-02 17:02:28 -0800842 dst = src0.x \times src1.x + src0.y \times src1.y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000843
844
Brian Paul2a77c3c2010-12-14 12:45:36 -0700845.. opcode:: TXL - Texture Lookup With explicit LOD
Keith Whitwella62aaa72009-12-21 23:25:15 +0000846
Brian Paul2a77c3c2010-12-14 12:45:36 -0700847.. math::
848
849 coord.x = src0.x
850
851 coord.y = src0.y
852
853 coord.z = src0.z
854
855 coord.w = 1.0
856
857 lod = src0.w
858
859 dst = texture_sample(unit, coord, lod)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000860
861
Corbin Simpson85805222010-02-02 16:20:12 -0800862.. opcode:: BRK - Break
Keith Whitwella62aaa72009-12-21 23:25:15 +0000863
864 TBD
865
866
José Fonseca50b3fc62013-04-17 10:47:03 +0100867.. opcode:: IF - Float If
Keith Whitwella62aaa72009-12-21 23:25:15 +0000868
José Fonseca50b3fc62013-04-17 10:47:03 +0100869 Start an IF ... ELSE .. ENDIF block. Condition evaluates to true if
870
871 src0.x != 0.0
872
873 where src0.x is interpreted as a floating point register.
874
875
876.. opcode:: UIF - Bitwise If
877
878 Start an UIF ... ELSE .. ENDIF block. Condition evaluates to true if
879
880 src0.x != 0
881
882 where src0.x is interpreted as an integer register.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000883
884
Corbin Simpson85805222010-02-02 16:20:12 -0800885.. opcode:: ELSE - Else
Keith Whitwella62aaa72009-12-21 23:25:15 +0000886
José Fonseca50b3fc62013-04-17 10:47:03 +0100887 Starts an else block, after an IF or UIF statement.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000888
889
Corbin Simpson85805222010-02-02 16:20:12 -0800890.. opcode:: ENDIF - End If
Keith Whitwella62aaa72009-12-21 23:25:15 +0000891
José Fonseca50b3fc62013-04-17 10:47:03 +0100892 Ends an IF or UIF block.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000893
894
Corbin Simpson85805222010-02-02 16:20:12 -0800895.. opcode:: PUSHA - Push Address Register On Stack
Keith Whitwella62aaa72009-12-21 23:25:15 +0000896
897 push(src.x)
898 push(src.y)
899 push(src.z)
900 push(src.w)
901
Corbin Simpson17c2a442010-02-02 17:02:28 -0800902.. note::
903
904 Considered for cleanup.
905
906.. note::
907
908 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000909
Corbin Simpson85805222010-02-02 16:20:12 -0800910.. opcode:: POPA - Pop Address Register From Stack
Keith Whitwella62aaa72009-12-21 23:25:15 +0000911
912 dst.w = pop()
913 dst.z = pop()
914 dst.y = pop()
915 dst.x = pop()
916
Corbin Simpson17c2a442010-02-02 17:02:28 -0800917.. note::
918
919 Considered for cleanup.
920
921.. note::
922
923 Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000924
Keith Whitwella62aaa72009-12-21 23:25:15 +0000925
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -0700926Compute ISA
Corbin Simpson5bcd26c2009-12-21 21:04:10 -0800927^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +0000928
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -0700929These opcodes are primarily provided for special-use computational shaders.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000930Support for these opcodes indicated by a special pipe capability bit (TBD).
Keith Whitwella62aaa72009-12-21 23:25:15 +0000931
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -0700932XXX so let's discuss it, yeah?
933
Corbin Simpson85805222010-02-02 16:20:12 -0800934.. opcode:: CEIL - Ceiling
Keith Whitwella62aaa72009-12-21 23:25:15 +0000935
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800936.. math::
937
Corbin Simpson14743ac2009-12-21 19:57:56 -0800938 dst.x = \lceil src.x\rceil
939
940 dst.y = \lceil src.y\rceil
941
942 dst.z = \lceil src.z\rceil
943
944 dst.w = \lceil src.w\rceil
Keith Whitwella62aaa72009-12-21 23:25:15 +0000945
946
Corbin Simpson85805222010-02-02 16:20:12 -0800947.. opcode:: I2F - Integer To Float
Keith Whitwella62aaa72009-12-21 23:25:15 +0000948
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800949.. math::
950
Keith Whitwella62aaa72009-12-21 23:25:15 +0000951 dst.x = (float) src.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800952
Keith Whitwella62aaa72009-12-21 23:25:15 +0000953 dst.y = (float) src.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800954
Keith Whitwella62aaa72009-12-21 23:25:15 +0000955 dst.z = (float) src.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800956
Keith Whitwella62aaa72009-12-21 23:25:15 +0000957 dst.w = (float) src.w
958
959
Corbin Simpson85805222010-02-02 16:20:12 -0800960.. opcode:: NOT - Bitwise Not
Keith Whitwella62aaa72009-12-21 23:25:15 +0000961
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800962.. math::
963
Keith Whitwella62aaa72009-12-21 23:25:15 +0000964 dst.x = ~src.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800965
Keith Whitwella62aaa72009-12-21 23:25:15 +0000966 dst.y = ~src.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800967
Keith Whitwella62aaa72009-12-21 23:25:15 +0000968 dst.z = ~src.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800969
Keith Whitwella62aaa72009-12-21 23:25:15 +0000970 dst.w = ~src.w
971
972
Corbin Simpson85805222010-02-02 16:20:12 -0800973.. opcode:: TRUNC - Truncate
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800974
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800975.. math::
976
Keith Whitwella62aaa72009-12-21 23:25:15 +0000977 dst.x = trunc(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800978
Keith Whitwella62aaa72009-12-21 23:25:15 +0000979 dst.y = trunc(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800980
Keith Whitwella62aaa72009-12-21 23:25:15 +0000981 dst.z = trunc(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800982
Keith Whitwella62aaa72009-12-21 23:25:15 +0000983 dst.w = trunc(src.w)
984
985
Corbin Simpson85805222010-02-02 16:20:12 -0800986.. opcode:: SHL - Shift Left
Keith Whitwella62aaa72009-12-21 23:25:15 +0000987
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800988.. math::
989
Keith Whitwella62aaa72009-12-21 23:25:15 +0000990 dst.x = src0.x << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800991
Keith Whitwella62aaa72009-12-21 23:25:15 +0000992 dst.y = src0.y << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800993
Keith Whitwella62aaa72009-12-21 23:25:15 +0000994 dst.z = src0.z << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800995
Keith Whitwella62aaa72009-12-21 23:25:15 +0000996 dst.w = src0.w << src1.x
997
998
Corbin Simpson85805222010-02-02 16:20:12 -0800999.. opcode:: SHR - Shift Right
Keith Whitwella62aaa72009-12-21 23:25:15 +00001000
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001001.. math::
1002
Keith Whitwella62aaa72009-12-21 23:25:15 +00001003 dst.x = src0.x >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001004
Keith Whitwella62aaa72009-12-21 23:25:15 +00001005 dst.y = src0.y >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001006
Keith Whitwella62aaa72009-12-21 23:25:15 +00001007 dst.z = src0.z >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001008
Keith Whitwella62aaa72009-12-21 23:25:15 +00001009 dst.w = src0.w >> src1.x
1010
1011
Corbin Simpson85805222010-02-02 16:20:12 -08001012.. opcode:: AND - Bitwise And
Keith Whitwella62aaa72009-12-21 23:25:15 +00001013
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001014.. math::
1015
Keith Whitwella62aaa72009-12-21 23:25:15 +00001016 dst.x = src0.x & src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001017
Keith Whitwella62aaa72009-12-21 23:25:15 +00001018 dst.y = src0.y & src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001019
Keith Whitwella62aaa72009-12-21 23:25:15 +00001020 dst.z = src0.z & src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001021
Keith Whitwella62aaa72009-12-21 23:25:15 +00001022 dst.w = src0.w & src1.w
1023
1024
Corbin Simpson85805222010-02-02 16:20:12 -08001025.. opcode:: OR - Bitwise Or
Keith Whitwella62aaa72009-12-21 23:25:15 +00001026
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001027.. math::
1028
Keith Whitwella62aaa72009-12-21 23:25:15 +00001029 dst.x = src0.x | src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001030
Keith Whitwella62aaa72009-12-21 23:25:15 +00001031 dst.y = src0.y | src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001032
Keith Whitwella62aaa72009-12-21 23:25:15 +00001033 dst.z = src0.z | src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001034
Keith Whitwella62aaa72009-12-21 23:25:15 +00001035 dst.w = src0.w | src1.w
1036
1037
Corbin Simpson85805222010-02-02 16:20:12 -08001038.. opcode:: MOD - Modulus
Keith Whitwella62aaa72009-12-21 23:25:15 +00001039
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001040.. math::
1041
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001042 dst.x = src0.x \bmod src1.x
1043
1044 dst.y = src0.y \bmod src1.y
1045
1046 dst.z = src0.z \bmod src1.z
1047
1048 dst.w = src0.w \bmod src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +00001049
1050
Corbin Simpson85805222010-02-02 16:20:12 -08001051.. opcode:: XOR - Bitwise Xor
Keith Whitwella62aaa72009-12-21 23:25:15 +00001052
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001053.. math::
1054
Corbin Simpsonf90733c2010-01-18 17:37:25 -08001055 dst.x = src0.x \oplus src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001056
Corbin Simpsonf90733c2010-01-18 17:37:25 -08001057 dst.y = src0.y \oplus src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001058
Corbin Simpsonf90733c2010-01-18 17:37:25 -08001059 dst.z = src0.z \oplus src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001060
Corbin Simpsonf90733c2010-01-18 17:37:25 -08001061 dst.w = src0.w \oplus src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +00001062
1063
Bryan Cain324ac982011-09-10 12:31:54 -05001064.. opcode:: UCMP - Integer Conditional Move
1065
1066.. math::
1067
1068 dst.x = src0.x ? src1.x : src2.x
1069
1070 dst.y = src0.y ? src1.y : src2.y
1071
1072 dst.z = src0.z ? src1.z : src2.z
1073
1074 dst.w = src0.w ? src1.w : src2.w
1075
1076
1077.. opcode:: UARL - Integer Address Register Load
1078
1079 Moves the contents of the source register, assumed to be an integer, into the
1080 destination register, which is assumed to be an address (ADDR) register.
1081
1082
Bryan Cain4c0f1fb2012-01-07 10:43:04 -06001083.. opcode:: IABS - Integer Absolute Value
1084
1085.. math::
1086
1087 dst.x = |src.x|
1088
1089 dst.y = |src.y|
1090
1091 dst.z = |src.z|
1092
1093 dst.w = |src.w|
1094
1095
Corbin Simpson85805222010-02-02 16:20:12 -08001096.. opcode:: SAD - Sum Of Absolute Differences
Keith Whitwella62aaa72009-12-21 23:25:15 +00001097
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001098.. math::
1099
Corbin Simpson14743ac2009-12-21 19:57:56 -08001100 dst.x = |src0.x - src1.x| + src2.x
1101
1102 dst.y = |src0.y - src1.y| + src2.y
1103
1104 dst.z = |src0.z - src1.z| + src2.z
1105
1106 dst.w = |src0.w - src1.w| + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +00001107
1108
Dave Airlie2083a272011-08-26 10:59:18 +01001109.. opcode:: TXF - Texel Fetch (as per NV_gpu_shader4), extract a single texel
1110 from a specified texture image. The source sampler may
1111 not be a CUBE or SHADOW.
1112 src 0 is a four-component signed integer vector used to
1113 identify the single texel accessed. 3 components + level.
1114 src 1 is a 3 component constant signed integer vector,
1115 with each component only have a range of
1116 -8..+8 (hw only seems to deal with this range, interface
1117 allows for up to unsigned int).
1118 TXF(uint_vec coord, int_vec offset).
Keith Whitwella62aaa72009-12-21 23:25:15 +00001119
1120
Dave Airlie6fb12bf2011-08-25 13:03:19 +01001121.. opcode:: TXQ - Texture Size Query (as per NV_gpu_program4)
1122 retrieve the dimensions of the texture
1123 depending on the target. For 1D (width), 2D/RECT/CUBE
1124 (width, height), 3D (width, height, depth),
1125 1D array (width, layers), 2D array (width, height, layers)
Keith Whitwella62aaa72009-12-21 23:25:15 +00001126
Dave Airlie6fb12bf2011-08-25 13:03:19 +01001127.. math::
1128
1129 lod = src0
1130
1131 dst.x = texture_width(unit, lod)
1132
1133 dst.y = texture_height(unit, lod)
1134
1135 dst.z = texture_depth(unit, lod)
Keith Whitwella62aaa72009-12-21 23:25:15 +00001136
1137
Corbin Simpson85805222010-02-02 16:20:12 -08001138.. opcode:: CONT - Continue
Keith Whitwella62aaa72009-12-21 23:25:15 +00001139
1140 TBD
1141
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001142.. note::
Keith Whitwella62aaa72009-12-21 23:25:15 +00001143
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001144 Support for CONT is determined by a special capability bit,
1145 ``TGSI_CONT_SUPPORTED``. See :ref:`Screen` for more information.
1146
1147
1148Geometry ISA
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001149^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001150
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001151These opcodes are only supported in geometry shaders; they have no meaning
1152in any other type of shader.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001153
Corbin Simpson85805222010-02-02 16:20:12 -08001154.. opcode:: EMIT - Emit
Keith Whitwella62aaa72009-12-21 23:25:15 +00001155
1156 TBD
1157
1158
Corbin Simpson85805222010-02-02 16:20:12 -08001159.. opcode:: ENDPRIM - End Primitive
Keith Whitwella62aaa72009-12-21 23:25:15 +00001160
1161 TBD
1162
1163
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001164GLSL ISA
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001165^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001166
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001167These opcodes are part of :term:`GLSL`'s opcode set. Support for these
1168opcodes is determined by a special capability bit, ``GLSL``.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001169
Corbin Simpson85805222010-02-02 16:20:12 -08001170.. opcode:: BGNLOOP - Begin a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001171
1172 TBD
1173
1174
Corbin Simpson85805222010-02-02 16:20:12 -08001175.. opcode:: BGNSUB - Begin Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001176
1177 TBD
1178
1179
Corbin Simpson85805222010-02-02 16:20:12 -08001180.. opcode:: ENDLOOP - End a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001181
1182 TBD
1183
1184
Corbin Simpson85805222010-02-02 16:20:12 -08001185.. opcode:: ENDSUB - End Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001186
1187 TBD
1188
1189
Corbin Simpson85805222010-02-02 16:20:12 -08001190.. opcode:: NOP - No Operation
Keith Whitwella62aaa72009-12-21 23:25:15 +00001191
Michal Krol8ab89d72010-01-04 13:23:41 +01001192 Do nothing.
1193
Keith Whitwella62aaa72009-12-21 23:25:15 +00001194
Corbin Simpson85805222010-02-02 16:20:12 -08001195.. opcode:: NRM4 - 4-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +00001196
Corbin Simpson17c2a442010-02-02 17:02:28 -08001197This instruction replicates its result.
1198
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001199.. math::
1200
Corbin Simpson17c2a442010-02-02 17:02:28 -08001201 dst = \frac{src.x}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +00001202
1203
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001204ps_2_x
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001205^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001206
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001207XXX wait what
Keith Whitwella62aaa72009-12-21 23:25:15 +00001208
Corbin Simpson85805222010-02-02 16:20:12 -08001209.. opcode:: CALLNZ - Subroutine Call If Not Zero
Keith Whitwella62aaa72009-12-21 23:25:15 +00001210
1211 TBD
1212
1213
Corbin Simpson85805222010-02-02 16:20:12 -08001214.. opcode:: BREAKC - Break Conditional
Keith Whitwella62aaa72009-12-21 23:25:15 +00001215
1216 TBD
1217
Corbin Simpson62ca7b82010-02-02 16:36:34 -08001218.. _doubleopcodes:
1219
Corbin Simpson9d4cb6e2010-06-16 18:34:32 -07001220Double ISA
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001221^^^^^^^^^^^^^^^
1222
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001223The double-precision opcodes reinterpret four-component vectors into
1224two-component vectors with doubled precision in each component.
1225
1226Support for these opcodes is XXX undecided. :T
1227
1228.. opcode:: DADD - Add
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001229
1230.. math::
1231
1232 dst.xy = src0.xy + src1.xy
1233
1234 dst.zw = src0.zw + src1.zw
1235
1236
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001237.. opcode:: DDIV - Divide
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001238
1239.. math::
1240
1241 dst.xy = src0.xy / src1.xy
1242
1243 dst.zw = src0.zw / src1.zw
1244
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001245.. opcode:: DSEQ - Set on Equal
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001246
1247.. math::
1248
1249 dst.xy = src0.xy == src1.xy ? 1.0F : 0.0F
1250
1251 dst.zw = src0.zw == src1.zw ? 1.0F : 0.0F
1252
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001253.. opcode:: DSLT - Set on Less than
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001254
1255.. math::
1256
1257 dst.xy = src0.xy < src1.xy ? 1.0F : 0.0F
1258
1259 dst.zw = src0.zw < src1.zw ? 1.0F : 0.0F
1260
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001261.. opcode:: DFRAC - Fraction
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001262
1263.. math::
1264
1265 dst.xy = src.xy - \lfloor src.xy\rfloor
1266
1267 dst.zw = src.zw - \lfloor src.zw\rfloor
1268
1269
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001270.. opcode:: DFRACEXP - Convert Number to Fractional and Integral Components
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001271
Corbin Simpsonf98c4622010-06-16 18:45:50 -07001272Like the ``frexp()`` routine in many math libraries, this opcode stores the
1273exponent of its source to ``dst0``, and the significand to ``dst1``, such that
1274:math:`dst1 \times 2^{dst0} = src` .
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001275
1276.. math::
1277
Corbin Simpsonf98c4622010-06-16 18:45:50 -07001278 dst0.xy = exp(src.xy)
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001279
Corbin Simpsonf98c4622010-06-16 18:45:50 -07001280 dst1.xy = frac(src.xy)
1281
1282 dst0.zw = exp(src.zw)
1283
1284 dst1.zw = frac(src.zw)
1285
1286.. opcode:: DLDEXP - Multiply Number by Integral Power of 2
1287
1288This opcode is the inverse of :opcode:`DFRACEXP`.
1289
1290.. math::
1291
1292 dst.xy = src0.xy \times 2^{src1.xy}
1293
1294 dst.zw = src0.zw \times 2^{src1.zw}
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001295
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001296.. opcode:: DMIN - Minimum
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001297
1298.. math::
1299
1300 dst.xy = min(src0.xy, src1.xy)
1301
1302 dst.zw = min(src0.zw, src1.zw)
1303
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001304.. opcode:: DMAX - Maximum
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001305
1306.. math::
1307
1308 dst.xy = max(src0.xy, src1.xy)
1309
1310 dst.zw = max(src0.zw, src1.zw)
1311
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001312.. opcode:: DMUL - Multiply
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001313
1314.. math::
1315
1316 dst.xy = src0.xy \times src1.xy
1317
1318 dst.zw = src0.zw \times src1.zw
1319
1320
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001321.. opcode:: DMAD - Multiply And Add
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001322
1323.. math::
1324
1325 dst.xy = src0.xy \times src1.xy + src2.xy
1326
1327 dst.zw = src0.zw \times src1.zw + src2.zw
1328
1329
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001330.. opcode:: DRCP - Reciprocal
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001331
1332.. math::
1333
1334 dst.xy = \frac{1}{src.xy}
1335
1336 dst.zw = \frac{1}{src.zw}
1337
Corbin Simpsondbc95e82010-06-16 18:34:51 -07001338.. opcode:: DSQRT - Square Root
Igor Oliveiradb89bf42010-01-25 19:23:04 -04001339
1340.. math::
1341
1342 dst.xy = \sqrt{src.xy}
1343
1344 dst.zw = \sqrt{src.zw}
1345
Keith Whitwella62aaa72009-12-21 23:25:15 +00001346
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001347.. _samplingopcodes:
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001348
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001349Resource Sampling Opcodes
1350^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001351
1352Those opcodes follow very closely semantics of the respective Direct3D
1353instructions. If in doubt double check Direct3D documentation.
1354
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001355.. opcode:: SAMPLE - Using provided address, sample data from the
1356 specified texture using the filtering mode identified
1357 by the gven sampler. The source data may come from
1358 any resource type other than buffers.
1359 SAMPLE dst, address, sampler_view, sampler
1360 e.g.
1361 SAMPLE TEMP[0], TEMP[1], SVIEW[0], SAMP[0]
1362
1363.. opcode:: SAMPLE_I - Simplified alternative to the SAMPLE instruction.
1364 Using the provided integer address, SAMPLE_I fetches data
1365 from the specified sampler view without any filtering.
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001366 The source data may come from any resource type other
1367 than CUBE.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001368 SAMPLE_I dst, address, sampler_view
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001369 e.g.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001370 SAMPLE_I TEMP[0], TEMP[1], SVIEW[0]
Zack Rusin3fa814d2011-01-24 21:45:37 -05001371 The 'address' is specified as unsigned integers. If the
1372 'address' is out of range [0...(# texels - 1)] the
1373 result of the fetch is always 0 in all components.
1374 As such the instruction doesn't honor address wrap
1375 modes, in cases where that behavior is desirable
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001376 'SAMPLE' instruction should be used.
Zack Rusin3fa814d2011-01-24 21:45:37 -05001377 address.w always provides an unsigned integer mipmap
1378 level. If the value is out of the range then the
1379 instruction always returns 0 in all components.
1380 address.yz are ignored for buffers and 1d textures.
1381 address.z is ignored for 1d texture arrays and 2d
1382 textures.
1383 For 1D texture arrays address.y provides the array
1384 index (also as unsigned integer). If the value is
1385 out of the range of available array indices
1386 [0... (array size - 1)] then the opcode always returns
1387 0 in all components.
1388 For 2D texture arrays address.z provides the array
1389 index, otherwise it exhibits the same behavior as in
1390 the case for 1D texture arrays.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001391 The exact semantics of the source address are presented
Zack Rusin3fa814d2011-01-24 21:45:37 -05001392 in the table below:
1393 resource type X Y Z W
1394 ------------- ------------------------
1395 PIPE_BUFFER x ignored
1396 PIPE_TEXTURE_1D x mpl
1397 PIPE_TEXTURE_2D x y mpl
1398 PIPE_TEXTURE_3D x y z mpl
1399 PIPE_TEXTURE_RECT x y mpl
1400 PIPE_TEXTURE_CUBE not allowed as source
1401 PIPE_TEXTURE_1D_ARRAY x idx mpl
1402 PIPE_TEXTURE_2D_ARRAY x y idx mpl
1403
1404 Where 'mpl' is a mipmap level and 'idx' is the
1405 array index.
1406
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001407.. opcode:: SAMPLE_I_MS - Just like SAMPLE_I but allows fetch data from
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001408 multi-sampled surfaces.
Roland Scheidegger98704592013-02-12 16:48:52 +01001409 SAMPLE_I_MS dst, address, sampler_view, sample
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001410
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001411.. opcode:: SAMPLE_B - Just like the SAMPLE instruction with the
Roland Scheidegger98704592013-02-12 16:48:52 +01001412 exception that an additional bias is applied to the
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001413 level of detail computed as part of the instruction
1414 execution.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001415 SAMPLE_B dst, address, sampler_view, sampler, lod_bias
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001416 e.g.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001417 SAMPLE_B TEMP[0], TEMP[1], SVIEW[0], SAMP[0], TEMP[2].x
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001418
Zack Rusin3fa814d2011-01-24 21:45:37 -05001419.. opcode:: SAMPLE_C - Similar to the SAMPLE instruction but it
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001420 performs a comparison filter. The operands to SAMPLE_C
Roland Scheidegger98704592013-02-12 16:48:52 +01001421 are identical to SAMPLE, except that there is an additional
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001422 float32 operand, reference value, which must be a register
1423 with single-component, or a scalar literal.
1424 SAMPLE_C makes the hardware use the current samplers
1425 compare_func (in pipe_sampler_state) to compare
1426 reference value against the red component value for the
1427 surce resource at each texel that the currently configured
1428 texture filter covers based on the provided coordinates.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001429 SAMPLE_C dst, address, sampler_view.r, sampler, ref_value
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001430 e.g.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001431 SAMPLE_C TEMP[0], TEMP[1], SVIEW[0].r, SAMP[0], TEMP[2].x
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001432
1433.. opcode:: SAMPLE_C_LZ - Same as SAMPLE_C, but LOD is 0 and derivatives
1434 are ignored. The LZ stands for level-zero.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001435 SAMPLE_C_LZ dst, address, sampler_view.r, sampler, ref_value
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001436 e.g.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001437 SAMPLE_C_LZ TEMP[0], TEMP[1], SVIEW[0].r, SAMP[0], TEMP[2].x
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001438
1439
1440.. opcode:: SAMPLE_D - SAMPLE_D is identical to the SAMPLE opcode except
1441 that the derivatives for the source address in the x
1442 direction and the y direction are provided by extra
1443 parameters.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001444 SAMPLE_D dst, address, sampler_view, sampler, der_x, der_y
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001445 e.g.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001446 SAMPLE_D TEMP[0], TEMP[1], SVIEW[0], SAMP[0], TEMP[2], TEMP[3]
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001447
1448.. opcode:: SAMPLE_L - SAMPLE_L is identical to the SAMPLE opcode except
1449 that the LOD is provided directly as a scalar value,
Roland Scheidegger427d36a2013-02-12 16:41:56 +01001450 representing no anisotropy.
1451 SAMPLE_L dst, address, sampler_view, sampler, explicit_lod
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001452 e.g.
Roland Scheidegger427d36a2013-02-12 16:41:56 +01001453 SAMPLE_L TEMP[0], TEMP[1], SVIEW[0], SAMP[0], TEMP[2].x
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001454
1455.. opcode:: GATHER4 - Gathers the four texels to be used in a bi-linear
1456 filtering operation and packs them into a single register.
Brian Paul0cd68002012-03-30 09:41:42 -06001457 Only works with 2D, 2D array, cubemaps, and cubemaps arrays.
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001458 For 2D textures, only the addressing modes of the sampler and
1459 the top level of any mip pyramid are used. Set W to zero.
1460 It behaves like the SAMPLE instruction, but a filtered
1461 sample is not generated. The four samples that contribute
Brian Paul0cd68002012-03-30 09:41:42 -06001462 to filtering are placed into xyzw in counter-clockwise order,
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001463 starting with the (u,v) texture coordinate delta at the
1464 following locations (-, +), (+, +), (+, -), (-, -), where
1465 the magnitude of the deltas are half a texel.
1466
1467
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001468.. opcode:: SVIEWINFO - query the dimensions of a given sampler view.
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001469 dst receives width, height, depth or array size and
Roland Scheidegger614982d32013-02-05 13:37:57 -08001470 number of mipmap levels as int4. The dst can have a writemask
Zack Rusin3fa814d2011-01-24 21:45:37 -05001471 which will specify what info is the caller interested
1472 in.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001473 SVIEWINFO dst, src_mip_level, sampler_view
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001474 e.g.
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001475 SVIEWINFO TEMP[0], TEMP[1].x, SVIEW[0]
Zack Rusin3fa814d2011-01-24 21:45:37 -05001476 src_mip_level is an unsigned integer scalar. If it's
1477 out of range then returns 0 for width, height and
1478 depth/array size but the total number of mipmap is
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001479 still returned correctly for the given sampler view.
Zack Rusin3fa814d2011-01-24 21:45:37 -05001480 The returned width, height and depth values are for
1481 the mipmap level selected by the src_mip_level and
1482 are in the number of texels.
1483 For 1d texture array width is in dst.x, array size
1484 is in dst.y and dst.zw are always 0.
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001485
1486.. opcode:: SAMPLE_POS - query the position of a given sample.
1487 dst receives float4 (x, y, 0, 0) indicated where the
1488 sample is located. If the resource is not a multi-sample
1489 resource and not a render target, the result is 0.
1490
Zack Rusin3fa814d2011-01-24 21:45:37 -05001491.. opcode:: SAMPLE_INFO - dst receives number of samples in x.
1492 If the resource is not a multi-sample resource and
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001493 not a render target, the result is 0.
1494
1495
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001496.. _resourceopcodes:
1497
1498Resource Access Opcodes
1499^^^^^^^^^^^^^^^^^^^^^^^
1500
1501.. opcode:: LOAD - Fetch data from a shader resource
1502
1503 Syntax: ``LOAD dst, resource, address``
1504
1505 Example: ``LOAD TEMP[0], RES[0], TEMP[1]``
1506
1507 Using the provided integer address, LOAD fetches data
1508 from the specified buffer or texture without any
1509 filtering.
1510
1511 The 'address' is specified as a vector of unsigned
1512 integers. If the 'address' is out of range the result
1513 is unspecified.
1514
1515 Only the first mipmap level of a resource can be read
1516 from using this instruction.
1517
1518 For 1D or 2D texture arrays, the array index is
1519 provided as an unsigned integer in address.y or
1520 address.z, respectively. address.yz are ignored for
1521 buffers and 1D textures. address.z is ignored for 1D
1522 texture arrays and 2D textures. address.w is always
1523 ignored.
1524
Francisco Jerezb8e808f2012-04-30 20:20:29 +02001525.. opcode:: STORE - Write data to a shader resource
1526
1527 Syntax: ``STORE resource, address, src``
1528
1529 Example: ``STORE RES[0], TEMP[0], TEMP[1]``
1530
1531 Using the provided integer address, STORE writes data
1532 to the specified buffer or texture.
1533
1534 The 'address' is specified as a vector of unsigned
1535 integers. If the 'address' is out of range the result
1536 is unspecified.
1537
1538 Only the first mipmap level of a resource can be
1539 written to using this instruction.
1540
1541 For 1D or 2D texture arrays, the array index is
1542 provided as an unsigned integer in address.y or
1543 address.z, respectively. address.yz are ignored for
1544 buffers and 1D textures. address.z is ignored for 1D
1545 texture arrays and 2D textures. address.w is always
1546 ignored.
1547
Francisco Jereza5f44cc2012-05-01 02:38:51 +02001548
Francisco Jerez9e550c32012-04-30 20:21:38 +02001549.. _threadsyncopcodes:
1550
1551Inter-thread synchronization opcodes
1552^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1553
1554These opcodes are intended for communication between threads running
1555within the same compute grid. For now they're only valid in compute
1556programs.
1557
1558.. opcode:: MFENCE - Memory fence
1559
1560 Syntax: ``MFENCE resource``
1561
1562 Example: ``MFENCE RES[0]``
1563
1564 This opcode forces strong ordering between any memory access
1565 operations that affect the specified resource. This means that
1566 previous loads and stores (and only those) will be performed and
1567 visible to other threads before the program execution continues.
1568
1569
1570.. opcode:: LFENCE - Load memory fence
1571
1572 Syntax: ``LFENCE resource``
1573
1574 Example: ``LFENCE RES[0]``
1575
1576 Similar to MFENCE, but it only affects the ordering of memory loads.
1577
1578
1579.. opcode:: SFENCE - Store memory fence
1580
1581 Syntax: ``SFENCE resource``
1582
1583 Example: ``SFENCE RES[0]``
1584
1585 Similar to MFENCE, but it only affects the ordering of memory stores.
1586
1587
1588.. opcode:: BARRIER - Thread group barrier
1589
1590 ``BARRIER``
1591
1592 This opcode suspends the execution of the current thread until all
1593 the remaining threads in the working group reach the same point of
1594 the program. Results are unspecified if any of the remaining
1595 threads terminates or never reaches an executed BARRIER instruction.
1596
1597
Francisco Jerezc2d31a82012-04-30 20:22:23 +02001598.. _atomopcodes:
1599
1600Atomic opcodes
1601^^^^^^^^^^^^^^
1602
1603These opcodes provide atomic variants of some common arithmetic and
1604logical operations. In this context atomicity means that another
1605concurrent memory access operation that affects the same memory
1606location is guaranteed to be performed strictly before or after the
1607entire execution of the atomic operation.
1608
1609For the moment they're only valid in compute programs.
1610
1611.. opcode:: ATOMUADD - Atomic integer addition
1612
1613 Syntax: ``ATOMUADD dst, resource, offset, src``
1614
1615 Example: ``ATOMUADD TEMP[0], RES[0], TEMP[1], TEMP[2]``
1616
1617 The following operation is performed atomically on each component:
1618
1619.. math::
1620
1621 dst_i = resource[offset]_i
1622
1623 resource[offset]_i = dst_i + src_i
1624
1625
1626.. opcode:: ATOMXCHG - Atomic exchange
1627
1628 Syntax: ``ATOMXCHG dst, resource, offset, src``
1629
1630 Example: ``ATOMXCHG TEMP[0], RES[0], TEMP[1], TEMP[2]``
1631
1632 The following operation is performed atomically on each component:
1633
1634.. math::
1635
1636 dst_i = resource[offset]_i
1637
1638 resource[offset]_i = src_i
1639
1640
1641.. opcode:: ATOMCAS - Atomic compare-and-exchange
1642
1643 Syntax: ``ATOMCAS dst, resource, offset, cmp, src``
1644
1645 Example: ``ATOMCAS TEMP[0], RES[0], TEMP[1], TEMP[2], TEMP[3]``
1646
1647 The following operation is performed atomically on each component:
1648
1649.. math::
1650
1651 dst_i = resource[offset]_i
1652
1653 resource[offset]_i = (dst_i == cmp_i ? src_i : dst_i)
1654
1655
1656.. opcode:: ATOMAND - Atomic bitwise And
1657
1658 Syntax: ``ATOMAND dst, resource, offset, src``
1659
1660 Example: ``ATOMAND TEMP[0], RES[0], TEMP[1], TEMP[2]``
1661
1662 The following operation is performed atomically on each component:
1663
1664.. math::
1665
1666 dst_i = resource[offset]_i
1667
1668 resource[offset]_i = dst_i \& src_i
1669
1670
1671.. opcode:: ATOMOR - Atomic bitwise Or
1672
1673 Syntax: ``ATOMOR dst, resource, offset, src``
1674
1675 Example: ``ATOMOR TEMP[0], RES[0], TEMP[1], TEMP[2]``
1676
1677 The following operation is performed atomically on each component:
1678
1679.. math::
1680
1681 dst_i = resource[offset]_i
1682
1683 resource[offset]_i = dst_i | src_i
1684
1685
1686.. opcode:: ATOMXOR - Atomic bitwise Xor
1687
1688 Syntax: ``ATOMXOR dst, resource, offset, src``
1689
1690 Example: ``ATOMXOR TEMP[0], RES[0], TEMP[1], TEMP[2]``
1691
1692 The following operation is performed atomically on each component:
1693
1694.. math::
1695
1696 dst_i = resource[offset]_i
1697
1698 resource[offset]_i = dst_i \oplus src_i
1699
1700
1701.. opcode:: ATOMUMIN - Atomic unsigned minimum
1702
1703 Syntax: ``ATOMUMIN dst, resource, offset, src``
1704
1705 Example: ``ATOMUMIN TEMP[0], RES[0], TEMP[1], TEMP[2]``
1706
1707 The following operation is performed atomically on each component:
1708
1709.. math::
1710
1711 dst_i = resource[offset]_i
1712
1713 resource[offset]_i = (dst_i < src_i ? dst_i : src_i)
1714
1715
1716.. opcode:: ATOMUMAX - Atomic unsigned maximum
1717
1718 Syntax: ``ATOMUMAX dst, resource, offset, src``
1719
1720 Example: ``ATOMUMAX TEMP[0], RES[0], TEMP[1], TEMP[2]``
1721
1722 The following operation is performed atomically on each component:
1723
1724.. math::
1725
1726 dst_i = resource[offset]_i
1727
1728 resource[offset]_i = (dst_i > src_i ? dst_i : src_i)
1729
1730
1731.. opcode:: ATOMIMIN - Atomic signed minimum
1732
1733 Syntax: ``ATOMIMIN dst, resource, offset, src``
1734
1735 Example: ``ATOMIMIN TEMP[0], RES[0], TEMP[1], TEMP[2]``
1736
1737 The following operation is performed atomically on each component:
1738
1739.. math::
1740
1741 dst_i = resource[offset]_i
1742
1743 resource[offset]_i = (dst_i < src_i ? dst_i : src_i)
1744
1745
1746.. opcode:: ATOMIMAX - Atomic signed maximum
1747
1748 Syntax: ``ATOMIMAX dst, resource, offset, src``
1749
1750 Example: ``ATOMIMAX TEMP[0], RES[0], TEMP[1], TEMP[2]``
1751
1752 The following operation is performed atomically on each component:
1753
1754.. math::
1755
1756 dst_i = resource[offset]_i
1757
1758 resource[offset]_i = (dst_i > src_i ? dst_i : src_i)
1759
1760
1761
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001762Explanation of symbols used
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001763------------------------------
Keith Whitwella62aaa72009-12-21 23:25:15 +00001764
1765
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001766Functions
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001767^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001768
1769
Corbin Simpson14743ac2009-12-21 19:57:56 -08001770 :math:`|x|` Absolute value of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001771
Corbin Simpson14743ac2009-12-21 19:57:56 -08001772 :math:`\lceil x \rceil` Ceiling of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001773
1774 clamp(x,y,z) Clamp x between y and z.
1775 (x < y) ? y : (x > z) ? z : x
1776
Corbin Simpsondd801e52009-12-21 19:41:09 -08001777 :math:`\lfloor x\rfloor` Floor of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001778
Corbin Simpson14743ac2009-12-21 19:57:56 -08001779 :math:`\log_2{x}` Logarithm of `x`, base 2.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001780
1781 max(x,y) Maximum of x and y.
1782 (x > y) ? x : y
1783
1784 min(x,y) Minimum of x and y.
1785 (x < y) ? x : y
1786
1787 partialx(x) Derivative of x relative to fragment's X.
1788
1789 partialy(x) Derivative of x relative to fragment's Y.
1790
1791 pop() Pop from stack.
1792
Corbin Simpsondd801e52009-12-21 19:41:09 -08001793 :math:`x^y` `x` to the power `y`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001794
1795 push(x) Push x on stack.
1796
1797 round(x) Round x.
1798
Michal Krol07f416c2010-01-04 13:21:32 +01001799 trunc(x) Truncate x, i.e. drop the fraction bits.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001800
1801
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001802Keywords
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001803^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001804
1805
1806 discard Discard fragment.
1807
Keith Whitwella62aaa72009-12-21 23:25:15 +00001808 pc Program counter.
1809
Keith Whitwella62aaa72009-12-21 23:25:15 +00001810 target Label of target instruction.
1811
1812
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001813Other tokens
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001814---------------
Keith Whitwella62aaa72009-12-21 23:25:15 +00001815
1816
Michal Krol63d60972010-02-03 15:45:32 +01001817Declaration
1818^^^^^^^^^^^
1819
1820
1821Declares a register that is will be referenced as an operand in Instruction
1822tokens.
1823
1824File field contains register file that is being declared and is one
1825of TGSI_FILE.
1826
1827UsageMask field specifies which of the register components can be accessed
1828and is one of TGSI_WRITEMASK.
1829
Francisco Jerez26449522012-03-18 19:21:36 +01001830The Local flag specifies that a given value isn't intended for
1831subroutine parameter passing and, as a result, the implementation
1832isn't required to give any guarantees of it being preserved across
1833subroutine boundaries. As it's merely a compiler hint, the
1834implementation is free to ignore it.
1835
Michal Krol63d60972010-02-03 15:45:32 +01001836If Dimension flag is set to 1, a Declaration Dimension token follows.
1837
1838If Semantic flag is set to 1, a Declaration Semantic token follows.
1839
Francisco Jerez12799232012-04-30 18:27:52 +02001840If Interpolate flag is set to 1, a Declaration Interpolate token follows.
Michal Krol63d60972010-02-03 15:45:32 +01001841
Zack Rusinbdbe77f2011-01-24 17:47:10 -05001842If file is TGSI_FILE_RESOURCE, a Declaration Resource token follows.
1843
Christian König897303f2013-03-14 11:10:16 +01001844If Array flag is set to 1, a Declaration Array token follows.
1845
1846Array Declaration
1847^^^^^^^^^^^^^^^^^^^^^^^^
1848
1849Declarations can optional have an ArrayID attribute which can be referred by
1850indirect addressing operands. An ArrayID of zero is reserved and treaded as
1851if no ArrayID is specified.
1852
1853If an indirect addressing operand refers to a specific declaration by using
1854an ArrayID only the registers in this declaration are guaranteed to be
1855accessed, accessing any register outside this declaration results in undefined
1856behavior. Note that for compatibility the effective index is zero-based and
1857not relative to the specified declaration
1858
1859If no ArrayID is specified with an indirect addressing operand the whole
1860register file might be accessed by this operand. This is strongly discouraged
1861and will prevent packing of scalar/vec2 arrays and effective alias analysis.
Michal Krol63d60972010-02-03 15:45:32 +01001862
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001863Declaration Semantic
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001864^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001865
Brian Paul05a18f42010-06-24 07:21:15 -06001866 Vertex and fragment shader input and output registers may be labeled
1867 with semantic information consisting of a name and index.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001868
1869 Follows Declaration token if Semantic bit is set.
1870
1871 Since its purpose is to link a shader with other stages of the pipeline,
1872 it is valid to follow only those Declaration tokens that declare a register
1873 either in INPUT or OUTPUT file.
1874
1875 SemanticName field contains the semantic name of the register being declared.
1876 There is no default value.
1877
1878 SemanticIndex is an optional subscript that can be used to distinguish
1879 different register declarations with the same semantic name. The default value
1880 is 0.
1881
1882 The meanings of the individual semantic names are explained in the following
1883 sections.
1884
Corbin Simpson54ddf642009-12-23 23:36:06 -08001885TGSI_SEMANTIC_POSITION
1886""""""""""""""""""""""
Keith Whitwella62aaa72009-12-21 23:25:15 +00001887
Brian Paul50b3f2e2010-06-23 17:00:10 -06001888For vertex shaders, TGSI_SEMANTIC_POSITION indicates the vertex shader
1889output register which contains the homogeneous vertex position in the clip
1890space coordinate system. After clipping, the X, Y and Z components of the
1891vertex will be divided by the W value to get normalized device coordinates.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001892
Brian Paul50b3f2e2010-06-23 17:00:10 -06001893For fragment shaders, TGSI_SEMANTIC_POSITION is used to indicate that
1894fragment shader input contains the fragment's window position. The X
1895component starts at zero and always increases from left to right.
1896The Y component starts at zero and always increases but Y=0 may either
1897indicate the top of the window or the bottom depending on the fragment
1898coordinate origin convention (see TGSI_PROPERTY_FS_COORD_ORIGIN).
1899The Z coordinate ranges from 0 to 1 to represent depth from the front
1900to the back of the Z buffer. The W component contains the reciprocol
1901of the interpolated vertex position W component.
Corbin Simpson54ddf642009-12-23 23:36:06 -08001902
Brian Paul05a18f42010-06-24 07:21:15 -06001903Fragment shaders may also declare an output register with
1904TGSI_SEMANTIC_POSITION. Only the Z component is writable. This allows
1905the fragment shader to change the fragment's Z position.
1906
Corbin Simpson54ddf642009-12-23 23:36:06 -08001907
Corbin Simpson54ddf642009-12-23 23:36:06 -08001908
1909TGSI_SEMANTIC_COLOR
1910"""""""""""""""""""
1911
Brian Paul50b3f2e2010-06-23 17:00:10 -06001912For vertex shader outputs or fragment shader inputs/outputs, this
1913label indicates that the resister contains an R,G,B,A color.
Corbin Simpson54ddf642009-12-23 23:36:06 -08001914
Brian Paul50b3f2e2010-06-23 17:00:10 -06001915Several shader inputs/outputs may contain colors so the semantic index
1916is used to distinguish them. For example, color[0] may be the diffuse
1917color while color[1] may be the specular color.
1918
1919This label is needed so that the flat/smooth shading can be applied
1920to the right interpolants during rasterization.
1921
1922
Corbin Simpson54ddf642009-12-23 23:36:06 -08001923
1924TGSI_SEMANTIC_BCOLOR
1925""""""""""""""""""""
1926
1927Back-facing colors are only used for back-facing polygons, and are only valid
1928in vertex shader outputs. After rasterization, all polygons are front-facing
Brian Paul50b3f2e2010-06-23 17:00:10 -06001929and COLOR and BCOLOR end up occupying the same slots in the fragment shader,
1930so all BCOLORs effectively become regular COLORs in the fragment shader.
1931
Corbin Simpson54ddf642009-12-23 23:36:06 -08001932
1933TGSI_SEMANTIC_FOG
1934"""""""""""""""""
1935
Brian Paul05a18f42010-06-24 07:21:15 -06001936Vertex shader inputs and outputs and fragment shader inputs may be
1937labeled with TGSI_SEMANTIC_FOG to indicate that the register contains
1938a fog coordinate in the form (F, 0, 0, 1). Typically, the fragment
1939shader will use the fog coordinate to compute a fog blend factor which
1940is used to blend the normal fragment color with a constant fog color.
Corbin Simpson54ddf642009-12-23 23:36:06 -08001941
Brian Paul05a18f42010-06-24 07:21:15 -06001942Only the first component matters when writing from the vertex shader;
1943the driver will ensure that the coordinate is in this format when used
1944as a fragment shader input.
1945
Corbin Simpson54ddf642009-12-23 23:36:06 -08001946
1947TGSI_SEMANTIC_PSIZE
1948"""""""""""""""""""
1949
Brian Paul05a18f42010-06-24 07:21:15 -06001950Vertex shader input and output registers may be labeled with
1951TGIS_SEMANTIC_PSIZE to indicate that the register contains a point size
1952in the form (S, 0, 0, 1). The point size controls the width or diameter
1953of points for rasterization. This label cannot be used in fragment
1954shaders.
Corbin Simpson54ddf642009-12-23 23:36:06 -08001955
1956When using this semantic, be sure to set the appropriate state in the
1957:ref:`rasterizer` first.
1958
Brian Paul05a18f42010-06-24 07:21:15 -06001959
Christoph Bumiller8acaf862013-03-15 22:11:31 +01001960TGSI_SEMANTIC_TEXCOORD
1961""""""""""""""""""""""
1962
1963Only available if PIPE_CAP_TGSI_TEXCOORD is exposed !
1964
1965Vertex shader outputs and fragment shader inputs may be labeled with
1966this semantic to make them replaceable by sprite coordinates via the
1967sprite_coord_enable state in the :ref:`rasterizer`.
1968The semantic index permitted with this semantic is limited to <= 7.
1969
1970If the driver does not support TEXCOORD, sprite coordinate replacement
1971applies to inputs with the GENERIC semantic instead.
1972
1973The intended use case for this semantic is gl_TexCoord.
1974
1975
1976TGSI_SEMANTIC_PCOORD
1977""""""""""""""""""""
1978
1979Only available if PIPE_CAP_TGSI_TEXCOORD is exposed !
1980
1981Fragment shader inputs may be labeled with TGSI_SEMANTIC_PCOORD to indicate
1982that the register contains sprite coordinates in the form (x, y, 0, 1), if
1983the current primitive is a point and point sprites are enabled. Otherwise,
1984the contents of the register are undefined.
1985
1986The intended use case for this semantic is gl_PointCoord.
1987
1988
Corbin Simpson54ddf642009-12-23 23:36:06 -08001989TGSI_SEMANTIC_GENERIC
1990"""""""""""""""""""""
1991
Brian Paul05a18f42010-06-24 07:21:15 -06001992All vertex/fragment shader inputs/outputs not labeled with any other
1993semantic label can be considered to be generic attributes. Typical
1994uses of generic inputs/outputs are texcoords and user-defined values.
Corbin Simpson54ddf642009-12-23 23:36:06 -08001995
Corbin Simpson54ddf642009-12-23 23:36:06 -08001996
1997TGSI_SEMANTIC_NORMAL
1998""""""""""""""""""""
1999
Brian Paul05a18f42010-06-24 07:21:15 -06002000Indicates that a vertex shader input is a normal vector. This is
2001typically only used for legacy graphics APIs.
2002
Corbin Simpson54ddf642009-12-23 23:36:06 -08002003
2004TGSI_SEMANTIC_FACE
2005""""""""""""""""""
2006
Brian Paul05a18f42010-06-24 07:21:15 -06002007This label applies to fragment shader inputs only and indicates that
2008the register contains front/back-face information of the form (F, 0,
20090, 1). The first component will be positive when the fragment belongs
2010to a front-facing polygon, and negative when the fragment belongs to a
2011back-facing polygon.
2012
Corbin Simpson54ddf642009-12-23 23:36:06 -08002013
2014TGSI_SEMANTIC_EDGEFLAG
2015""""""""""""""""""""""
2016
Brian Paul73153002010-06-23 17:38:58 -06002017For vertex shaders, this sematic label indicates that an input or
2018output is a boolean edge flag. The register layout is [F, x, x, x]
2019where F is 0.0 or 1.0 and x = don't care. Normally, the vertex shader
2020simply copies the edge flag input to the edgeflag output.
2021
2022Edge flags are used to control which lines or points are actually
2023drawn when the polygon mode converts triangles/quads/polygons into
2024points or lines.
2025
Dave Airlie4ecb2c12010-10-06 09:28:46 +10002026TGSI_SEMANTIC_STENCIL
2027""""""""""""""""""""""
2028
2029For fragment shaders, this semantic label indicates than an output
2030is a writable stencil reference value. Only the Y component is writable.
2031This allows the fragment shader to change the fragments stencilref value.
Luca Barbieri73317132010-01-21 05:36:14 +01002032
2033
Francisco Jerez12799232012-04-30 18:27:52 +02002034Declaration Interpolate
2035^^^^^^^^^^^^^^^^^^^^^^^
2036
2037This token is only valid for fragment shader INPUT declarations.
2038
2039The Interpolate field specifes the way input is being interpolated by
2040the rasteriser and is one of TGSI_INTERPOLATE_*.
2041
2042The CylindricalWrap bitfield specifies which register components
2043should be subject to cylindrical wrapping when interpolating by the
2044rasteriser. If TGSI_CYLINDRICAL_WRAP_X is set to 1, the X component
2045should be interpolated according to cylindrical wrapping rules.
2046
2047
Francisco Jereza5f44cc2012-05-01 02:38:51 +02002048Declaration Sampler View
Zack Rusinbdbe77f2011-01-24 17:47:10 -05002049^^^^^^^^^^^^^^^^^^^^^^^^
2050
Francisco Jereza5f44cc2012-05-01 02:38:51 +02002051 Follows Declaration token if file is TGSI_FILE_SAMPLER_VIEW.
2052
2053 DCL SVIEW[#], resource, type(s)
2054
2055 Declares a shader input sampler view and assigns it to a SVIEW[#]
2056 register.
2057
2058 resource can be one of BUFFER, 1D, 2D, 3D, 1DArray and 2DArray.
2059
2060 type must be 1 or 4 entries (if specifying on a per-component
2061 level) out of UNORM, SNORM, SINT, UINT and FLOAT.
2062
2063
2064Declaration Resource
2065^^^^^^^^^^^^^^^^^^^^
2066
Zack Rusinbdbe77f2011-01-24 17:47:10 -05002067 Follows Declaration token if file is TGSI_FILE_RESOURCE.
2068
Francisco Jerezb8e808f2012-04-30 20:20:29 +02002069 DCL RES[#], resource [, WR] [, RAW]
Zack Rusinbdbe77f2011-01-24 17:47:10 -05002070
2071 Declares a shader input resource and assigns it to a RES[#]
2072 register.
2073
2074 resource can be one of BUFFER, 1D, 2D, 3D, CUBE, 1DArray and
2075 2DArray.
2076
Francisco Jerez82c90b22012-04-30 19:08:55 +02002077 If the RAW keyword is not specified, the texture data will be
2078 subject to conversion, swizzling and scaling as required to yield
2079 the specified data type from the physical data format of the bound
2080 resource.
2081
2082 If the RAW keyword is specified, no channel conversion will be
2083 performed: the values read for each of the channels (X,Y,Z,W) will
2084 correspond to consecutive words in the same order and format
2085 they're found in memory. No element-to-address conversion will be
2086 performed either: the value of the provided X coordinate will be
2087 interpreted in byte units instead of texel units. The result of
2088 accessing a misaligned address is undefined.
2089
Francisco Jerezb8e808f2012-04-30 20:20:29 +02002090 Usage of the STORE opcode is only allowed if the WR (writable) flag
2091 is set.
2092
Zack Rusinbdbe77f2011-01-24 17:47:10 -05002093
Luca Barbieri73317132010-01-21 05:36:14 +01002094Properties
2095^^^^^^^^^^^^^^^^^^^^^^^^
2096
2097
2098 Properties are general directives that apply to the whole TGSI program.
2099
2100FS_COORD_ORIGIN
2101"""""""""""""""
2102
2103Specifies the fragment shader TGSI_SEMANTIC_POSITION coordinate origin.
2104The default value is UPPER_LEFT.
2105
2106If UPPER_LEFT, the position will be (0,0) at the upper left corner and
2107increase downward and rightward.
2108If LOWER_LEFT, the position will be (0,0) at the lower left corner and
2109increase upward and rightward.
2110
2111OpenGL defaults to LOWER_LEFT, and is configurable with the
2112GL_ARB_fragment_coord_conventions extension.
2113
2114DirectX 9/10 use UPPER_LEFT.
2115
2116FS_COORD_PIXEL_CENTER
2117"""""""""""""""""""""
2118
2119Specifies the fragment shader TGSI_SEMANTIC_POSITION pixel center convention.
2120The default value is HALF_INTEGER.
2121
2122If HALF_INTEGER, the fractionary part of the position will be 0.5
2123If INTEGER, the fractionary part of the position will be 0.0
2124
2125Note that this does not affect the set of fragments generated by
2126rasterization, which is instead controlled by gl_rasterization_rules in the
2127rasterizer.
2128
2129OpenGL defaults to HALF_INTEGER, and is configurable with the
2130GL_ARB_fragment_coord_conventions extension.
2131
2132DirectX 9 uses INTEGER.
2133DirectX 10 uses HALF_INTEGER.
Brian Paul4778f462010-02-02 08:14:40 -07002134
Dave Airliec9c8a5e2010-12-18 10:34:35 +10002135FS_COLOR0_WRITES_ALL_CBUFS
2136""""""""""""""""""""""""""
2137Specifies that writes to the fragment shader color 0 are replicated to all
2138bound cbufs. This facilitates OpenGL's fragColor output vs fragData[0] where
2139fragData is directed to a single color buffer, but fragColor is broadcast.
Brian Paul4778f462010-02-02 08:14:40 -07002140
Marek Olšákdc4c8212012-01-10 00:19:00 +01002141VS_PROHIBIT_UCPS
2142""""""""""""""""""""""""""
2143If this property is set on the program bound to the shader stage before the
2144fragment shader, user clip planes should have no effect (be disabled) even if
2145that shader does not write to any clip distance outputs and the rasterizer's
2146clip_plane_enable is non-zero.
2147This property is only supported by drivers that also support shader clip
2148distance outputs.
2149This is useful for APIs that don't have UCPs and where clip distances written
2150by a shader cannot be disabled.
2151
Brian Paul4778f462010-02-02 08:14:40 -07002152
2153Texture Sampling and Texture Formats
2154------------------------------------
2155
Corbin Simpson797dcc02010-02-02 17:07:26 -08002156This table shows how texture image components are returned as (x,y,z,w) tuples
2157by TGSI texture instructions, such as :opcode:`TEX`, :opcode:`TXD`, and
2158:opcode:`TXP`. For reference, OpenGL and Direct3D conventions are shown as
2159well.
Brian Paul4778f462010-02-02 08:14:40 -07002160
Corbin Simpson516e7152010-02-02 12:44:22 -08002161+--------------------+--------------+--------------------+--------------+
2162| Texture Components | Gallium | OpenGL | Direct3D 9 |
2163+====================+==============+====================+==============+
Corbin Simpson92867dc2010-06-16 16:56:55 -07002164| R | (r, 0, 0, 1) | (r, 0, 0, 1) | (r, 1, 1, 1) |
Corbin Simpson516e7152010-02-02 12:44:22 -08002165+--------------------+--------------+--------------------+--------------+
Corbin Simpson92867dc2010-06-16 16:56:55 -07002166| RG | (r, g, 0, 1) | (r, g, 0, 1) | (r, g, 1, 1) |
Corbin Simpson516e7152010-02-02 12:44:22 -08002167+--------------------+--------------+--------------------+--------------+
2168| RGB | (r, g, b, 1) | (r, g, b, 1) | (r, g, b, 1) |
2169+--------------------+--------------+--------------------+--------------+
2170| RGBA | (r, g, b, a) | (r, g, b, a) | (r, g, b, a) |
2171+--------------------+--------------+--------------------+--------------+
2172| A | (0, 0, 0, a) | (0, 0, 0, a) | (0, 0, 0, a) |
2173+--------------------+--------------+--------------------+--------------+
2174| L | (l, l, l, 1) | (l, l, l, 1) | (l, l, l, 1) |
2175+--------------------+--------------+--------------------+--------------+
2176| LA | (l, l, l, a) | (l, l, l, a) | (l, l, l, a) |
2177+--------------------+--------------+--------------------+--------------+
2178| I | (i, i, i, i) | (i, i, i, i) | N/A |
2179+--------------------+--------------+--------------------+--------------+
2180| UV | XXX TBD | (0, 0, 0, 1) | (u, v, 1, 1) |
2181| | | [#envmap-bumpmap]_ | |
2182+--------------------+--------------+--------------------+--------------+
Brian Paul3e572eb2010-02-02 16:27:07 -07002183| Z | XXX TBD | (z, z, z, 1) | (0, z, 0, 1) |
Corbin Simpson516e7152010-02-02 12:44:22 -08002184| | | [#depth-tex-mode]_ | |
2185+--------------------+--------------+--------------------+--------------+
Dave Airlie66a0d1e2010-10-06 09:30:17 +10002186| S | (s, s, s, s) | unknown | unknown |
2187+--------------------+--------------+--------------------+--------------+
Brian Paul4778f462010-02-02 08:14:40 -07002188
Corbin Simpson516e7152010-02-02 12:44:22 -08002189.. [#envmap-bumpmap] http://www.opengl.org/registry/specs/ATI/envmap_bumpmap.txt
Brian Paul3e572eb2010-02-02 16:27:07 -07002190.. [#depth-tex-mode] the default is (z, z, z, 1) but may also be (0, 0, 0, z)
Corbin Simpson797dcc02010-02-02 17:07:26 -08002191 or (z, z, z, z) depending on the value of GL_DEPTH_TEXTURE_MODE.