+ /* TODO: Verify if its feasible to split up the NIR linking work into a
+ * per-stage part (that fill out information we need for the passes) and a
+ * actual linking part, so that we could fold back brw_nir_lower_resources
+ * back into brw_create_nir.
+ */
+
+ /* SPIR-V programs use a NIR linker */
+ if (shProg->data->spirv) {
+ static const gl_nir_linker_options opts = {
+ .fill_parameters = false,
+ };
+ if (!gl_nir_link_spirv(ctx, shProg, &opts))
+ return GL_FALSE;
+ }
+
+ for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
+ struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
+ if (!shader)
+ continue;
+
+ struct gl_program *prog = shader->Program;
+
+ brw_nir_lower_resources(prog->nir, shProg, prog, &brw->screen->devinfo);
+
+ NIR_PASS_V(prog->nir, brw_nir_lower_gl_images, prog);
+ }
+