pan/mdg: eliminate references to ins->load_store.op
[mesa.git] / src / panfrost / midgard / midgard_emit.c
1 /*
2 * Copyright (C) 2018-2019 Alyssa Rosenzweig <alyssa@rosenzweig.io>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24 #include "compiler.h"
25 #include "midgard_ops.h"
26 #include "midgard_quirks.h"
27
28 static midgard_int_mod
29 mir_get_imod(bool shift, nir_alu_type T, bool half, bool scalar)
30 {
31 if (!half) {
32 assert(!shift);
33 /* Sign-extension, really... */
34 return scalar ? 0 : midgard_int_normal;
35 }
36
37 if (shift)
38 return midgard_int_shift;
39
40 if (nir_alu_type_get_base_type(T) == nir_type_int)
41 return midgard_int_sign_extend;
42 else
43 return midgard_int_zero_extend;
44 }
45
46 static unsigned
47 mir_pack_mod(midgard_instruction *ins, unsigned i, bool scalar)
48 {
49 bool integer = midgard_is_integer_op(ins->op);
50 unsigned base_size = max_bitsize_for_alu(ins);
51 unsigned sz = nir_alu_type_get_type_size(ins->src_types[i]);
52 bool half = (sz == (base_size >> 1));
53
54 return integer ?
55 mir_get_imod(ins->src_shift[i], ins->src_types[i], half, scalar) :
56 ((ins->src_abs[i] << 0) |
57 ((ins->src_neg[i] << 1)));
58 }
59
60 /* Midgard IR only knows vector ALU types, but we sometimes need to actually
61 * use scalar ALU instructions, for functional or performance reasons. To do
62 * this, we just demote vector ALU payloads to scalar. */
63
64 static int
65 component_from_mask(unsigned mask)
66 {
67 for (int c = 0; c < 8; ++c) {
68 if (mask & (1 << c))
69 return c;
70 }
71
72 assert(0);
73 return 0;
74 }
75
76 static unsigned
77 mir_pack_scalar_source(unsigned mod, bool is_full, unsigned component)
78 {
79 midgard_scalar_alu_src s = {
80 .mod = mod,
81 .full = is_full,
82 .component = component << (is_full ? 1 : 0)
83 };
84
85 unsigned o;
86 memcpy(&o, &s, sizeof(s));
87
88 return o & ((1 << 6) - 1);
89 }
90
91 static midgard_scalar_alu
92 vector_to_scalar_alu(midgard_vector_alu v, midgard_instruction *ins)
93 {
94 bool is_full = nir_alu_type_get_type_size(ins->dest_type) == 32;
95
96 bool half_0 = nir_alu_type_get_type_size(ins->src_types[0]) == 16;
97 bool half_1 = nir_alu_type_get_type_size(ins->src_types[1]) == 16;
98 unsigned comp = component_from_mask(ins->mask);
99
100 unsigned packed_src[2] = {
101 mir_pack_scalar_source(mir_pack_mod(ins, 0, true), !half_0, ins->swizzle[0][comp]),
102 mir_pack_scalar_source(mir_pack_mod(ins, 1, true), !half_1, ins->swizzle[1][comp])
103 };
104
105 /* The output component is from the mask */
106 midgard_scalar_alu s = {
107 .op = v.op,
108 .src1 = packed_src[0],
109 .src2 = packed_src[1],
110 .unknown = 0,
111 .outmod = v.outmod,
112 .output_full = is_full,
113 .output_component = comp
114 };
115
116 /* Full components are physically spaced out */
117 if (is_full) {
118 assert(s.output_component < 4);
119 s.output_component <<= 1;
120 }
121
122 /* Inline constant is passed along rather than trying to extract it
123 * from v */
124
125 if (ins->has_inline_constant) {
126 uint16_t imm = 0;
127 int lower_11 = ins->inline_constant & ((1 << 12) - 1);
128 imm |= (lower_11 >> 9) & 3;
129 imm |= (lower_11 >> 6) & 4;
130 imm |= (lower_11 >> 2) & 0x38;
131 imm |= (lower_11 & 63) << 6;
132
133 s.src2 = imm;
134 }
135
136 return s;
137 }
138
139 /* 64-bit swizzles are super easy since there are 2 components of 2 components
140 * in an 8-bit field ... lots of duplication to go around!
141 *
142 * Swizzles of 32-bit vectors accessed from 64-bit instructions are a little
143 * funny -- pack them *as if* they were native 64-bit, using rep_* flags to
144 * flag upper. For instance, xy would become 64-bit XY but that's just xyzw
145 * native. Likewise, zz would become 64-bit XX with rep* so it would be xyxy
146 * with rep. Pretty nifty, huh? */
147
148 static unsigned
149 mir_pack_swizzle_64(unsigned *swizzle, unsigned max_component)
150 {
151 unsigned packed = 0;
152
153 for (unsigned i = 0; i < 2; ++i) {
154 assert(swizzle[i] <= max_component);
155
156 unsigned a = (swizzle[i] & 1) ?
157 (COMPONENT_W << 2) | COMPONENT_Z :
158 (COMPONENT_Y << 2) | COMPONENT_X;
159
160 packed |= a << (i * 4);
161 }
162
163 return packed;
164 }
165
166 static void
167 mir_pack_mask_alu(midgard_instruction *ins)
168 {
169 unsigned effective = ins->mask;
170
171 /* If we have a destination override, we need to figure out whether to
172 * override to the lower or upper half, shifting the effective mask in
173 * the latter, so AAAA.... becomes AAAA */
174
175 unsigned inst_size = max_bitsize_for_alu(ins);
176 signed upper_shift = mir_upper_override(ins, inst_size);
177
178 if (upper_shift >= 0) {
179 effective >>= upper_shift;
180 ins->alu.dest_override = upper_shift ?
181 midgard_dest_override_upper :
182 midgard_dest_override_lower;
183 } else {
184 ins->alu.dest_override = midgard_dest_override_none;
185 }
186
187 if (inst_size == 32)
188 ins->alu.mask = expand_writemask(effective, 2);
189 else if (inst_size == 64)
190 ins->alu.mask = expand_writemask(effective, 1);
191 else
192 ins->alu.mask = effective;
193 }
194
195 static unsigned
196 mir_pack_swizzle(unsigned mask, unsigned *swizzle,
197 nir_alu_type T, midgard_reg_mode reg_mode,
198 bool op_channeled, bool *rep_low, bool *rep_high)
199 {
200 unsigned packed = 0;
201 unsigned sz = nir_alu_type_get_type_size(T);
202
203 if (reg_mode == midgard_reg_mode_64) {
204 assert(sz == 64 || sz == 32);
205 unsigned components = (sz == 32) ? 4 : 2;
206
207 packed = mir_pack_swizzle_64(swizzle, components);
208
209 if (sz == 32) {
210 bool lo = swizzle[0] >= COMPONENT_Z;
211 bool hi = swizzle[1] >= COMPONENT_Z;
212
213 if (mask & 0x1) {
214 /* We can't mix halves... */
215 if (mask & 2)
216 assert(lo == hi);
217
218 *rep_low = lo;
219 } else {
220 *rep_low = hi;
221 }
222 } else if (sz < 32) {
223 unreachable("Cannot encode 8/16 swizzle in 64-bit");
224 }
225 } else {
226 /* For 32-bit, swizzle packing is stupid-simple. For 16-bit,
227 * the strategy is to check whether the nibble we're on is
228 * upper or lower. We need all components to be on the same
229 * "side"; that much is enforced by the ISA and should have
230 * been lowered. TODO: 8-bit packing. TODO: vec8 */
231
232 unsigned first = mask ? ffs(mask) - 1 : 0;
233 bool upper = swizzle[first] > 3;
234
235 if (upper && mask)
236 assert(sz <= 16);
237
238 bool dest_up = !op_channeled && (first >= 4);
239
240 for (unsigned c = (dest_up ? 4 : 0); c < (dest_up ? 8 : 4); ++c) {
241 unsigned v = swizzle[c];
242
243 bool t_upper = v > 3;
244
245 /* Ensure we're doing something sane */
246
247 if (mask & (1 << c)) {
248 assert(t_upper == upper);
249 assert(v <= 7);
250 }
251
252 /* Use the non upper part */
253 v &= 0x3;
254
255 packed |= v << (2 * (c % 4));
256 }
257
258
259 /* Replicate for now.. should really pick a side for
260 * dot products */
261
262 if (reg_mode == midgard_reg_mode_16 && sz == 16) {
263 *rep_low = !upper;
264 *rep_high = upper;
265 } else if (reg_mode == midgard_reg_mode_16 && sz == 8) {
266 *rep_low = upper;
267 *rep_high = upper;
268 } else if (reg_mode == midgard_reg_mode_32) {
269 *rep_low = upper;
270 } else {
271 unreachable("Unhandled reg mode");
272 }
273 }
274
275 return packed;
276 }
277
278 static void
279 mir_pack_vector_srcs(midgard_instruction *ins)
280 {
281 bool channeled = GET_CHANNEL_COUNT(alu_opcode_props[ins->op].props);
282
283 unsigned base_size = max_bitsize_for_alu(ins);
284
285 for (unsigned i = 0; i < 2; ++i) {
286 if (ins->has_inline_constant && (i == 1))
287 continue;
288
289 if (ins->src[i] == ~0)
290 continue;
291
292 bool rep_lo = false, rep_hi = false;
293 unsigned sz = nir_alu_type_get_type_size(ins->src_types[i]);
294 bool half = (sz == (base_size >> 1));
295
296 assert((sz == base_size) || half);
297
298 unsigned swizzle = mir_pack_swizzle(ins->mask, ins->swizzle[i],
299 ins->src_types[i], reg_mode_for_bitsize(base_size),
300 channeled, &rep_lo, &rep_hi);
301
302 midgard_vector_alu_src pack = {
303 .mod = mir_pack_mod(ins, i, false),
304 .rep_low = rep_lo,
305 .rep_high = rep_hi,
306 .half = half,
307 .swizzle = swizzle
308 };
309
310 unsigned p = vector_alu_srco_unsigned(pack);
311
312 if (i == 0)
313 ins->alu.src1 = p;
314 else
315 ins->alu.src2 = p;
316 }
317 }
318
319 static void
320 mir_pack_swizzle_ldst(midgard_instruction *ins)
321 {
322 /* TODO: non-32-bit, non-vec4 */
323 for (unsigned c = 0; c < 4; ++c) {
324 unsigned v = ins->swizzle[0][c];
325
326 /* Check vec4 */
327 assert(v <= 3);
328
329 ins->load_store.swizzle |= v << (2 * c);
330 }
331
332 /* TODO: arg_1/2 */
333 }
334
335 static void
336 mir_pack_swizzle_tex(midgard_instruction *ins)
337 {
338 for (unsigned i = 0; i < 2; ++i) {
339 unsigned packed = 0;
340
341 for (unsigned c = 0; c < 4; ++c) {
342 unsigned v = ins->swizzle[i][c];
343
344 /* Check vec4 */
345 assert(v <= 3);
346
347 packed |= v << (2 * c);
348 }
349
350 if (i == 0)
351 ins->texture.swizzle = packed;
352 else
353 ins->texture.in_reg_swizzle = packed;
354 }
355
356 /* TODO: bias component */
357 }
358
359 /* Up to 3 { ALU, LDST } bundles can execute in parallel with a texture op.
360 * Given a texture op, lookahead to see how many such bundles we can flag for
361 * OoO execution */
362
363 static bool
364 mir_can_run_ooo(midgard_block *block, midgard_bundle *bundle,
365 unsigned dependency)
366 {
367 /* Don't read out of bounds */
368 if (bundle >= (midgard_bundle *) ((char *) block->bundles.data + block->bundles.size))
369 return false;
370
371 /* Texture ops can't execute with other texture ops */
372 if (!IS_ALU(bundle->tag) && bundle->tag != TAG_LOAD_STORE_4)
373 return false;
374
375 /* Ensure there is no read-after-write dependency */
376
377 for (unsigned i = 0; i < bundle->instruction_count; ++i) {
378 midgard_instruction *ins = bundle->instructions[i];
379
380 mir_foreach_src(ins, s) {
381 if (ins->src[s] == dependency)
382 return false;
383 }
384 }
385
386 /* Otherwise, we're okay */
387 return true;
388 }
389
390 static void
391 mir_pack_tex_ooo(midgard_block *block, midgard_bundle *bundle, midgard_instruction *ins)
392 {
393 unsigned count = 0;
394
395 for (count = 0; count < 3; ++count) {
396 if (!mir_can_run_ooo(block, bundle + count + 1, ins->dest))
397 break;
398 }
399
400 ins->texture.out_of_order = count;
401 }
402
403 /* Load store masks are 4-bits. Load/store ops pack for that. vec4 is the
404 * natural mask width; vec8 is constrained to be in pairs, vec2 is duplicated. TODO: 8-bit?
405 */
406
407 static void
408 mir_pack_ldst_mask(midgard_instruction *ins)
409 {
410 unsigned sz = nir_alu_type_get_type_size(ins->dest_type);
411 unsigned packed = ins->mask;
412
413 if (sz == 64) {
414 packed = ((ins->mask & 0x2) ? (0x8 | 0x4) : 0) |
415 ((ins->mask & 0x1) ? (0x2 | 0x1) : 0);
416 } else if (sz == 16) {
417 packed = 0;
418
419 for (unsigned i = 0; i < 4; ++i) {
420 /* Make sure we're duplicated */
421 bool u = (ins->mask & (1 << (2*i + 0))) != 0;
422 bool v = (ins->mask & (1 << (2*i + 1))) != 0;
423 assert(u == v);
424
425 packed |= (u << i);
426 }
427 } else {
428 assert(sz == 32);
429 }
430
431 ins->load_store.mask = packed;
432 }
433
434 static void
435 mir_lower_inverts(midgard_instruction *ins)
436 {
437 bool inv[3] = {
438 ins->src_invert[0],
439 ins->src_invert[1],
440 ins->src_invert[2]
441 };
442
443 switch (ins->op) {
444 case midgard_alu_op_iand:
445 /* a & ~b = iandnot(a, b) */
446 /* ~a & ~b = ~(a | b) = inor(a, b) */
447
448 if (inv[0] && inv[1])
449 ins->op = midgard_alu_op_inor;
450 else if (inv[1])
451 ins->op = midgard_alu_op_iandnot;
452
453 break;
454 case midgard_alu_op_ior:
455 /* a | ~b = iornot(a, b) */
456 /* ~a | ~b = ~(a & b) = inand(a, b) */
457
458 if (inv[0] && inv[1])
459 ins->op = midgard_alu_op_inand;
460 else if (inv[1])
461 ins->op = midgard_alu_op_iornot;
462
463 break;
464
465 case midgard_alu_op_ixor:
466 /* ~a ^ b = a ^ ~b = ~(a ^ b) = inxor(a, b) */
467 /* ~a ^ ~b = a ^ b */
468
469 if (inv[0] ^ inv[1])
470 ins->op = midgard_alu_op_inxor;
471
472 break;
473
474 default:
475 break;
476 }
477 }
478
479 /* Opcodes with ROUNDS are the base (rte/0) type so we can just add */
480
481 static void
482 mir_lower_roundmode(midgard_instruction *ins)
483 {
484 if (alu_opcode_props[ins->op].props & MIDGARD_ROUNDS) {
485 assert(ins->roundmode <= 0x3);
486 ins->op += ins->roundmode;
487 }
488 }
489
490 static midgard_load_store_word
491 load_store_from_instr(midgard_instruction *ins)
492 {
493 midgard_load_store_word ldst = ins->load_store;
494 ldst.op = ins->op;
495 return ldst;
496 }
497
498 static midgard_texture_word
499 texture_word_from_instr(midgard_instruction *ins)
500 {
501 midgard_texture_word tex = ins->texture;
502 tex.op = ins->op;
503 return tex;
504 }
505
506 static midgard_vector_alu
507 vector_alu_from_instr(midgard_instruction *ins)
508 {
509 midgard_vector_alu alu = ins->alu;
510 alu.op = ins->op;
511 alu.outmod = ins->outmod;
512 alu.reg_mode = reg_mode_for_bitsize(max_bitsize_for_alu(ins));
513 return alu;
514 }
515
516 static void
517 emit_alu_bundle(compiler_context *ctx,
518 midgard_bundle *bundle,
519 struct util_dynarray *emission,
520 unsigned lookahead)
521 {
522 /* Emit the control word */
523 util_dynarray_append(emission, uint32_t, bundle->control | lookahead);
524
525 /* Next up, emit register words */
526 for (unsigned i = 0; i < bundle->instruction_count; ++i) {
527 midgard_instruction *ins = bundle->instructions[i];
528
529 /* Check if this instruction has registers */
530 if (ins->compact_branch) continue;
531
532 /* Otherwise, just emit the registers */
533 uint16_t reg_word = 0;
534 memcpy(&reg_word, &ins->registers, sizeof(uint16_t));
535 util_dynarray_append(emission, uint16_t, reg_word);
536 }
537
538 /* Now, we emit the body itself */
539 for (unsigned i = 0; i < bundle->instruction_count; ++i) {
540 midgard_instruction *ins = bundle->instructions[i];
541
542 /* Where is this body */
543 unsigned size = 0;
544 void *source = NULL;
545
546 midgard_vector_alu source_alu;
547
548 /* In case we demote to a scalar */
549 midgard_scalar_alu scalarized;
550
551 if (!ins->compact_branch) {
552 mir_lower_inverts(ins);
553 mir_lower_roundmode(ins);
554 }
555
556 if (ins->unit & UNITS_ANY_VECTOR) {
557 mir_pack_mask_alu(ins);
558 mir_pack_vector_srcs(ins);
559 size = sizeof(midgard_vector_alu);
560 source_alu = vector_alu_from_instr(ins);
561 source = &source_alu;
562 } else if (ins->unit == ALU_ENAB_BR_COMPACT) {
563 size = sizeof(midgard_branch_cond);
564 source = &ins->br_compact;
565 } else if (ins->compact_branch) { /* misnomer */
566 size = sizeof(midgard_branch_extended);
567 source = &ins->branch_extended;
568 } else {
569 size = sizeof(midgard_scalar_alu);
570 source_alu = vector_alu_from_instr(ins);
571 scalarized = vector_to_scalar_alu(source_alu, ins);
572 source = &scalarized;
573 }
574
575 memcpy(util_dynarray_grow_bytes(emission, size, 1), source, size);
576 }
577
578 /* Emit padding (all zero) */
579 memset(util_dynarray_grow_bytes(emission, bundle->padding, 1), 0, bundle->padding);
580
581 /* Tack on constants */
582
583 if (bundle->has_embedded_constants)
584 util_dynarray_append(emission, midgard_constants, bundle->constants);
585 }
586
587 /* Shift applied to the immediate used as an offset. Probably this is papering
588 * over some other semantic distinction else well, but it unifies things in the
589 * compiler so I don't mind. */
590
591 static unsigned
592 mir_ldst_imm_shift(midgard_load_store_op op)
593 {
594 if (OP_IS_UBO_READ(op))
595 return 3;
596 else
597 return 1;
598 }
599
600 static enum mali_sampler_type
601 midgard_sampler_type(nir_alu_type t) {
602 switch (nir_alu_type_get_base_type(t))
603 {
604 case nir_type_float:
605 return MALI_SAMPLER_FLOAT;
606 case nir_type_int:
607 return MALI_SAMPLER_SIGNED;
608 case nir_type_uint:
609 return MALI_SAMPLER_UNSIGNED;
610 default:
611 unreachable("Unknown sampler type");
612 }
613 }
614
615 /* After everything is scheduled, emit whole bundles at a time */
616
617 void
618 emit_binary_bundle(compiler_context *ctx,
619 midgard_block *block,
620 midgard_bundle *bundle,
621 struct util_dynarray *emission,
622 int next_tag)
623 {
624 int lookahead = next_tag << 4;
625
626 switch (bundle->tag) {
627 case TAG_ALU_4:
628 case TAG_ALU_8:
629 case TAG_ALU_12:
630 case TAG_ALU_16:
631 case TAG_ALU_4 + 4:
632 case TAG_ALU_8 + 4:
633 case TAG_ALU_12 + 4:
634 case TAG_ALU_16 + 4:
635 emit_alu_bundle(ctx, bundle, emission, lookahead);
636 break;
637
638 case TAG_LOAD_STORE_4: {
639 /* One or two composing instructions */
640
641 uint64_t current64, next64 = LDST_NOP;
642
643 /* Copy masks */
644
645 for (unsigned i = 0; i < bundle->instruction_count; ++i) {
646 mir_pack_ldst_mask(bundle->instructions[i]);
647
648 mir_pack_swizzle_ldst(bundle->instructions[i]);
649
650 /* Apply a constant offset */
651 unsigned offset = bundle->instructions[i]->constants.u32[0];
652
653 if (offset) {
654 unsigned shift = mir_ldst_imm_shift(bundle->instructions[i]->op);
655 unsigned upper_shift = 10 - shift;
656
657 bundle->instructions[i]->load_store.varying_parameters |= (offset & ((1 << upper_shift) - 1)) << shift;
658 bundle->instructions[i]->load_store.address |= (offset >> upper_shift);
659 }
660 }
661
662 midgard_load_store_word ldst0 =
663 load_store_from_instr(bundle->instructions[0]);
664 memcpy(&current64, &ldst0, sizeof(current64));
665
666 if (bundle->instruction_count == 2) {
667 midgard_load_store_word ldst1 =
668 load_store_from_instr(bundle->instructions[1]);
669 memcpy(&next64, &ldst1, sizeof(next64));
670 }
671
672 midgard_load_store instruction = {
673 .type = bundle->tag,
674 .next_type = next_tag,
675 .word1 = current64,
676 .word2 = next64
677 };
678
679 util_dynarray_append(emission, midgard_load_store, instruction);
680
681 break;
682 }
683
684 case TAG_TEXTURE_4:
685 case TAG_TEXTURE_4_VTX:
686 case TAG_TEXTURE_4_BARRIER: {
687 /* Texture instructions are easy, since there is no pipelining
688 * nor VLIW to worry about. We may need to set .cont/.last
689 * flags. */
690
691 midgard_instruction *ins = bundle->instructions[0];
692
693 ins->texture.type = bundle->tag;
694 ins->texture.next_type = next_tag;
695
696 /* Nothing else to pack for barriers */
697 if (ins->op == TEXTURE_OP_BARRIER) {
698 ins->texture.cont = ins->texture.last = 1;
699 util_dynarray_append(emission, midgard_texture_word, ins->texture);
700 return;
701 }
702
703 signed override = mir_upper_override(ins, 32);
704
705 ins->texture.mask = override > 0 ?
706 ins->mask >> override :
707 ins->mask;
708
709 mir_pack_swizzle_tex(ins);
710
711 if (!(ctx->quirks & MIDGARD_NO_OOO))
712 mir_pack_tex_ooo(block, bundle, ins);
713
714 unsigned osz = nir_alu_type_get_type_size(ins->dest_type);
715 unsigned isz = nir_alu_type_get_type_size(ins->src_types[1]);
716
717 assert(osz == 32 || osz == 16);
718 assert(isz == 32 || isz == 16);
719
720 ins->texture.out_full = (osz == 32);
721 ins->texture.out_upper = override > 0;
722 ins->texture.in_reg_full = (isz == 32);
723 ins->texture.sampler_type = midgard_sampler_type(ins->dest_type);
724 ins->texture.outmod = ins->outmod;
725
726 if (mir_op_computes_derivatives(ctx->stage, ins->op)) {
727 ins->texture.cont = !ins->helper_terminate;
728 ins->texture.last = ins->helper_terminate || ins->helper_execute;
729 } else {
730 ins->texture.cont = ins->texture.last = 1;
731 }
732
733 midgard_texture_word texture = texture_word_from_instr(ins);
734 util_dynarray_append(emission, midgard_texture_word, texture);
735 break;
736 }
737
738 default:
739 unreachable("Unknown midgard instruction type\n");
740 }
741 }