* modes.
*/
nir_lower_io_lower_64bit_to_32 = (1 << 0),
+ /* If set, this causes the subset of 64-bit IO operations involving floats to be lowered on-the-fly
+ * to 32-bit operations. This is only valid for nir_var_shader_in/out
+ * modes.
+ */
+ nir_lower_io_lower_64bit_float_to_32 = (1 << 1),
} nir_lower_io_options;
bool nir_lower_io(nir_shader *shader,
nir_variable_mode modes,
nir_ssa_def *array_index, nir_variable *var, nir_ssa_def *offset,
unsigned component, const struct glsl_type *type)
{
+ const bool lower_double = !glsl_type_is_integer(type) && state->options & nir_lower_io_lower_64bit_float_to_32;
if (intrin->dest.ssa.bit_size == 64 &&
- (state->options & nir_lower_io_lower_64bit_to_32)) {
+ (lower_double || (state->options & nir_lower_io_lower_64bit_to_32))) {
nir_builder *b = &state->builder;
const unsigned slot_size = state->type_size(glsl_dvec_type(2), false);
nir_ssa_def *array_index, nir_variable *var, nir_ssa_def *offset,
unsigned component, const struct glsl_type *type)
{
+ const bool lower_double = !glsl_type_is_integer(type) && state->options & nir_lower_io_lower_64bit_float_to_32;
if (intrin->src[1].ssa->bit_size == 64 &&
- (state->options & nir_lower_io_lower_64bit_to_32)) {
+ (lower_double || (state->options & nir_lower_io_lower_64bit_to_32))) {
nir_builder *b = &state->builder;
const unsigned slot_size = state->type_size(glsl_dvec_type(2), false);