From eee2a4346154570d6130a05e14afde59bad17a1f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 13 Nov 2020 17:04:43 -0500 Subject: [PATCH] pan/bi: Implement sampler1D Enough to get shaders/humus-celshading/1.shader_test compiling, no idea if it actually works but it looks reasonable. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 2e25bec482b..ef04cc03d7b 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -1965,15 +1965,22 @@ emit_texc(bi_context *ctx, nir_tex_instr *instr) texc_pack_cube_coord(ctx, index, &tex.src[1], &tex.src[2]); } else { + unsigned components = nir_src_num_components(instr->src[i].src); + tex.src[1] = index; tex.src[2] = index; tex.swizzle[1][0] = 0; - tex.swizzle[2][0] = 1; - unsigned components = nir_src_num_components(instr->src[i].src); - assert(components == 2 || components == 3); + if (components >= 2) { + tex.swizzle[2][0] = 1; + } else { + /* Dummy for reg alloc to be happy */ + tex.swizzle[2][0] = 0; + } - if (components == 2) { + assert(components >= 1 && components <= 3); + + if (components < 3) { /* nothing to do */ } else if (desc.array) { /* 2D array */