Module: Mesa
Branch: master
Commit: 6a78416dabdf0b7b80471dd0c636164c8f4012e0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a78416dabdf0b7b80471dd0c636164c8f4012e0

Author: Eric Anholt <e...@anholt.net>
Date:   Tue Nov 21 16:32:33 2017 -0800

broadcom/vc5: Fix BASE_LEVEL handling with txl.

The HW doesn't add the base level anywhere (the min/max lod clamping is
what does base level), so we need to add it manually in this case.

Fixes piglit tex-miplevel-selection *Lod 2D.

---

 src/broadcom/compiler/nir_to_vir.c     | 6 ++++--
 src/gallium/drivers/vc5/vc5_uniforms.c | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/broadcom/compiler/nir_to_vir.c 
b/src/broadcom/compiler/nir_to_vir.c
index 879704aeee..7a31e242d1 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -380,9 +380,11 @@ ntq_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
                         p0_unpacked.bias_supplied = true;
                         break;
                 case nir_tex_src_lod:
-                        /* XXX: Needs base level addition */
                         coords[next_coord++] =
-                                ntq_get_src(c, instr->src[i].src, 0);
+                                vir_FADD(c,
+                                         ntq_get_src(c, instr->src[i].src, 0),
+                                         vir_uniform(c, 
QUNIFORM_TEXTURE_FIRST_LEVEL,
+                                                     unit));
 
                         if (instr->op != nir_texop_txf &&
                             instr->op != nir_texop_tg4) {
diff --git a/src/gallium/drivers/vc5/vc5_uniforms.c 
b/src/gallium/drivers/vc5/vc5_uniforms.c
index 37354b8bb8..5e181344e7 100644
--- a/src/gallium/drivers/vc5/vc5_uniforms.c
+++ b/src/gallium/drivers/vc5/vc5_uniforms.c
@@ -324,6 +324,10 @@ vc5_write_uniforms(struct vc5_context *vc5, struct 
vc5_compiled_shader *shader,
                         break;
 
                 case QUNIFORM_TEXTURE_FIRST_LEVEL:
+                        cl_aligned_f(&uniforms,
+                                     
texstate->textures[uinfo->data[i]]->u.tex.first_level);
+                        break;
+
                 case QUNIFORM_TEXTURE_BORDER_COLOR:
                         /* XXX */
                         break;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to