Mesa (master): nir: set default lod to texture opcodes that needed it but don't provide it
Samuel Iglesias Gonsálvez
samuelig at kemper.freedesktop.org
Fri Oct 20 06:32:38 UTC 2017
Module: Mesa
Branch: master
Commit: e382890e25c0d95b0765ec00126f27dacc0e1da9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e382890e25c0d95b0765ec00126f27dacc0e1da9
Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date: Mon Oct 9 12:24:06 2017 +0200
nir: set default lod to texture opcodes that needed it but don't provide it
v2:
- Use helper to add a new source to the texture instruction.
v3:
- Use nir_tex_instr_src_index() to simplify the patch (Jason).
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/compiler/nir/nir_lower_tex.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 65681decb1..c6f001b62c 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -813,6 +813,19 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
progress = true;
continue;
}
+
+ /* TXF, TXS and TXL require a LOD but not everything we implement using those
+ * three opcodes provides one. Provide a default LOD of 0.
+ */
+ if ((nir_tex_instr_src_index(tex, nir_tex_src_lod) == -1) &&
+ (tex->op == nir_texop_txf || tex->op == nir_texop_txs ||
+ tex->op == nir_texop_txl || tex->op == nir_texop_query_levels ||
+ (tex->op == nir_texop_tex && b->shader->stage != MESA_SHADER_FRAGMENT))) {
+ b->cursor = nir_before_instr(&tex->instr);
+ nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(nir_imm_int(b, 0)));
+ progress = true;
+ continue;
+ }
}
return progress;
More information about the mesa-commit
mailing list