mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
nir/lower_subgroups: add extra filter data to options
It might be convenient for filter implementations to have access to extra information. This will be used, for example, by ir3 to access compiler features. Signed-off-by: Job Noorman <jnoorman@igalia.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31731>
This commit is contained in:
parent
c789a0a3d3
commit
493f7b8084
2 changed files with 11 additions and 3 deletions
|
|
@ -6144,10 +6144,13 @@ bool nir_lower_atomics(nir_shader *shader, nir_instr_filter_cb filter);
|
|||
typedef struct nir_lower_subgroups_options {
|
||||
/* In addition to the boolean lowering options below, this optional callback
|
||||
* will filter instructions for lowering if non-NULL. The data passed will be
|
||||
* this options struct itself.
|
||||
* filter_data.
|
||||
*/
|
||||
nir_instr_filter_cb filter;
|
||||
|
||||
/* Extra data passed to the filter. */
|
||||
const void *filter_data;
|
||||
|
||||
/* In case the exact subgroup size is not known, subgroup_size should be
|
||||
* set to 0. In that case, the maximum subgroup size will be calculated by
|
||||
* ballot_components * ballot_bit_size.
|
||||
|
|
|
|||
|
|
@ -893,6 +893,12 @@ lower_scan_reduce(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
static bool
|
||||
lower_subgroups_filter(const nir_instr *instr, const void *_options)
|
||||
{
|
||||
const nir_lower_subgroups_options *options = _options;
|
||||
|
||||
if (options->filter) {
|
||||
return options->filter(instr, options->filter_data);
|
||||
}
|
||||
|
||||
return instr->type == nir_instr_type_intrinsic;
|
||||
}
|
||||
|
||||
|
|
@ -1343,8 +1349,7 @@ bool
|
|||
nir_lower_subgroups(nir_shader *shader,
|
||||
const nir_lower_subgroups_options *options)
|
||||
{
|
||||
void *filter = options->filter ? options->filter : lower_subgroups_filter;
|
||||
return nir_shader_lower_instructions(shader, filter,
|
||||
return nir_shader_lower_instructions(shader, lower_subgroups_filter,
|
||||
lower_subgroups_instr,
|
||||
(void *)options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue