Lines Matching refs:nir

45 #include "compiler/nir/nir.h"
46 #include "compiler/nir/nir_serialize.h"
56 #include "nir/nir_to_tgsi.h"
330 /* Note: Any setup of ->ir.nir that has had pipe->create_*_state called on
332 * callers should be NULLing out the nir field in any pipe_shader_state
335 * GLSL IR and ARB programs will have set gl_program->nir to the same
336 * shader as ir->ir.nir, so it will be freed by _mesa_delete_program().
354 st_finalize_nir_before_variants(struct nir_shader *nir)
356 NIR_PASS_V(nir, nir_split_var_copies);
357 NIR_PASS_V(nir, nir_lower_var_copies);
358 if (nir->options->lower_all_io_to_temps ||
359 nir->options->lower_all_io_to_elements ||
360 nir->info.stage == MESA_SHADER_VERTEX ||
361 nir->info.stage == MESA_SHADER_GEOMETRY) {
362 NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false);
363 } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
364 NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, true);
368 nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
370 st_nir_assign_vs_in_locations(nir);
374 st_prog_to_nir_postprocess(struct st_context *st, nir_shader *nir,
379 NIR_PASS_V(nir, nir_lower_regs_to_ssa);
380 nir_validate_shader(nir, "after st/ptn lower_regs_to_ssa");
385 NIR_PASS_V(nir, nir_lower_io_to_temporaries,
386 nir_shader_get_entrypoint(nir),
388 NIR_PASS_V(nir, nir_lower_global_vars_to_local);
390 NIR_PASS_V(nir, st_nir_lower_wpos_ytransform, prog, screen);
391 NIR_PASS_V(nir, nir_lower_system_values);
392 NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
395 NIR_PASS_V(nir, nir_opt_constant_folding);
396 gl_nir_opts(nir);
397 st_finalize_nir_before_variants(nir);
400 char *msg = st_finalize_nir(st, prog, NULL, nir, true, true);
404 nir_validate_shader(nir, "after st/glsl finalize_nir");
418 nir_shader *nir = prog_to_nir(st->ctx, prog, options);
420 st_prog_to_nir_postprocess(st, nir, prog);
422 return nir;
504 nir_shader *nir = state->ir.nir;
505 struct shader_info info = nir->info;
506 gl_shader_stage stage = nir->info.stage;
511 nir_print_shader(nir, stderr);
517 * is what radeonsi wants), but nir-to-tgsi requires lowered images.
520 NIR_PASS_V(nir, gl_nir_lower_images, false);
523 state->tokens = nir_to_tgsi(nir, screen);
526 fprintf(stderr, "TGSI for driver after nir-to-tgsi:\n");
555 cs.prog = state->ir.nir;
594 if (prog->nir)
595 ralloc_free(prog->nir);
603 prog->nir = st_translate_prog_to_nir(st, prog,
605 prog->info = prog->nir->info;
614 if (prog->nir) {
615 nir_shader *nir = prog->nir;
621 prog->nir = NULL;
623 return nir;
636 struct nir_shader *nir,
640 if (nir->info.outputs_written & VARYING_BIT_CLIP_DIST0)
641 NIR_PASS_V(nir, nir_lower_clip_disable, ucp_enables);
660 if (nir->info.stage == MESA_SHADER_VERTEX ||
661 nir->info.stage == MESA_SHADER_TESS_EVAL) {
662 NIR_PASS_V(nir, nir_lower_clip_vs, ucp_enables,
664 } else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
665 NIR_PASS_V(nir, nir_lower_clip_gs, ucp_enables,
669 NIR_PASS_V(nir, nir_lower_io_to_temporaries,
670 nir_shader_get_entrypoint(nir), true, false);
671 NIR_PASS_V(nir, nir_lower_global_vars_to_local);
694 state.ir.nir = get_nir_shader(st, prog);
695 const nir_shader_compiler_options *options = ((nir_shader *)state.ir.nir)->options;
698 NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
702 NIR_PASS_V(state.ir.nir, nir_lower_passthrough_edgeflags);
709 NIR_PASS_V(state.ir.nir, nir_lower_point_size_mov,
717 lower_ucp(st, state.ir.nir, key->lower_ucp, params);
727 NIR_PASS_V(state.ir.nir, nir_lower_tex, &tex_opts);
731 char *msg = st_finalize_nir(st, prog, prog->shader_program, state.ir.nir,
744 nir_shader_gather_info(state.ir.nir,
745 nir_shader_get_entrypoint(state.ir.nir));
854 nir_shader *nir =
857 if (fp->nir)
858 ralloc_free(fp->nir);
864 fp->nir = nir;
901 state.ir.nir = s;
903 state.ir.nir = get_nir_shader(st, fp);
910 NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
915 NIR_PASS_V(state.ir.nir, nir_lower_flatshade);
921 NIR_PASS_V(state.ir.nir, nir_lower_alpha_test, key->lower_alpha_func,
928 NIR_PASS_V(state.ir.nir, nir_lower_two_sided_color, face_sysval);
933 nir_shader *shader = state.ir.nir;
941 NIR_PASS_V(state.ir.nir, nir_lower_texcoord_replace,
952 NIR_PASS_V(state.ir.nir, nir_lower_tex, &tex_opts);
966 NIR_PASS_V(state.ir.nir, nir_lower_bitmap, &options);
1000 NIR_PASS_V(state.ir.nir, nir_lower_drawpixels, &options);
1012 st_nir_lower_samplers(st->screen, state.ir.nir,
1028 NIR_PASS_V(state.ir.nir, nir_lower_tex, &options);
1034 char *msg = st_finalize_nir(st, fp, fp->shader_program, state.ir.nir,
1041 NIR_PASS_V(state.ir.nir, st_nir_lower_tex_src_plane,
1051 nir_shader_gather_info(state.ir.nir,
1052 nir_shader_get_entrypoint(state.ir.nir));
1056 char *msg = screen->finalize_nir(screen, state.ir.nir);
1226 nir_shader *nir = prog->nir;
1227 if (!nir)
1229 assert(nir->info.stage == MESA_SHADER_VERTEX ||
1230 nir->info.stage == MESA_SHADER_TESS_EVAL ||
1231 nir->info.stage == MESA_SHADER_GEOMETRY);
1232 if (nir->info.outputs_written & VARYING_BIT_PSIZ)
1234 unsigned max_components = nir->info.stage == MESA_SHADER_GEOMETRY ?
1236 st->ctx->Const.Program[nir->info.stage].MaxOutputComponents;
1238 unsigned needed_components = nir->info.stage == MESA_SHADER_GEOMETRY ? nir->info.gs.vertices_out : 1;
1239 nir_foreach_shader_out_variable(var, nir) {
1243 if (nir->info.stage == MESA_SHADER_GEOMETRY) {
1244 if (num_components + needed_components > st->ctx->Const.Program[nir->info.stage].MaxOutputComponents)
1246 num_components *= nir->info.gs.vertices_out;
1311 nir_serialize(&blob, prog->nir, false);
1329 if (prog->nir) {
1330 nir_sweep(prog->nir);
1375 NIR_PASS_V(prog->nir, st_nir_add_point_size);