Mesa (master): radeonsi: clean up code for loading VS inputs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 3 02:58:36 UTC 2020


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Aug 14 17:56:42 2020 -0400

radeonsi: clean up code for loading VS inputs

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6445>

---

 src/gallium/drivers/radeonsi/si_shader_llvm_vs.c | 40 +++++-------------------
 1 file changed, 7 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_vs.c b/src/gallium/drivers/radeonsi/si_shader_llvm_vs.c
index f0c93ac3264..76ea7e76c36 100644
--- a/src/gallium/drivers/radeonsi/si_shader_llvm_vs.c
+++ b/src/gallium/drivers/radeonsi/si_shader_llvm_vs.c
@@ -225,44 +225,18 @@ static void load_input_vs(struct si_shader_context *ctx, unsigned input_index, L
       out[i] = ac_to_float(&ctx->ac, fetches[i]);
 }
 
-static void declare_input_vs(struct si_shader_context *ctx, unsigned input_index)
-{
-   LLVMValueRef input[4];
-
-   load_input_vs(ctx, input_index / 4, input);
-
-   for (unsigned chan = 0; chan < 4; chan++) {
-      ctx->inputs[input_index + chan] =
-         LLVMBuildBitCast(ctx->ac.builder, input[chan], ctx->ac.i32, "");
-   }
-}
-
 void si_llvm_load_vs_inputs(struct si_shader_context *ctx, struct nir_shader *nir)
 {
-   uint64_t processed_inputs = 0;
-
-   nir_foreach_shader_in_variable (variable, nir) {
-      unsigned attrib_count = glsl_count_attribute_slots(variable->type, true);
-      unsigned input_idx = variable->data.driver_location;
-      unsigned loc = variable->data.location;
+   const struct si_shader_info *info = &ctx->shader->selector->info;
 
-      for (unsigned i = 0; i < attrib_count; i++) {
-         /* Packed components share the same location so skip
-          * them if we have already processed the location.
-          */
-         if (processed_inputs & ((uint64_t)1 << (loc + i))) {
-            input_idx += 4;
-            continue;
-         }
+   for (unsigned i = 0; i < info->num_inputs; i++) {
+      LLVMValueRef values[4];
 
-         declare_input_vs(ctx, input_idx);
-         if (glsl_type_is_dual_slot(variable->type)) {
-            input_idx += 4;
-            declare_input_vs(ctx, input_idx);
-         }
+      load_input_vs(ctx, i, values);
 
-         processed_inputs |= ((uint64_t)1 << (loc + i));
-         input_idx += 4;
+      for (unsigned chan = 0; chan < 4; chan++) {
+         ctx->inputs[i * 4 + chan] =
+            LLVMBuildBitCast(ctx->ac.builder, values[chan], ctx->ac.i32, "");
       }
    }
 }



More information about the mesa-commit mailing list