glsl: add additional lower mediump test

There were tests for inputs and inout, but no test for out which turned
out to not be behaving correctly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26755>
This commit is contained in:
Timothy Arceri 2023-12-19 15:40:06 +11:00 committed by Marge Bot
parent d42f9d94af
commit bb1873faad

View file

@ -474,6 +474,36 @@ TEST_F(gl_nir_lower_mediump_test, func_args_inout_mediump)
EXPECT_EQ(op_dest_bits(nir_op_fmul), 16);
}
TEST_F(gl_nir_lower_mediump_test, func_args_in_out_mediump)
{
ASSERT_NO_FATAL_FAILURE(compile(
R"(#version 310 es
precision highp float; /* Make sure that default highp temps in function handling don't break our mediump inout. */
uniform highp float a, b;
out float result;
void func(mediump float x, mediump float y, out mediump float w)
{
w = x * y; /* should be mediump due to x and y, but propagating qualifiers from a,b by inlining could trick it. */
}
void main()
{
/* The spec says "function input and output is done through copies,
* and therefore qualifiers do not have to match." So we use a
* highp here for our mediump out.
*/
highp float x;
func(a, b, x);
result = x;
}
)"));
EXPECT_PRED_FORMAT2(glsl_ir_contains, fs_ir, "expression float16_t * ");
EXPECT_EQ(op_dest_bits(nir_op_fmul), 16);
}
TEST_F(gl_nir_lower_mediump_test, func_args_inout_highp)
{
ASSERT_NO_FATAL_FAILURE(compile(