[Mesa-dev] [PATCH 20/20] panfrost/midgard: Fixup NIR texture op
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Mon Jun 24 17:39:23 UTC 2019
In a vertex shader, a tex op should map to txl, as there *must* be a LOD
given to the hardware (implicitly or explicitly).
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/midgard/midgard_compile.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 5d2e9ca8d3b..9109544f89f 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -1601,6 +1601,14 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
static void
emit_tex(compiler_context *ctx, nir_tex_instr *instr)
{
+ /* Fixup op, since only textureLod is permitted in VS but NIR can give
+ * generic tex in some cases (which confuses the hardware) */
+
+ bool is_vertex = ctx->stage == MESA_SHADER_VERTEX;
+
+ if (is_vertex && instr->op == nir_texop_tex)
+ instr->op = nir_texop_txl;
+
switch (instr->op) {
case nir_texop_tex:
case nir_texop_txb:
--
2.20.1
More information about the mesa-dev
mailing list