Everything else is done - just allow it.
v2: update lower_precision_test.py
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> (v1)
Reviewed-by: Eric Anholt <eric@anholt.net> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9050>
lower_variables_visitor::visit(ir_variable *var)
{
if ((var->data.mode != ir_var_temporary &&
- var->data.mode != ir_var_auto) ||
+ var->data.mode != ir_var_auto &&
+ /* Lower uniforms but not UBOs. */
+ (var->data.mode != ir_var_uniform ||
+ var->is_in_buffer_block() ||
+ !(options->LowerPrecisionFloat16Uniforms &&
+ var->type->without_array()->base_type == GLSL_TYPE_FLOAT))) ||
!var->type->without_array()->is_32bit() ||
(var->data.precision != GLSL_PRECISION_MEDIUM &&
var->data.precision != GLSL_PRECISION_LOW) ||
options->LowerPrecisionInt16 = true;
options->LowerPrecisionDerivatives = true;
options->LowerPrecisionConstants = true;
+ options->LowerPrecisionFloat16Uniforms = true;
}
}
gl_FragColor = vec4(b * a, 0.0, 0.0);
}
""",
- r'\(expression +f16vec2 \*.*\bf16mat2\b'),
+ r'\(expression +f16vec2 \* \(var_ref b\) \(var_ref a\)'),
Test("f32 simple struct deref",
"""
precision mediump float;
color += x;
}
""",
- r'\(assign \(x\) \(var_ref x\) \(expression float16_t \+ \(var_ref x\) \(expression float16_t f2fmp \(var_ref incr'),
+ r'\(assign \(x\) \(var_ref x\) \(expression float16_t \+ \(var_ref x\) \(var_ref incr'),
Test("i32 loop counter",
"""
#version 310 es
GLboolean LowerPrecisionFloat16;
GLboolean LowerPrecisionInt16;
GLboolean LowerPrecisionDerivatives;
+ GLboolean LowerPrecisionFloat16Uniforms;
/**
* This enables lowering of 16b constants. Some drivers may not