panfrost: Fix shader texture count
authorIcecream95 <ixn@disroot.org>
Wed, 21 Apr 2021 19:13:39 +0000 (07:13 +1200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 23 Apr 2021 14:40:55 +0000 (14:40 +0000)
Instead of using num_textures, determine the texture count from the
last bit set in textures_used.

Fixes ADDR_RANGE_FAULTs when draw_textured_quad writes only stencil.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10422>

src/panfrost/lib/pan_shader.c

index 8a42e29..49bba06 100644 (file)
@@ -239,5 +239,5 @@ pan_shader_compile(const struct panfrost_device *dev,
         info->attribute_count += util_bitcount(s->info.images_used);
         info->writes_global = s->info.writes_memory;
 
-        info->sampler_count = info->texture_count = s->info.num_textures;
+        info->sampler_count = info->texture_count = BITSET_LAST_BIT(s->info.textures_used);
 }