freedreno/ir3: make compile fails more visible
[mesa.git] / src / freedreno / ir3 / ir3_shader.c
1 /*
2 * Copyright (C) 2014 Rob Clark <robclark@freedesktop.org>
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 * Authors:
24 * Rob Clark <robclark@freedesktop.org>
25 */
26
27 #include "util/u_atomic.h"
28 #include "util/u_string.h"
29 #include "util/u_math.h"
30 #include "util/u_memory.h"
31 #include "util/format/u_format.h"
32
33 #include "drm/freedreno_drmif.h"
34
35 #include "ir3_shader.h"
36 #include "ir3_compiler.h"
37 #include "ir3_nir.h"
38
39 int
40 ir3_glsl_type_size(const struct glsl_type *type, bool bindless)
41 {
42 return glsl_count_attribute_slots(type, false);
43 }
44
45 /* for vertex shader, the inputs are loaded into registers before the shader
46 * is executed, so max_regs from the shader instructions might not properly
47 * reflect the # of registers actually used, especially in case passthrough
48 * varyings.
49 *
50 * Likewise, for fragment shader, we can have some regs which are passed
51 * input values but never touched by the resulting shader (ie. as result
52 * of dead code elimination or simply because we don't know how to turn
53 * the reg off.
54 */
55 static void
56 fixup_regfootprint(struct ir3_shader_variant *v)
57 {
58 unsigned i;
59
60 for (i = 0; i < v->inputs_count; i++) {
61 /* skip frag inputs fetch via bary.f since their reg's are
62 * not written by gpu before shader starts (and in fact the
63 * regid's might not even be valid)
64 */
65 if (v->inputs[i].bary)
66 continue;
67
68 /* ignore high regs that are global to all threads in a warp
69 * (they exist by default) (a5xx+)
70 */
71 if (v->inputs[i].regid >= regid(48,0))
72 continue;
73
74 if (v->inputs[i].compmask) {
75 unsigned n = util_last_bit(v->inputs[i].compmask) - 1;
76 int32_t regid = v->inputs[i].regid + n;
77 if (v->inputs[i].half) {
78 if (!v->mergedregs) {
79 v->info.max_half_reg = MAX2(v->info.max_half_reg, regid >> 2);
80 } else {
81 v->info.max_reg = MAX2(v->info.max_reg, regid >> 3);
82 }
83 } else {
84 v->info.max_reg = MAX2(v->info.max_reg, regid >> 2);
85 }
86 }
87 }
88
89 for (i = 0; i < v->outputs_count; i++) {
90 /* for ex, VS shaders with tess don't have normal varying outs: */
91 if (!VALIDREG(v->outputs[i].regid))
92 continue;
93 int32_t regid = v->outputs[i].regid + 3;
94 if (v->outputs[i].half) {
95 if (!v->mergedregs) {
96 v->info.max_half_reg = MAX2(v->info.max_half_reg, regid >> 2);
97 } else {
98 v->info.max_reg = MAX2(v->info.max_reg, regid >> 3);
99 }
100 } else {
101 v->info.max_reg = MAX2(v->info.max_reg, regid >> 2);
102 }
103 }
104
105 for (i = 0; i < v->num_sampler_prefetch; i++) {
106 unsigned n = util_last_bit(v->sampler_prefetch[i].wrmask) - 1;
107 int32_t regid = v->sampler_prefetch[i].dst + n;
108 if (v->sampler_prefetch[i].half_precision) {
109 if (!v->mergedregs) {
110 v->info.max_half_reg = MAX2(v->info.max_half_reg, regid >> 2);
111 } else {
112 v->info.max_reg = MAX2(v->info.max_reg, regid >> 3);
113 }
114 } else {
115 v->info.max_reg = MAX2(v->info.max_reg, regid >> 2);
116 }
117 }
118 }
119
120 /* wrapper for ir3_assemble() which does some info fixup based on
121 * shader state. Non-static since used by ir3_cmdline too.
122 */
123 void * ir3_shader_assemble(struct ir3_shader_variant *v)
124 {
125 unsigned gpu_id = v->shader->compiler->gpu_id;
126 void *bin;
127
128 bin = ir3_assemble(v);
129 if (!bin)
130 return NULL;
131
132 if (gpu_id >= 400) {
133 v->instrlen = v->info.sizedwords / (2 * 16);
134 } else {
135 v->instrlen = v->info.sizedwords / (2 * 4);
136 }
137
138 /* NOTE: if relative addressing is used, we set constlen in
139 * the compiler (to worst-case value) since we don't know in
140 * the assembler what the max addr reg value can be:
141 */
142 v->constlen = MAX2(v->constlen, v->info.max_const + 1);
143
144 /* On a4xx and newer, constlen must be a multiple of 16 dwords even though
145 * uploads are in units of 4 dwords. Round it up here to make calculations
146 * regarding the shared constlen simpler.
147 */
148 if (gpu_id >= 400)
149 v->constlen = align(v->constlen, 4);
150
151 fixup_regfootprint(v);
152
153 return bin;
154 }
155
156 static void
157 assemble_variant(struct ir3_shader_variant *v)
158 {
159 v->bin = ir3_shader_assemble(v);
160
161 if (shader_debug_enabled(v->shader->type)) {
162 fprintf(stdout, "Native code for unnamed %s shader %s:\n",
163 ir3_shader_stage(v), v->shader->nir->info.name);
164 if (v->shader->type == MESA_SHADER_FRAGMENT)
165 fprintf(stdout, "SIMD0\n");
166 ir3_shader_disasm(v, v->bin, stdout);
167 }
168
169 /* no need to keep the ir around beyond this point: */
170 ir3_destroy(v->ir);
171 v->ir = NULL;
172 }
173
174 static bool
175 compile_variant(struct ir3_shader_variant *v)
176 {
177 int ret = ir3_compile_shader_nir(v->shader->compiler, v);
178 if (ret) {
179 _debug_printf("compile failed! (%s:%s)", v->shader->nir->info.name,
180 v->shader->nir->info.label);
181 return false;
182 }
183
184 assemble_variant(v);
185 if (!v->bin) {
186 _debug_printf("assemble failed! (%s:%s)", v->shader->nir->info.name,
187 v->shader->nir->info.label);
188 return false;
189 }
190
191 return true;
192 }
193
194 /*
195 * For creating normal shader variants, 'nonbinning' is NULL. For
196 * creating binning pass shader, it is link to corresponding normal
197 * (non-binning) variant.
198 */
199 static struct ir3_shader_variant *
200 alloc_variant(struct ir3_shader *shader, const struct ir3_shader_key *key,
201 struct ir3_shader_variant *nonbinning)
202 {
203 void *mem_ctx = shader;
204 /* hang the binning variant off it's non-binning counterpart instead
205 * of the shader, to simplify the error cleanup paths
206 */
207 if (nonbinning)
208 mem_ctx = nonbinning;
209 struct ir3_shader_variant *v = rzalloc_size(mem_ctx, sizeof(*v));
210
211 if (!v)
212 return NULL;
213
214 v->id = ++shader->variant_count;
215 v->shader = shader;
216 v->binning_pass = !!nonbinning;
217 v->nonbinning = nonbinning;
218 v->key = *key;
219 v->type = shader->type;
220 v->mergedregs = shader->compiler->gpu_id >= 600;
221
222 if (!v->binning_pass)
223 v->const_state = rzalloc_size(v, sizeof(*v->const_state));
224
225 return v;
226 }
227
228 static bool
229 needs_binning_variant(struct ir3_shader_variant *v)
230 {
231 if ((v->type == MESA_SHADER_VERTEX) && ir3_has_binning_vs(&v->key))
232 return true;
233 return false;
234 }
235
236 static struct ir3_shader_variant *
237 create_variant(struct ir3_shader *shader, const struct ir3_shader_key *key)
238 {
239 struct ir3_shader_variant *v = alloc_variant(shader, key, NULL);
240
241 if (!v)
242 goto fail;
243
244 if (needs_binning_variant(v)) {
245 v->binning = alloc_variant(shader, key, v);
246 if (!v->binning)
247 goto fail;
248 }
249
250 if (ir3_disk_cache_retrieve(shader->compiler, v))
251 return v;
252
253 if (!shader->nir_finalized) {
254 ir3_nir_post_finalize(shader->compiler, shader->nir);
255
256 if (ir3_shader_debug & IR3_DBG_DISASM) {
257 printf("dump nir%d: type=%d", shader->id, shader->type);
258 nir_print_shader(shader->nir, stdout);
259 }
260
261 shader->nir_finalized = true;
262 }
263
264 if (!compile_variant(v))
265 goto fail;
266
267 if (needs_binning_variant(v) && !compile_variant(v->binning))
268 goto fail;
269
270 ir3_disk_cache_store(shader->compiler, v);
271
272 return v;
273
274 fail:
275 ralloc_free(v);
276 return NULL;
277 }
278
279 static inline struct ir3_shader_variant *
280 shader_variant(struct ir3_shader *shader, const struct ir3_shader_key *key)
281 {
282 struct ir3_shader_variant *v;
283
284 for (v = shader->variants; v; v = v->next)
285 if (ir3_shader_key_equal(key, &v->key))
286 return v;
287
288 return NULL;
289 }
290
291 struct ir3_shader_variant *
292 ir3_shader_get_variant(struct ir3_shader *shader, const struct ir3_shader_key *key,
293 bool binning_pass, bool *created)
294 {
295 mtx_lock(&shader->variants_lock);
296 struct ir3_shader_variant *v = shader_variant(shader, key);
297
298 if (!v) {
299 /* compile new variant if it doesn't exist already: */
300 v = create_variant(shader, key);
301 if (v) {
302 v->next = shader->variants;
303 shader->variants = v;
304 *created = true;
305 }
306 }
307
308 if (v && binning_pass) {
309 v = v->binning;
310 assert(v);
311 }
312
313 mtx_unlock(&shader->variants_lock);
314
315 return v;
316 }
317
318 void
319 ir3_shader_destroy(struct ir3_shader *shader)
320 {
321 ralloc_free(shader->nir);
322 mtx_destroy(&shader->variants_lock);
323 ralloc_free(shader);
324 }
325
326 /**
327 * Creates a bitmask of the used bits of the shader key by this particular
328 * shader. Used by the gallium driver to skip state-dependent recompiles when
329 * possible.
330 */
331 static void
332 ir3_setup_used_key(struct ir3_shader *shader)
333 {
334 nir_shader *nir = shader->nir;
335 struct shader_info *info = &nir->info;
336 struct ir3_shader_key *key = &shader->key_mask;
337
338 /* This key flag is just used to make for a cheaper ir3_shader_key_equal
339 * check in the common case.
340 */
341 key->has_per_samp = true;
342
343 key->safe_constlen = true;
344
345 key->ucp_enables = 0xff;
346
347 if (info->stage == MESA_SHADER_FRAGMENT) {
348 key->fsaturate_s = ~0;
349 key->fsaturate_t = ~0;
350 key->fsaturate_r = ~0;
351 key->fastc_srgb = ~0;
352 key->fsamples = ~0;
353
354 if (info->inputs_read & VARYING_BITS_COLOR) {
355 key->rasterflat = true;
356 key->color_two_side = true;
357 }
358
359 if (info->inputs_read & VARYING_BIT_LAYER) {
360 key->layer_zero = true;
361 }
362
363 if ((info->outputs_written & ~(FRAG_RESULT_DEPTH |
364 FRAG_RESULT_STENCIL |
365 FRAG_RESULT_SAMPLE_MASK)) != 0) {
366 key->fclamp_color = true;
367 }
368
369 /* Only used for deciding on behavior of
370 * nir_intrinsic_load_barycentric_sample
371 */
372 key->msaa = info->fs.uses_sample_qualifier;
373 } else {
374 key->tessellation = ~0;
375 key->has_gs = true;
376
377 if (info->outputs_written & VARYING_BITS_COLOR)
378 key->vclamp_color = true;
379
380 if (info->stage == MESA_SHADER_VERTEX) {
381 key->vsaturate_s = ~0;
382 key->vsaturate_t = ~0;
383 key->vsaturate_r = ~0;
384 key->vastc_srgb = ~0;
385 key->vsamples = ~0;
386 }
387 }
388 }
389
390
391 /* Given an array of constlen's, decrease some of them so that the sum stays
392 * within "combined_limit" while trying to fairly share the reduction. Returns
393 * a bitfield of which stages should be trimmed.
394 */
395 static uint32_t
396 trim_constlens(unsigned *constlens,
397 unsigned first_stage, unsigned last_stage,
398 unsigned combined_limit, unsigned safe_limit)
399 {
400 unsigned cur_total = 0;
401 for (unsigned i = first_stage; i <= last_stage; i++) {
402 cur_total += constlens[i];
403 }
404
405 unsigned max_stage = 0;
406 unsigned max_const = 0;
407 uint32_t trimmed = 0;
408
409 while (cur_total > combined_limit) {
410 for (unsigned i = first_stage; i <= last_stage; i++) {
411 if (constlens[i] >= max_const) {
412 max_stage = i;
413 max_const = constlens[i];
414 }
415 }
416
417 assert(max_const > safe_limit);
418 trimmed |= 1 << max_stage;
419 cur_total = cur_total - max_const + safe_limit;
420 constlens[max_stage] = safe_limit;
421 }
422
423 return trimmed;
424 }
425
426 /* Figures out which stages in the pipeline to use the "safe" constlen for, in
427 * order to satisfy all shared constlen limits.
428 */
429 uint32_t
430 ir3_trim_constlen(struct ir3_shader_variant **variants,
431 const struct ir3_compiler *compiler)
432 {
433 unsigned constlens[MESA_SHADER_STAGES] = {};
434
435 for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
436 if (variants[i])
437 constlens[i] = variants[i]->constlen;
438 }
439
440 uint32_t trimmed = 0;
441 STATIC_ASSERT(MESA_SHADER_STAGES <= 8 * sizeof(trimmed));
442
443 /* There are two shared limits to take into account, the geometry limit on
444 * a6xx and the total limit. The frag limit on a6xx only matters for a
445 * single stage, so it's always satisfied with the first variant.
446 */
447 if (compiler->gpu_id >= 600) {
448 trimmed |=
449 trim_constlens(constlens, MESA_SHADER_VERTEX, MESA_SHADER_GEOMETRY,
450 compiler->max_const_geom, compiler->max_const_safe);
451 }
452 trimmed |=
453 trim_constlens(constlens, MESA_SHADER_VERTEX, MESA_SHADER_FRAGMENT,
454 compiler->max_const_pipeline, compiler->max_const_safe);
455
456 return trimmed;
457 }
458
459 struct ir3_shader *
460 ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir,
461 unsigned reserved_user_consts, struct ir3_stream_output_info *stream_output)
462 {
463 struct ir3_shader *shader = rzalloc_size(NULL, sizeof(*shader));
464
465 mtx_init(&shader->variants_lock, mtx_plain);
466 shader->compiler = compiler;
467 shader->id = p_atomic_inc_return(&shader->compiler->shader_count);
468 shader->type = nir->info.stage;
469 if (stream_output)
470 memcpy(&shader->stream_output, stream_output, sizeof(shader->stream_output));
471 shader->num_reserved_user_consts = reserved_user_consts;
472 shader->nir = nir;
473
474 ir3_disk_cache_init_shader_key(compiler, shader);
475
476 ir3_setup_used_key(shader);
477
478 return shader;
479 }
480
481 static void dump_reg(FILE *out, const char *name, uint32_t r)
482 {
483 if (r != regid(63,0)) {
484 const char *reg_type = (r & HALF_REG_ID) ? "hr" : "r";
485 fprintf(out, "; %s: %s%d.%c\n", name, reg_type,
486 (r & ~HALF_REG_ID) >> 2, "xyzw"[r & 0x3]);
487 }
488 }
489
490 static void dump_output(FILE *out, struct ir3_shader_variant *so,
491 unsigned slot, const char *name)
492 {
493 uint32_t regid;
494 regid = ir3_find_output_regid(so, slot);
495 dump_reg(out, name, regid);
496 }
497
498 static const char *
499 input_name(struct ir3_shader_variant *so, int i)
500 {
501 if (so->inputs[i].sysval) {
502 return gl_system_value_name(so->inputs[i].slot);
503 } else if (so->type == MESA_SHADER_VERTEX) {
504 return gl_vert_attrib_name(so->inputs[i].slot);
505 } else {
506 return gl_varying_slot_name(so->inputs[i].slot);
507 }
508 }
509
510 static const char *
511 output_name(struct ir3_shader_variant *so, int i)
512 {
513 if (so->type == MESA_SHADER_FRAGMENT) {
514 return gl_frag_result_name(so->outputs[i].slot);
515 } else {
516 switch (so->outputs[i].slot) {
517 case VARYING_SLOT_GS_HEADER_IR3:
518 return "GS_HEADER";
519 case VARYING_SLOT_GS_VERTEX_FLAGS_IR3:
520 return "GS_VERTEX_FLAGS";
521 case VARYING_SLOT_TCS_HEADER_IR3:
522 return "TCS_HEADER";
523 default:
524 return gl_varying_slot_name(so->outputs[i].slot);
525 }
526 }
527 }
528
529 void
530 ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out)
531 {
532 struct ir3 *ir = so->ir;
533 struct ir3_register *reg;
534 const char *type = ir3_shader_stage(so);
535 uint8_t regid;
536 unsigned i;
537
538 foreach_input_n (instr, i, ir) {
539 reg = instr->regs[0];
540 regid = reg->num;
541 fprintf(out, "@in(%sr%d.%c)\tin%d",
542 (reg->flags & IR3_REG_HALF) ? "h" : "",
543 (regid >> 2), "xyzw"[regid & 0x3], i);
544
545 if (reg->wrmask > 0x1)
546 fprintf(out, " (wrmask=0x%x)", reg->wrmask);
547 fprintf(out, "\n");
548 }
549
550 /* print pre-dispatch texture fetches: */
551 for (i = 0; i < so->num_sampler_prefetch; i++) {
552 const struct ir3_sampler_prefetch *fetch = &so->sampler_prefetch[i];
553 fprintf(out, "@tex(%sr%d.%c)\tsrc=%u, samp=%u, tex=%u, wrmask=0x%x, cmd=%u\n",
554 fetch->half_precision ? "h" : "",
555 fetch->dst >> 2, "xyzw"[fetch->dst & 0x3],
556 fetch->src, fetch->samp_id, fetch->tex_id,
557 fetch->wrmask, fetch->cmd);
558 }
559
560 foreach_output_n (instr, i, ir) {
561 reg = instr->regs[0];
562 regid = reg->num;
563 fprintf(out, "@out(%sr%d.%c)\tout%d",
564 (reg->flags & IR3_REG_HALF) ? "h" : "",
565 (regid >> 2), "xyzw"[regid & 0x3], i);
566 if (reg->wrmask > 0x1)
567 fprintf(out, " (wrmask=0x%x)", reg->wrmask);
568 fprintf(out, "\n");
569 }
570
571 const struct ir3_const_state *const_state = ir3_const_state(so);
572 for (i = 0; i < const_state->immediates_count; i++) {
573 fprintf(out, "@const(c%d.x)\t", const_state->offsets.immediate + i);
574 fprintf(out, "0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
575 const_state->immediates[i].val[0],
576 const_state->immediates[i].val[1],
577 const_state->immediates[i].val[2],
578 const_state->immediates[i].val[3]);
579 }
580
581 disasm_a3xx(bin, so->info.sizedwords, 0, out, ir->compiler->gpu_id);
582
583 fprintf(out, "; %s: outputs:", type);
584 for (i = 0; i < so->outputs_count; i++) {
585 uint8_t regid = so->outputs[i].regid;
586 const char *reg_type = so->outputs[i].half ? "hr" : "r";
587 fprintf(out, " %s%d.%c (%s)",
588 reg_type, (regid >> 2), "xyzw"[regid & 0x3],
589 output_name(so, i));
590 }
591 fprintf(out, "\n");
592
593 fprintf(out, "; %s: inputs:", type);
594 for (i = 0; i < so->inputs_count; i++) {
595 uint8_t regid = so->inputs[i].regid;
596 fprintf(out, " r%d.%c (%s slot=%d cm=%x,il=%u,b=%u)",
597 (regid >> 2), "xyzw"[regid & 0x3],
598 input_name(so, i),
599 so->inputs[i].slot,
600 so->inputs[i].compmask,
601 so->inputs[i].inloc,
602 so->inputs[i].bary);
603 }
604 fprintf(out, "\n");
605
606 /* print generic shader info: */
607 fprintf(out, "; %s prog %d/%d: %u instr, %u nops, %u non-nops, %u mov, %u cov, %u dwords\n",
608 type, so->shader->id, so->id,
609 so->info.instrs_count,
610 so->info.nops_count,
611 so->info.instrs_count - so->info.nops_count,
612 so->info.mov_count, so->info.cov_count,
613 so->info.sizedwords);
614
615 fprintf(out, "; %s prog %d/%d: %u last-baryf, %d half, %d full, %u constlen\n",
616 type, so->shader->id, so->id,
617 so->info.last_baryf,
618 so->info.max_half_reg + 1,
619 so->info.max_reg + 1,
620 so->constlen);
621
622 fprintf(out, "; %s prog %d/%d: %u sstall, %u (ss), %u (sy), %d max_sun, %d loops\n",
623 type, so->shader->id, so->id,
624 so->info.sstall,
625 so->info.ss,
626 so->info.sy,
627 so->max_sun,
628 so->loops);
629
630 /* print shader type specific info: */
631 switch (so->type) {
632 case MESA_SHADER_VERTEX:
633 dump_output(out, so, VARYING_SLOT_POS, "pos");
634 dump_output(out, so, VARYING_SLOT_PSIZ, "psize");
635 break;
636 case MESA_SHADER_FRAGMENT:
637 dump_reg(out, "pos (ij_pixel)",
638 ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL));
639 dump_reg(out, "pos (ij_centroid)",
640 ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID));
641 dump_reg(out, "pos (ij_size)",
642 ir3_find_sysval_regid(so, SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE));
643 dump_output(out, so, FRAG_RESULT_DEPTH, "posz");
644 if (so->color0_mrt) {
645 dump_output(out, so, FRAG_RESULT_COLOR, "color");
646 } else {
647 dump_output(out, so, FRAG_RESULT_DATA0, "data0");
648 dump_output(out, so, FRAG_RESULT_DATA1, "data1");
649 dump_output(out, so, FRAG_RESULT_DATA2, "data2");
650 dump_output(out, so, FRAG_RESULT_DATA3, "data3");
651 dump_output(out, so, FRAG_RESULT_DATA4, "data4");
652 dump_output(out, so, FRAG_RESULT_DATA5, "data5");
653 dump_output(out, so, FRAG_RESULT_DATA6, "data6");
654 dump_output(out, so, FRAG_RESULT_DATA7, "data7");
655 }
656 dump_reg(out, "fragcoord",
657 ir3_find_sysval_regid(so, SYSTEM_VALUE_FRAG_COORD));
658 dump_reg(out, "fragface",
659 ir3_find_sysval_regid(so, SYSTEM_VALUE_FRONT_FACE));
660 break;
661 default:
662 /* TODO */
663 break;
664 }
665
666 fprintf(out, "\n");
667 }
668
669 uint64_t
670 ir3_shader_outputs(const struct ir3_shader *so)
671 {
672 return so->nir->info.outputs_written;
673 }