pan/bi: Implement txb
Also uses the 8.8 signed fixed-point format.
dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2d_bias
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>
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 4382a57..1cb293e 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -1129,6 +1129,7 @@
switch (instr->op) {
case nir_texop_tex:
case nir_texop_txl:
+ case nir_texop_txb:
break;
default:
unreachable("Unsupported texture op");
@@ -1177,11 +1178,13 @@
tex.swizzle[1][0] = 0;
tex.swizzle[2][0] = 1;
break;
+
case nir_tex_src_lod:
if (nir_src_is_const(instr->src[i].src) && nir_src_as_uint(instr->src[i].src) == 0) {
desc.lod_mode = BIFROST_LOD_MODE_ZERO;
} else {
assert(base == nir_type_float);
+
assert(sz == 16 || sz == 32);
dregs[BIFROST_TEX_DREG_LOD] =
bi_emit_lod_88(ctx, index, sz == 16);
@@ -1189,6 +1192,16 @@
}
break;
+
+ case nir_tex_src_bias:
+ /* Upper 16-bits interpreted as a clamp, leave zero */
+ assert(base == nir_type_float);
+ assert(sz == 16 || sz == 32);
+ dregs[BIFROST_TEX_DREG_LOD] =
+ bi_emit_lod_88(ctx, index, sz == 16);
+ desc.lod_mode = BIFROST_LOD_MODE_BIAS;
+ break;
+
default:
unreachable("Unhandled src type in texc emit");
}