Mesa (master): pan/mdg: Implement texture gathers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 31 12:07:54 UTC 2020
Module: Mesa
Branch: master
Commit: 7dab5749c89181bc71b8d1635ab1a9b1a7928163
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7dab5749c89181bc71b8d1635ab1a9b1a7928163
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Fri Aug 28 09:48:38 2020 -0400
pan/mdg: Implement texture gathers
As previously shown, it is a mode on top of textureLod. The main gotcha
is the results are swizzled; we reuse the Broadcom lowering for that.
Also, there's a pretty significant erratum affecting gathers of cubemaps
which can be dealt with... eventually.
Fixes:
dEQP-GLES31.functional.texture.gather.basic.2d.*
dEQP-GLES31.functional.texture.gather.basic.2d_array.*
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6516>
---
src/panfrost/midgard/midgard_compile.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 5dcb9c55c74..1f54cfdcf39 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -497,6 +497,7 @@ optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend)
.lower_txp = ~0,
.lower_tex_without_implicit_lod =
(quirks & MIDGARD_EXPLICIT_LOD),
+ .lower_tg4_broadcom_swizzle = true,
/* TODO: we have native gradient.. */
.lower_txd = true,
@@ -2068,7 +2069,11 @@ pan_attach_constant_bias(
static enum mali_texture_mode
mdg_texture_mode(nir_tex_instr *instr)
{
- if (instr->is_shadow)
+ if (instr->op == nir_texop_tg4 && instr->is_shadow)
+ return TEXTURE_GATHER_SHADOW;
+ else if (instr->op == nir_texop_tg4)
+ return TEXTURE_GATHER_X + instr->component;
+ else if (instr->is_shadow)
return TEXTURE_SHADOW;
else
return TEXTURE_NORMAL;
@@ -2112,7 +2117,7 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
}
};
- if (instr->is_shadow && !instr->is_new_style_shadow)
+ if (instr->is_shadow && !instr->is_new_style_shadow && instr->op != nir_texop_tg4)
for (int i = 0; i < 4; ++i)
ins.swizzle[0][i] = COMPONENT_X;
@@ -2282,6 +2287,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
emit_texop_native(ctx, instr, TEXTURE_OP_NORMAL);
break;
case nir_texop_txl:
+ case nir_texop_tg4:
emit_texop_native(ctx, instr, TEXTURE_OP_LOD);
break;
case nir_texop_txf:
More information about the mesa-commit
mailing list