broadcom/vc5: Clamp min lod to the last level.
authorEric Anholt <eric@anholt.net>
Mon, 20 Nov 2017 18:07:24 +0000 (10:07 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 20 Nov 2017 21:52:33 +0000 (13:52 -0800)
Otherwise, the simulator would complain in tex-miplevel-selection that the
min/max clamp was out of order.  The actual HW seems to have clamped to
the max anyway.

src/gallium/drivers/vc5/vc5_emit.c

index 72b5d85880a29c03db74b99452e02d727c66bc38..d5356673e7ef66ea113f05a2c500b7f57a174612 100644 (file)
@@ -141,8 +141,9 @@ emit_one_texture(struct vc5_context *vc5, struct vc5_texture_stateobj *stage_tex
                  * TEXTURE_SHADER_STATE that ignores psview->min/max_lod to
                  * support txf properly.
                  */
-                .min_level_of_detail = (psview->u.tex.first_level +
-                                        MAX2(psampler->min_lod, 0)),
+                .min_level_of_detail = MIN2(psview->u.tex.first_level +
+                                            MAX2(psampler->min_lod, 0),
+                                            psview->u.tex.last_level),
                 .max_level_of_detail = MIN2(psview->u.tex.first_level +
                                             psampler->max_lod,
                                             psview->u.tex.last_level),