From bd24f4890f7f4b4a2c2c6e92163f655904b8709a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Nov 2017 19:04:12 -0700 Subject: [PATCH] broadcom/vc5: Skip emitting textures that aren't used. Fixes crashes when ARB_fp uses texture[1] but not 0, as in piglit's fp-fragment-position. --- src/gallium/drivers/vc5/vc5_emit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/vc5/vc5_emit.c b/src/gallium/drivers/vc5/vc5_emit.c index 094d5482954..de4737eeec8 100644 --- a/src/gallium/drivers/vc5/vc5_emit.c +++ b/src/gallium/drivers/vc5/vc5_emit.c @@ -201,8 +201,10 @@ emit_one_texture(struct vc5_context *vc5, struct vc5_texture_stateobj *stage_tex static void emit_textures(struct vc5_context *vc5, struct vc5_texture_stateobj *stage_tex) { - for (int i = 0; i < stage_tex->num_textures; i++) - emit_one_texture(vc5, stage_tex, i); + for (int i = 0; i < stage_tex->num_textures; i++) { + if (stage_tex->textures[i]) + emit_one_texture(vc5, stage_tex, i); + } } void -- 2.30.2