From e898e2466b545eee3ad6607a76fe6edc43b80dd7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 27 May 2022 14:13:40 -0400 Subject: [PATCH] pan/bi: Add VAR_TEX fusing unit test As fusing VAR_TEX is an optimization, it's helpful to have unit tests since functional tests won't check that the optimization triggers when expected. Originally written when I was touching the VAR_TEX code. Those changes have since been dropped by the unit test remains useful. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/test/test-optimizer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/panfrost/bifrost/test/test-optimizer.cpp b/src/panfrost/bifrost/test/test-optimizer.cpp index 03d3f8e..e4e16a3 100644 --- a/src/panfrost/bifrost/test/test-optimizer.cpp +++ b/src/panfrost/bifrost/test/test-optimizer.cpp @@ -421,3 +421,20 @@ TEST_F(Optimizer, DoNotFuseMixedSizeResultType) bi_fcmp_f32(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1), BI_MUX_INT_ZERO)); } + +TEST_F(Optimizer, VarTexCoord32) +{ + CASE({ + bi_index ld = bi_ld_var_imm(b, bi_null(), BI_REGISTER_FORMAT_F32, BI_SAMPLE_CENTER, BI_UPDATE_STORE, BI_VECSIZE_V2, 0); + + bi_index x = bi_temp(b->shader); + bi_index y = bi_temp(b->shader); + bi_instr *split = bi_split_i32_to(b, x, ld); + split->nr_dests = 2; + split->dest[1] = y; + + bi_texs_2d_f32_to(b, reg, x, y, false, 0, 0); + }, { + bi_var_tex_f32_to(b, reg, false, BI_SAMPLE_CENTER, BI_UPDATE_STORE, 0, 0); + }); +} -- 2.7.4