Module: Mesa
Branch: main
Commit: b1bbe4e19096b409fd415baff438dbb92b00e976
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1bbe4e19096b409fd415baff438dbb92b00e976

Author: Marek Olšák <[email protected]>
Date:   Tue Sep 26 00:10:44 2023 -0400

nir: gather dual slot input information

Reviewed-By: Mike Blumenkrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25394>

---

 src/compiler/nir/nir_gather_info.c | 3 +++
 src/compiler/nir/nir_print.c       | 1 +
 src/compiler/shader_info.h         | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/src/compiler/nir/nir_gather_info.c 
b/src/compiler/nir/nir_gather_info.c
index 865d976a98e..d02018986b6 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -508,6 +508,8 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, 
nir_shader *shader,
             shader->info.patch_inputs_read_indirectly |= slot_mask;
       } else {
          shader->info.inputs_read |= slot_mask;
+         if (nir_intrinsic_io_semantics(instr).high_dvec2)
+            shader->info.dual_slot_inputs |= slot_mask;
          shader->info.inputs_read_16bit |= slot_mask_16bit;
          if (!nir_src_is_const(*nir_get_io_offset_src(instr))) {
             shader->info.inputs_read_indirectly |= slot_mask;
@@ -926,6 +928,7 @@ nir_shader_gather_info(nir_shader *shader, 
nir_function_impl *entrypoint)
    }
 
    shader->info.inputs_read = 0;
+   shader->info.dual_slot_inputs = 0;
    shader->info.outputs_written = 0;
    shader->info.outputs_read = 0;
    shader->info.inputs_read_16bit = 0;
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 301b98a256e..56d280cbb6d 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -2397,6 +2397,7 @@ print_shader_info(const struct shader_info *info, FILE 
*fp)
    print_nz_unsigned(fp, "num_images", info->num_images);
 
    print_nz_x64(fp, "inputs_read", info->inputs_read);
+   print_nz_x64(fp, "dual_slot_inputs", info->dual_slot_inputs);
    print_nz_x64(fp, "outputs_written", info->outputs_written);
    print_nz_x64(fp, "outputs_read", info->outputs_read);
 
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index ad2c7afcc8c..052ef6ab5b2 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -167,6 +167,8 @@ typedef struct shader_info {
 
    /* Which inputs are actually read */
    uint64_t inputs_read;
+   /* Which inputs occupy 2 slots. */
+   uint64_t dual_slot_inputs;
    /* Which outputs are actually written */
    uint64_t outputs_written;
    /* Which outputs are actually read */

Reply via email to