Mesa (master): ir3: Don't calculate num_samp ourselves

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 17 15:01:17 UTC 2020


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Wed Jun 17 11:07:26 2020 +0200

ir3: Don't calculate num_samp ourselves

In addition to duplicating what core NIR does better, this was wrong for
Vulkan, where it should be 0 as there are no non-bindless samplers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5519>

---

 src/freedreno/ir3/ir3_compiler_nir.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index f52e9570b65..1ad4149d451 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -3317,15 +3317,11 @@ emit_instructions(struct ir3_context *ctx)
 		setup_output(ctx, var);
 	}
 
-	/* Find # of samplers: */
-	nir_foreach_variable (var, &ctx->s->uniforms) {
-		ctx->so->num_samp += glsl_type_get_sampler_count(var->type);
-		/* just assume that we'll be reading from images.. if it
-		 * is write-only we don't have to count it, but not sure
-		 * if there is a good way to know?
-		 */
-		ctx->so->num_samp += glsl_type_get_image_count(var->type);
-	}
+	/* Find # of samplers. Just assume that we'll be reading from images.. if
+	 * it is write-only we don't have to count it, but after lowering derefs
+	 * is too late to compact indices for that.
+	 */
+	ctx->so->num_samp = util_last_bit(ctx->s->info.textures_used) + ctx->s->info.num_images;
 
 	/* NOTE: need to do something more clever when we support >1 fxn */
 	nir_foreach_register (reg, &fxn->registers) {



More information about the mesa-commit mailing list