gallium/ntt: Add default compiler options for non-native-NIR drivers.

For using NIR internally in mesa/st, we need some compiler options.  This
is the options wrote for softpipe, which should be enough for whatever NTT
we do.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6477>
This commit is contained in:
Eric Anholt 2020-08-26 12:14:42 -07:00 committed by Marge Bot
parent f5841c343b
commit da4c4c0e67
2 changed files with 31 additions and 0 deletions

View File

@ -2645,3 +2645,29 @@ nir_to_tgsi(struct nir_shader *s,
return tgsi_tokens;
}
static const nir_shader_compiler_options nir_to_tgsi_compiler_options = {
.fuse_ffma32 = true,
.fuse_ffma64 = true,
.lower_extract_byte = true,
.lower_extract_word = true,
.lower_fdph = true,
.lower_flrp64 = true,
.lower_fmod = true,
.lower_rotate = true,
.lower_sub = true,
.lower_vector_cmp = true,
.use_interpolated_input_intrinsics = true,
};
/* Returns a default compiler options for drivers with only nir-to-tgsi-based
* NIR support.
*/
const void *
nir_to_tgsi_get_compiler_options(struct pipe_screen *pscreen,
enum pipe_shader_ir ir,
unsigned shader)
{
assert(ir == PIPE_SHADER_IR_NIR);
return &nir_to_tgsi_compiler_options;
}

View File

@ -30,4 +30,9 @@ struct pipe_screen;
const void *nir_to_tgsi(struct nir_shader *s,
struct pipe_screen *screen);
const void *
nir_to_tgsi_get_compiler_options(struct pipe_screen *pscreen,
enum pipe_shader_ir ir,
unsigned shader);
#endif /* NIR_TO_TGSI_H */