[Mesa-dev] [PATCH 1/7] tgsi/scan: record barrier instruction usage

Marek Olšák maraeo at gmail.com
Thu May 25 17:04:41 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/tgsi/tgsi_scan.c | 6 ++++++
 src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 847f4fc..cfe9f15 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -360,20 +360,26 @@ scan_instruction(struct tgsi_shader_info *info,
    case TGSI_OPCODE_IF:
    case TGSI_OPCODE_UIF:
    case TGSI_OPCODE_BGNLOOP:
       (*current_depth)++;
       info->max_depth = MAX2(info->max_depth, *current_depth);
       break;
    case TGSI_OPCODE_ENDIF:
    case TGSI_OPCODE_ENDLOOP:
       (*current_depth)--;
       break;
+   case TGSI_OPCODE_BARRIER:
+      info->uses_barrier = true;
+      break;
+   case TGSI_OPCODE_MEMBAR:
+      info->uses_memory_barrier = true;
+      break;
    default:
       break;
    }
 
    if (fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_CENTROID ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_OFFSET ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE) {
       const struct tgsi_full_src_register *src0 = &fullinst->Src[0];
       unsigned input;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index af1651b..baaa7f6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -128,20 +128,22 @@ struct tgsi_shader_info
    boolean writes_position;
    boolean writes_psize;
    boolean writes_clipvertex;
    boolean writes_primid;
    boolean writes_viewport_index;
    boolean writes_layer;
    boolean writes_memory; /**< contains stores or atomics to buffers or images */
    boolean is_msaa_sampler[PIPE_MAX_SAMPLERS];
    boolean uses_doubles; /**< uses any of the double instructions */
    boolean uses_derivatives;
+   boolean uses_barrier;
+   boolean uses_memory_barrier;
    unsigned clipdist_writemask;
    unsigned culldist_writemask;
    unsigned num_written_culldistance;
    unsigned num_written_clipdistance;
 
    unsigned images_declared; /**< bitmask of declared images */
    /**
     * Bitmask indicating which declared image is a buffer.
     */
    unsigned images_buffers;
-- 
2.7.4



More information about the mesa-dev mailing list