pan/bi: Add bi_emit_lod_cube helper

There's a different LOD format used for TXF that will be able to
accomodate cube maps as well.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
This commit is contained in:
Alyssa Rosenzweig
2020-10-08 19:31:41 -04:00
parent 125d18d915
commit 7f5428410f

View File

@@ -1101,6 +1101,28 @@ bi_emit_lod_88(bi_context *ctx, unsigned lod, bool fp16)
return mkvec.dest;
}
/* FETCH takes a 32-bit staging register containing the LOD as an integer in
* the bottom 16-bits and (if present) the cube face index in the top 16-bits.
* TODO: Cube face.
*/
static unsigned
bi_emit_lod_cube(bi_context *ctx, unsigned lod)
{
/* MKVEC.v2i16 out, lod.h0, #0 */
bi_instruction mkvec = {
.type = BI_SELECT,
.dest = bi_make_temp(ctx),
.dest_type = nir_type_int16,
.src = { lod, BIR_INDEX_ZERO },
.src_types = { nir_type_int16, nir_type_int16 },
};
bi_emit(ctx, mkvec);
return mkvec.dest;
}
/* Map to the main texture op used. Some of these (txd in particular) will
* lower to multiple texture ops with different opcodes (GRDESC_DER + TEX in
* sequence). We assume that lowering is handled elsewhere.