• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 Connor Abbott <cwabbott0@gmail.com>
3  * Copyright (C) 2019 Lyude Paul <thatslyude@gmail.com>
4  * Copyright (C) 2019 Ryan Houdek <Sonicadvance1@gmail.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the next
14  * paragraph) shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #ifndef __bifrost_h__
27 #define __bifrost_h__
28 
29 #include <stdint.h>
30 #include <stdbool.h>
31 
32 #define BIFROST_DBG_MSGS        0x0001
33 #define BIFROST_DBG_SHADERS     0x0002
34 
35 extern int bifrost_debug;
36 
37 enum bifrost_message_type {
38         BIFROST_MESSAGE_NONE       = 0,
39         BIFROST_MESSAGE_VARYING    = 1,
40         BIFROST_MESSAGE_ATTRIBUTE  = 2,
41         BIFROST_MESSAGE_TEX        = 3,
42         BIFROST_MESSAGE_VARTEX     = 4,
43         BIFROST_MESSAGE_LOAD       = 5,
44         BIFROST_MESSAGE_STORE      = 6,
45         BIFROST_MESSAGE_ATOMIC     = 7,
46         BIFROST_MESSAGE_BARRIER    = 8,
47         BIFROST_MESSAGE_BLEND      = 9,
48         BIFROST_MESSAGE_TILE       = 10,
49         /* type 11 reserved */
50         BIFROST_MESSAGE_Z_STENCIL  = 12,
51         BIFROST_MESSAGE_ATEST      = 13,
52         BIFROST_MESSAGE_JOB        = 14,
53         BIFROST_MESSAGE_64BIT      = 15
54 };
55 
56 enum bifrost_ftz {
57         BIFROST_FTZ_DISABLE = 0,
58         BIFROST_FTZ_DX11 = 1,
59         BIFROST_FTZ_ALWAYS = 2,
60         BIFROST_FTZ_ABRUPT = 3
61 };
62 
63 enum bifrost_exceptions {
64         BIFROST_EXCEPTIONS_ENABLED = 0,
65         BIFROST_EXCEPTIONS_DISABLED = 1,
66         BIFROST_EXCEPTIONS_PRECISE_DIVISION = 2,
67         BIFROST_EXCEPTIONS_PRECISE_SQRT = 3,
68 };
69 
70 /* Describes clause flow control, with respect to control flow and branch
71  * reconvergence.
72  *
73  * Control flow may be considered back-to-back (execute clauses back-to-back),
74  * non-back-to-back (switch warps after clause before the next clause), write
75  * elision (back-to-back and elide register slot #3 write from the clause), or
76  * end of shader.
77  *
78  * Branch reconvergence may be disabled, enabled unconditionally, or enabled
79  * based on the program counter. A clause requires reconvergence if it has a
80  * successor that can be executed without first executing the clause itself.
81  * Separate iterations of a loop are treated separately here, so it is also the
82  * case for a loop exit where the iteration count is not warp-invariant.
83  *
84  */
85 
86 enum bifrost_flow {
87         /* End-of-shader */
88         BIFROST_FLOW_END = 0,
89 
90         /* Non back-to-back, PC-encoded reconvergence */
91         BIFROST_FLOW_NBTB_PC = 1,
92 
93         /* Non back-to-back, unconditional reconvergence */
94         BIFROST_FLOW_NBTB_UNCONDITIONAL = 2,
95 
96         /* Non back-to-back, no reconvergence */
97         BIFROST_FLOW_NBTB = 3,
98 
99         /* Back-to-back, unconditional reconvergence */
100         BIFROST_FLOW_BTB_UNCONDITIONAL = 4,
101 
102         /* Back-to-back, no reconvergence */
103         BIFROST_FLOW_BTB_NONE = 5,
104 
105         /* Write elision, unconditional reconvergence */
106         BIFROST_FLOW_WE_UNCONDITIONAL = 6,
107 
108         /* Write elision, no reconvergence */
109         BIFROST_FLOW_WE = 7,
110 };
111 
112 struct bifrost_header {
113         /* Reserved */
114         unsigned zero1 : 5;
115 
116         /* Flush-to-zero mode, leave zero for GL */
117         enum bifrost_ftz flush_to_zero : 2;
118 
119         /* Convert any infinite result of any floating-point operation to the
120          * biggest representable number */
121         unsigned suppress_inf: 1;
122 
123         /* Convert NaN to +0.0 */
124         unsigned suppress_nan : 1;
125 
126         /* Floating-point excception handling mode */
127         enum bifrost_exceptions float_exceptions : 2;
128 
129         /* Enum describing the flow control, which matters for handling
130          * divergence and reconvergence efficiently */
131         enum bifrost_flow flow_control : 3;
132 
133         /* Reserved */
134         unsigned zero2 : 1;
135 
136         /* Terminate discarded threads, rather than continuing execution. Set
137          * for fragment shaders for standard GL behaviour of DISCARD. Also in a
138          * fragment shader, this disables helper invocations, so cannot be used
139          * in a shader that requires derivatives or texture LOD computation */
140         unsigned terminate_discarded_threads : 1;
141 
142         /* If set, the hardware may prefetch the next clause. If false, the
143          * hardware may not. Clear for unconditional branches. */
144         unsigned next_clause_prefetch : 1;
145 
146         /* If set, a barrier will be inserted after the clause waiting for all
147          * message passing instructions to read their staging registers, such
148          * that it is safe for the next clause to write them. */
149         unsigned staging_barrier: 1;
150         unsigned staging_register : 6;
151 
152         /* Slots to wait on and slot to be used for message passing
153          * instructions respectively */
154         unsigned dependency_wait : 8;
155         unsigned dependency_slot : 3;
156 
157         enum bifrost_message_type message_type : 5;
158         enum bifrost_message_type next_message_type : 5;
159 } __attribute__((packed));
160 
161 enum bifrost_packed_src {
162         BIFROST_SRC_PORT0    = 0,
163         BIFROST_SRC_PORT1    = 1,
164         BIFROST_SRC_PORT2    = 2,
165         BIFROST_SRC_STAGE    = 3,
166         BIFROST_SRC_FAU_LO   = 4,
167         BIFROST_SRC_FAU_HI   = 5,
168         BIFROST_SRC_PASS_FMA = 6,
169         BIFROST_SRC_PASS_ADD = 7,
170 };
171 
172 struct bifrost_fma_inst {
173         unsigned src0 : 3;
174         unsigned op   : 20;
175 } __attribute__((packed));
176 
177 struct bifrost_add_inst {
178         unsigned src0 : 3;
179         unsigned op   : 17;
180 } __attribute__((packed));
181 
182 enum bifrost_outmod {
183         BIFROST_NONE = 0x0,
184         BIFROST_POS = 0x1,
185         BIFROST_SAT_SIGNED = 0x2,
186         BIFROST_SAT = 0x3,
187 };
188 
189 enum bifrost_roundmode {
190         BIFROST_RTE = 0x0, /* round to even */
191         BIFROST_RTP = 0x1, /* round to positive */
192         BIFROST_RTN = 0x2, /* round to negative */
193         BIFROST_RTZ = 0x3 /* round to zero */
194 };
195 
196 /* NONE: Same as fmax() and fmin() -- return the other
197  * number if any number is NaN.  Also always return +0 if
198  * one argument is +0 and the other is -0.
199  *
200  * NAN_WINS: Instead of never returning a NaN, always return
201  * one. The "greater"/"lesser" NaN is always returned, first
202  * by checking the sign and then the mantissa bits.
203  *
204  * SRC1_WINS: For max, implement src0 > src1 ? src0 : src1.
205  * For min, implement src0 < src1 ? src0 : src1.  This
206  * includes handling NaN's and signedness of 0 differently
207  * from above, since +0 and -0 compare equal and comparisons
208  * always return false for NaN's. As a result, this mode is
209  * *not* commutative.
210  *
211  * SRC0_WINS: For max, implement src0 < src1 ? src1 : src0
212  * For min, implement src0 > src1 ? src1 : src0
213  */
214 
215 
216 enum bifrost_minmax_mode {
217         BIFROST_MINMAX_NONE = 0x0,
218         BIFROST_NAN_WINS    = 0x1,
219         BIFROST_SRC1_WINS   = 0x2,
220         BIFROST_SRC0_WINS   = 0x3,
221 };
222 
223 enum bifrost_interp_mode {
224         BIFROST_INTERP_CENTER = 0x0,
225         BIFROST_INTERP_CENTROID = 0x1,
226         BIFROST_INTERP_SAMPLE  = 0x2,
227         BIFROST_INTERP_EXPLICIT = 0x3,
228         BIFROST_INTERP_NONE = 0x4,
229 };
230 
231 /* Fixed location for gl_FragCoord.zw */
232 #define BIFROST_FRAGZ (23)
233 #define BIFROST_FRAGW (22)
234 
235 enum branch_bit_size {
236         BR_SIZE_32 = 0,
237         BR_SIZE_16XX = 1,
238         BR_SIZE_16YY = 2,
239         // For the above combinations of bitsize and location, an extra bit is
240         // encoded via comparing the sources. The only possible source of ambiguity
241         // would be if the sources were the same, but then the branch condition
242         // would be always true or always false anyways, so we can ignore it. But
243         // this no longer works when comparing the y component to the x component,
244         // since it's valid to compare the y component of a source against its own
245         // x component. Instead, the extra bit is encoded via an extra bitsize.
246         BR_SIZE_16YX0 = 3,
247         BR_SIZE_16YX1 = 4,
248         BR_SIZE_32_AND_16X = 5,
249         BR_SIZE_32_AND_16Y = 6,
250         // Used for comparisons with zero and always-true, see below. I think this
251         // only works for integer comparisons.
252         BR_SIZE_ZERO = 7,
253 };
254 
255 struct bifrost_regs {
256         unsigned fau_idx : 8;
257         unsigned reg3 : 6;
258         unsigned reg2 : 6;
259         unsigned reg0 : 5;
260         unsigned reg1 : 6;
261         unsigned ctrl : 4;
262 } __attribute__((packed));
263 
264 enum bifrost_branch_cond {
265         BR_COND_LT = 0,
266         BR_COND_LE = 1,
267         BR_COND_GE = 2,
268         BR_COND_GT = 3,
269         // Equal vs. not-equal determined by src0/src1 comparison
270         BR_COND_EQ = 4,
271         // floating-point comparisons
272         // Becomes UNE when you flip the arguments
273         BR_COND_OEQ = 5,
274         // TODO what happens when you flip the arguments?
275         BR_COND_OGT = 6,
276         BR_COND_OLT = 7,
277 };
278 
279 enum bifrost_branch_code {
280         BR_ALWAYS = 63,
281 };
282 
283 #define BIFROST_ADD_OP_BRANCH (0x0d000 >> 12)
284 
285 struct bifrost_branch {
286         unsigned src0 : 3;
287 
288         /* For BR_SIZE_ZERO, upper two bits become ctrl */
289         unsigned src1 : 3;
290 
291         /* Offset source -- always uniform/const but
292          * theoretically could support indirect jumps? */
293         unsigned src2 : 3;
294 
295         enum bifrost_branch_cond cond : 3;
296         enum branch_bit_size size : 3;
297 
298         unsigned op : 5;
299 };
300 
301 /* Clause packing */
302 
303 struct bifrost_fmt1 {
304         unsigned ins_0 : 3;
305         unsigned tag : 5;
306         uint64_t ins_1 : 64;
307         unsigned ins_2 : 11;
308         uint64_t header : 45;
309 } __attribute__((packed));
310 
311 #define BIFROST_FMT1_INSTRUCTIONS    0b00101
312 #define BIFROST_FMT1_FINAL           0b01001
313 #define BIFROST_FMT1_CONSTANTS       0b00001
314 
315 #define BIFROST_FMTC_CONSTANTS       0b0011
316 #define BIFROST_FMTC_FINAL           0b0111
317 
318 struct bifrost_fmt_constant {
319         unsigned pos : 4;
320         unsigned tag : 4;
321         uint64_t imm_1 : 60;
322         uint64_t imm_2 : 60;
323 } __attribute__((packed));
324 
325 /* 32-bit modes for slots 2/3, as encoded in the register block. Other values
326  * are reserved. First part specifies behaviour of slot 2 (Idle, Read, Write
327  * Full, Write Low, Write High), second part behaviour of slot 3, and the last
328  * part specifies the source for the write (FMA, ADD, or MIX for FMA/ADD).
329  *
330  * IDLE is a special mode disabling both slots, except for the first
331  * instruction in the clause which uses IDLE_1 for the same purpose.
332  *
333  * All fields 0 used as sentinel for reserved encoding, so IDLE(_1) have FMA
334  * set (and ignored) as a placeholder to differentiate from reserved.
335  */
336 enum bifrost_reg_mode {
337         BIFROST_R_WL_FMA  = 1,
338         BIFROST_R_WH_FMA  = 2,
339         BIFROST_R_W_FMA   = 3,
340         BIFROST_R_WL_ADD  = 4,
341         BIFROST_R_WH_ADD  = 5,
342         BIFROST_R_W_ADD   = 6,
343         BIFROST_WL_WL_ADD = 7,
344         BIFROST_WL_WH_ADD = 8,
345         BIFROST_WL_W_ADD  = 9,
346         BIFROST_WH_WL_ADD = 10,
347         BIFROST_WH_WH_ADD = 11,
348         BIFROST_WH_W_ADD  = 12,
349         BIFROST_W_WL_ADD  = 13,
350         BIFROST_W_WH_ADD  = 14,
351         BIFROST_W_W_ADD   = 15,
352         BIFROST_IDLE_1    = 16,
353         BIFROST_I_W_FMA   = 17,
354         BIFROST_I_WL_FMA  = 18,
355         BIFROST_I_WH_FMA  = 19,
356         BIFROST_R_I       = 20,
357         BIFROST_I_W_ADD   = 21,
358         BIFROST_I_WL_ADD  = 22,
359         BIFROST_I_WH_ADD  = 23,
360         BIFROST_WL_WH_MIX = 24,
361         BIFROST_WH_WL_MIX = 26,
362         BIFROST_IDLE      = 27,
363 };
364 
365 enum bifrost_reg_op {
366         BIFROST_OP_IDLE = 0,
367         BIFROST_OP_READ = 1,
368         BIFROST_OP_WRITE = 2,
369         BIFROST_OP_WRITE_LO = 3,
370         BIFROST_OP_WRITE_HI = 4,
371 };
372 
373 struct bifrost_reg_ctrl_23 {
374         enum bifrost_reg_op slot2;
375         enum bifrost_reg_op slot3;
376         bool slot3_fma;
377 };
378 
379 static const struct bifrost_reg_ctrl_23 bifrost_reg_ctrl_lut[32] = {
380         [BIFROST_R_WL_FMA]  = { BIFROST_OP_READ,     BIFROST_OP_WRITE_LO, true },
381         [BIFROST_R_WH_FMA]  = { BIFROST_OP_READ,     BIFROST_OP_WRITE_HI, true },
382         [BIFROST_R_W_FMA]   = { BIFROST_OP_READ,     BIFROST_OP_WRITE,    true },
383         [BIFROST_R_WL_ADD]  = { BIFROST_OP_READ,     BIFROST_OP_WRITE_LO, false },
384         [BIFROST_R_WH_ADD]  = { BIFROST_OP_READ,     BIFROST_OP_WRITE_HI, false },
385         [BIFROST_R_W_ADD]   = { BIFROST_OP_READ,     BIFROST_OP_WRITE,    false },
386         [BIFROST_WL_WL_ADD] = { BIFROST_OP_WRITE_LO, BIFROST_OP_WRITE_LO, false },
387         [BIFROST_WL_WH_ADD] = { BIFROST_OP_WRITE_LO, BIFROST_OP_WRITE_HI, false },
388         [BIFROST_WL_W_ADD]  = { BIFROST_OP_WRITE_LO, BIFROST_OP_WRITE,    false },
389         [BIFROST_WH_WL_ADD] = { BIFROST_OP_WRITE_HI, BIFROST_OP_WRITE_LO, false },
390         [BIFROST_WH_WH_ADD] = { BIFROST_OP_WRITE_HI, BIFROST_OP_WRITE_HI, false },
391         [BIFROST_WH_W_ADD]  = { BIFROST_OP_WRITE_HI, BIFROST_OP_WRITE,    false },
392         [BIFROST_W_WL_ADD]  = { BIFROST_OP_WRITE,    BIFROST_OP_WRITE_LO, false },
393         [BIFROST_W_WH_ADD]  = { BIFROST_OP_WRITE,    BIFROST_OP_WRITE_HI, false },
394         [BIFROST_W_W_ADD]   = { BIFROST_OP_WRITE,    BIFROST_OP_WRITE,    false },
395         [BIFROST_IDLE_1]    = { BIFROST_OP_IDLE,     BIFROST_OP_IDLE,     true },
396         [BIFROST_I_W_FMA]   = { BIFROST_OP_IDLE,     BIFROST_OP_WRITE,    true },
397         [BIFROST_I_WL_FMA]  = { BIFROST_OP_IDLE,     BIFROST_OP_WRITE_LO, true },
398         [BIFROST_I_WH_FMA]  = { BIFROST_OP_IDLE,     BIFROST_OP_WRITE_HI, true },
399         [BIFROST_R_I]       = { BIFROST_OP_READ,     BIFROST_OP_IDLE,     false },
400         [BIFROST_I_W_ADD]   = { BIFROST_OP_IDLE,     BIFROST_OP_WRITE,    false },
401         [BIFROST_I_WL_ADD]  = { BIFROST_OP_IDLE,     BIFROST_OP_WRITE_LO, false },
402         [BIFROST_I_WH_ADD]  = { BIFROST_OP_IDLE,     BIFROST_OP_WRITE_HI, false },
403         [BIFROST_WL_WH_MIX] = { BIFROST_OP_WRITE_LO, BIFROST_OP_WRITE_HI, false },
404         [BIFROST_WH_WL_MIX] = { BIFROST_OP_WRITE_HI, BIFROST_OP_WRITE_LO, false },
405         [BIFROST_IDLE]      = { BIFROST_OP_IDLE,     BIFROST_OP_IDLE,     true },
406 };
407 
408 /* Texture operator descriptors in various states. Usually packed in the
409  * compiler and stored as a constant */
410 
411 enum bifrost_index {
412         /* Both texture/sampler index immediate */
413         BIFROST_INDEX_IMMEDIATE_SHARED = 0,
414 
415         /* Sampler index immediate, texture index from staging */
416         BIFROST_INDEX_IMMEDIATE_SAMPLER = 1,
417 
418         /* Texture index immediate, sampler index from staging */
419         BIFROST_INDEX_IMMEDIATE_TEXTURE = 2,
420 
421         /* Both indices from (separate) staging registers */
422         BIFROST_INDEX_REGISTER = 3,
423 };
424 
425 enum bifrost_tex_op {
426         /* Given explicit derivatives, compute a gradient descriptor */
427         BIFROST_TEX_OP_GRDESC_DER = 4,
428 
429         /* Given implicit derivatives (texture coordinates in a fragment
430          * shader), compute a gradient descriptor */
431         BIFROST_TEX_OP_GRDESC = 5,
432 
433         /* Fetch a texel. Takes a staging register with LOD level / face index
434          * packed 16:16 */
435         BIFROST_TEX_OP_FETCH = 6,
436 
437         /* Filtered texture */
438         BIFROST_TEX_OP_TEX = 7,
439 };
440 
441 enum bifrost_lod_mode {
442         /* Takes two staging registers forming a 64-bit gradient descriptor
443          * (computed by a previous GRDESC or GRDESC_DER operation) */
444         BIFROST_LOD_MODE_GRDESC = 3,
445 
446         /* Take a staging register with 8:8 fixed-point in bottom 16-bits
447          * specifying an explicit LOD */
448         BIFROST_LOD_MODE_EXPLICIT = 4,
449 
450         /* Takes a staging register with bottom 16-bits as 8:8 fixed-point LOD
451          * bias and top 16-bit as 8:8 fixed-point lower bound (generally left
452          * zero), added and clamped to a computed LOD */
453         BIFROST_LOD_MODE_BIAS = 5,
454 
455         /* Set LOD to zero */
456         BIFROST_LOD_MODE_ZERO = 6,
457 
458         /* Compute LOD */
459         BIFROST_LOD_MODE_COMPUTE = 7,
460 };
461 
462 enum bifrost_texture_format {
463         /* 16-bit floating point, with optional clamping */
464         BIFROST_TEXTURE_FORMAT_F16 = 0,
465         BIFROST_TEXTURE_FORMAT_F16_POS = 1,
466         BIFROST_TEXTURE_FORMAT_F16_PM1 = 2,
467         BIFROST_TEXTURE_FORMAT_F16_1 = 3,
468 
469         /* 32-bit floating point, with optional clamping */
470         BIFROST_TEXTURE_FORMAT_F32 = 4,
471         BIFROST_TEXTURE_FORMAT_F32_POS = 5,
472         BIFROST_TEXTURE_FORMAT_F32_PM1 = 6,
473         BIFROST_TEXTURE_FORMAT_F32_1 = 7,
474 };
475 
476 enum bifrost_texture_format_full {
477         /* Transclude bifrost_texture_format from above */
478 
479         /* Integers, unclamped */
480         BIFROST_TEXTURE_FORMAT_U16 = 12,
481         BIFROST_TEXTURE_FORMAT_S16 = 13,
482         BIFROST_TEXTURE_FORMAT_U32 = 14,
483         BIFROST_TEXTURE_FORMAT_S32 = 15,
484 };
485 
486 enum bifrost_texture_fetch {
487         /* Default texelFetch */
488         BIFROST_TEXTURE_FETCH_TEXEL = 1,
489 
490         /* Deprecated, fetches 4x U32 of a U8 x 4 texture. Do not use. */
491         BIFROST_TEXTURE_FETCH_GATHER4_RGBA = 3,
492 
493         /* Gathers */
494         BIFROST_TEXTURE_FETCH_GATHER4_R = 4,
495         BIFROST_TEXTURE_FETCH_GATHER4_G = 5,
496         BIFROST_TEXTURE_FETCH_GATHER4_B = 6,
497         BIFROST_TEXTURE_FETCH_GATHER4_A = 7
498 };
499 
500 struct bifrost_texture_operation {
501         /* If immediate_indices is set:
502          *     - immediate sampler index
503          *     - index used as texture index
504          * Otherwise:
505          *      - bifrost_single_index in lower 2 bits
506          *      - 0x3 in upper 2 bits (single-texturing)
507          */
508         unsigned sampler_index_or_mode : 4;
509         unsigned index : 7;
510         bool immediate_indices : 1;
511         enum bifrost_tex_op op : 3;
512 
513         /* If set for TEX/FETCH, loads texel offsets and multisample index from
514          * a staging register containing offset_x:offset_y:offset_z:ms_index
515          * packed 8:8:8:8. Offsets must be in [-31, +31]. If set for
516          * GRDESC(_DER), disable LOD bias. */
517         bool offset_or_bias_disable : 1;
518 
519         /* If set for TEX/FETCH, loads fp32 shadow comparison value from a
520          * staging register. Implies fetch_component = gather4_r. If set for
521          * GRDESC(_DER), disables LOD clamping. */
522         bool shadow_or_clamp_disable : 1;
523 
524         /* If set, loads an uint32 array index from a staging register. */
525         bool array : 1;
526 
527         /* Texture dimension, or 0 for a cubemap */
528         unsigned dimension : 2;
529 
530         /* Method to compute LOD value or for a FETCH, the
531          * bifrost_texture_fetch component specification */
532         enum bifrost_lod_mode lod_or_fetch : 3;
533 
534         /* Reserved */
535         unsigned zero : 1;
536 
537         /* Register format for the result */
538         enum bifrost_texture_format_full format : 4;
539 
540         /* Write mask for the result */
541         unsigned mask : 4;
542 } __attribute__((packed));
543 
544 #define BIFROST_MEGA_SAMPLE 128
545 #define BIFROST_ALL_SAMPLES 255
546 #define BIFROST_CURRENT_PIXEL 255
547 
548 struct bifrost_pixel_indices {
549         unsigned sample : 8;
550         unsigned rt : 8;
551         unsigned x : 8;
552         unsigned y : 8;
553 } __attribute__((packed));
554 
555 #endif
556