nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
shader = brw_nir_apply_sampler_key(shader, compiler->devinfo, &key->tex,
true);
- shader = brw_nir_lower_io(shader, compiler->devinfo, true, false, NULL);
+ brw_nir_lower_fs_inputs(shader);
+ brw_nir_lower_fs_outputs(shader);
shader = brw_postprocess_nir(shader, compiler->devinfo, true);
/* key->alpha_test_func means simulating alpha testing via discards,
return true;
}
-static void
+void
brw_nir_lower_vs_inputs(nir_shader *nir,
const struct brw_device_info *devinfo,
bool is_scalar,
}
}
-static void
+void
brw_nir_lower_vue_inputs(nir_shader *nir,
const struct brw_device_info *devinfo,
bool is_scalar)
}
}
-static void
+void
brw_nir_lower_tes_inputs(nir_shader *nir)
{
struct remap_patch_urb_offsets_state state;
}
}
-static void
+void
brw_nir_lower_fs_inputs(nir_shader *nir)
{
nir_assign_var_locations(&nir->inputs, &nir->num_inputs, type_size_scalar);
nir_lower_io(nir, nir_var_shader_in, type_size_scalar);
}
-static void
-brw_nir_lower_inputs(nir_shader *nir,
- const struct brw_device_info *devinfo,
- bool is_scalar,
- bool use_legacy_snorm_formula,
- const uint8_t *vs_attrib_wa_flags)
-{
- switch (nir->stage) {
- case MESA_SHADER_VERTEX:
- brw_nir_lower_vs_inputs(nir, devinfo, is_scalar, use_legacy_snorm_formula,
- vs_attrib_wa_flags);
- break;
- case MESA_SHADER_TESS_CTRL:
- case MESA_SHADER_GEOMETRY:
- brw_nir_lower_vue_inputs(nir, devinfo, is_scalar);
- break;
- case MESA_SHADER_TESS_EVAL:
- brw_nir_lower_tes_inputs(nir);
- break;
- case MESA_SHADER_FRAGMENT:
- assert(is_scalar);
- brw_nir_lower_fs_inputs(nir);
- break;
- case MESA_SHADER_COMPUTE:
- /* Compute shaders have no inputs. */
- assert(exec_list_is_empty(&nir->inputs));
- break;
- default:
- unreachable("unsupported shader stage");
- }
-}
-
-static void
+void
brw_nir_lower_vue_outputs(nir_shader *nir,
bool is_scalar)
{
}
}
-static void
+void
brw_nir_lower_tcs_outputs(nir_shader *nir)
{
struct remap_patch_urb_offsets_state state;
}
}
-static void
+void
brw_nir_lower_fs_outputs(nir_shader *nir)
{
nir_assign_var_locations(&nir->outputs, &nir->num_outputs,
nir_lower_io(nir, nir_var_shader_out, type_size_scalar);
}
-static void
-brw_nir_lower_outputs(nir_shader *nir, bool is_scalar)
-{
- switch (nir->stage) {
- case MESA_SHADER_VERTEX:
- case MESA_SHADER_TESS_EVAL:
- case MESA_SHADER_GEOMETRY:
- brw_nir_lower_vue_outputs(nir, is_scalar);
- break;
- case MESA_SHADER_TESS_CTRL:
- brw_nir_lower_tcs_outputs(nir);
- break;
- case MESA_SHADER_FRAGMENT:
- brw_nir_lower_fs_outputs(nir);
- break;
- case MESA_SHADER_COMPUTE:
- /* Compute shaders have no outputs. */
- assert(exec_list_is_empty(&nir->outputs));
- break;
- default:
- unreachable("unsupported shader stage");
- }
-}
-
static int
type_size_scalar_bytes(const struct glsl_type *type)
{
return nir;
}
-/** Lower input and output loads and stores for i965. */
-nir_shader *
-brw_nir_lower_io(nir_shader *nir,
- const struct brw_device_info *devinfo,
- bool is_scalar,
- bool use_legacy_snorm_formula,
- const uint8_t *vs_attrib_wa_flags)
-{
- bool progress; /* Written by OPT and OPT_V */
- (void)progress;
-
- OPT_V(brw_nir_lower_inputs, devinfo, is_scalar,
- use_legacy_snorm_formula, vs_attrib_wa_flags);
- OPT_V(brw_nir_lower_outputs, is_scalar);
-
- return nir;
-}
-
/* Prepare the given shader for codegen
*
* This function is intended to be called right before going into the actual
bool is_scalar);
nir_shader *brw_preprocess_nir(nir_shader *nir, bool is_scalar);
-nir_shader *brw_nir_lower_io(nir_shader *nir,
- const struct brw_device_info *devinfo,
- bool is_scalar,
- bool use_legacy_snorm_formula,
- const uint8_t *vs_attrib_wa_flags);
+
+void brw_nir_lower_vs_inputs(nir_shader *nir,
+ const struct brw_device_info *devinfo,
+ bool is_scalar,
+ bool use_legacy_snorm_formula,
+ const uint8_t *vs_attrib_wa_flags);
+void brw_nir_lower_vue_inputs(nir_shader *nir,
+ const struct brw_device_info *devinfo,
+ bool is_scalar);
+void brw_nir_lower_tes_inputs(nir_shader *nir);
+void brw_nir_lower_fs_inputs(nir_shader *nir);
+void brw_nir_lower_vue_outputs(nir_shader *nir, bool is_scalar);
+void brw_nir_lower_tcs_outputs(nir_shader *nir);
+void brw_nir_lower_fs_outputs(nir_shader *nir);
+
nir_shader *brw_postprocess_nir(nir_shader *nir,
const struct brw_device_info *devinfo,
bool is_scalar);
nir = brw_nir_apply_sampler_key(nir, devinfo, &key->tex, is_scalar);
nir->info.inputs_read = key->inputs_read;
nir->info.patch_inputs_read = key->patch_inputs_read;
- nir = brw_nir_lower_io(nir, compiler->devinfo, is_scalar, false, NULL);
+ brw_nir_lower_tes_inputs(nir);
+ brw_nir_lower_vue_outputs(nir, is_scalar);
nir = brw_postprocess_nir(nir, compiler->devinfo, is_scalar);
brw_compute_vue_map(devinfo, &prog_data->base.vue_map,
nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
shader = brw_nir_apply_sampler_key(shader, compiler->devinfo, &key->tex,
is_scalar);
- shader = brw_nir_lower_io(shader, compiler->devinfo, is_scalar,
- use_legacy_snorm_formula,
- key->gl_attrib_wa_flags);
+ brw_nir_lower_vs_inputs(shader, compiler->devinfo, is_scalar,
+ use_legacy_snorm_formula, key->gl_attrib_wa_flags);
+ brw_nir_lower_vue_outputs(shader, is_scalar);
shader = brw_postprocess_nir(shader, compiler->devinfo, is_scalar);
const unsigned *assembly = NULL;
nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
shader = brw_nir_apply_sampler_key(shader, compiler->devinfo, &key->tex,
is_scalar);
- shader = brw_nir_lower_io(shader, compiler->devinfo, is_scalar, false, NULL);
+ brw_nir_lower_vue_inputs(shader, compiler->devinfo, is_scalar);
+ brw_nir_lower_vue_outputs(shader, is_scalar);
shader = brw_postprocess_nir(shader, compiler->devinfo, is_scalar);
prog_data->include_primitive_id =
nir = brw_nir_apply_sampler_key(nir, devinfo, &key->tex, is_scalar);
nir->info.outputs_written = key->outputs_written;
nir->info.patch_outputs_written = key->patch_outputs_written;
- nir = brw_nir_lower_io(nir, compiler->devinfo, is_scalar, false, NULL);
+ brw_nir_lower_vue_inputs(nir, compiler->devinfo, is_scalar);
+ brw_nir_lower_tcs_outputs(nir);
nir = brw_postprocess_nir(nir, compiler->devinfo, is_scalar);
prog_data->instances = DIV_ROUND_UP(nir->info.tcs.vertices_out, 2);