[Mesa-dev] [PATCH 03/11] tgsi/scan: scan address operands

Marek Olšák maraeo at gmail.com
Fri Sep 29 12:25:26 UTC 2017


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

---
 src/gallium/auxiliary/tgsi/tgsi_scan.c | 45 +++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 212d1bb..77a447c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -464,20 +464,43 @@ scan_instruction(struct tgsi_shader_info *info,
        fullinst->Instruction.Opcode == TGSI_OPCODE_D2U64 ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_D2I64 ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_U642D ||
        fullinst->Instruction.Opcode == TGSI_OPCODE_I642D)
       info->uses_doubles = TRUE;
 
    for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
       scan_src_operand(info, fullinst, &fullinst->Src[i], i,
                        tgsi_util_get_inst_usage_mask(fullinst, i),
                        is_interp_instruction, &is_mem_inst);
+
+      if (fullinst->Src[i].Register.Indirect) {
+         struct tgsi_full_src_register src = {{0}};
+
+         src.Register.File = fullinst->Src[i].Indirect.File;
+         src.Register.Index = fullinst->Src[i].Indirect.Index;
+         src.Register.SwizzleX = fullinst->Src[i].Indirect.Swizzle;
+
+         scan_src_operand(info, fullinst, &src, -1, TGSI_WRITEMASK_X,
+                          false, NULL);
+      }
+
+      if (fullinst->Src[i].Register.Dimension &&
+          fullinst->Src[i].Dimension.Indirect) {
+         struct tgsi_full_src_register src = {{0}};
+
+         src.Register.File = fullinst->Src[i].DimIndirect.File;
+         src.Register.Index = fullinst->Src[i].DimIndirect.Index;
+         src.Register.SwizzleX = fullinst->Src[i].DimIndirect.Swizzle;
+
+         scan_src_operand(info, fullinst, &src, -1, TGSI_WRITEMASK_X,
+                          false, NULL);
+      }
    }
 
    if (fullinst->Instruction.Texture) {
       for (i = 0; i < fullinst->Texture.NumOffsets; i++) {
          struct tgsi_full_src_register src = {{0}};
 
          src.Register.File = fullinst->TexOffsets[i].File;
          src.Register.Index = fullinst->TexOffsets[i].Index;
          src.Register.SwizzleX = fullinst->TexOffsets[i].SwizzleX;
          src.Register.SwizzleY = fullinst->TexOffsets[i].SwizzleY;
@@ -485,27 +508,47 @@ scan_instruction(struct tgsi_shader_info *info,
 
          /* The usage mask is suboptimal but should be safe. */
          scan_src_operand(info, fullinst, &src, 0, TGSI_WRITEMASK_XYZ,
                           false, &is_mem_inst);
       }
    }
 
    /* check for indirect register writes */
    for (i = 0; i < fullinst->Instruction.NumDstRegs; i++) {
       const struct tgsi_full_dst_register *dst = &fullinst->Dst[i];
+
       if (dst->Register.Indirect) {
+         struct tgsi_full_src_register src = {{0}};
+
+         src.Register.File = dst->Indirect.File;
+         src.Register.Index = dst->Indirect.Index;
+         src.Register.SwizzleX = dst->Indirect.Swizzle;
+
+         scan_src_operand(info, fullinst, &src, -1, TGSI_WRITEMASK_X,
+                          false, NULL);
+
          info->indirect_files |= (1 << dst->Register.File);
          info->indirect_files_written |= (1 << dst->Register.File);
       }
 
-      if (dst->Register.Dimension && dst->Dimension.Indirect)
+      if (dst->Register.Dimension && dst->Dimension.Indirect) {
+         struct tgsi_full_src_register src = {{0}};
+
+         src.Register.File = dst->DimIndirect.File;
+         src.Register.Index = dst->DimIndirect.Index;
+         src.Register.SwizzleX = dst->DimIndirect.Swizzle;
+
+         scan_src_operand(info, fullinst, &src, -1, TGSI_WRITEMASK_X,
+                          false, NULL);
+
          info->dim_indirect_files |= 1u << dst->Register.File;
+      }
 
       if (is_memory_file(dst->Register.File)) {
          assert(fullinst->Instruction.Opcode == TGSI_OPCODE_STORE);
 
          is_mem_inst = true;
          info->writes_memory = TRUE;
 
          if (dst->Register.File == TGSI_FILE_IMAGE) {
             if (dst->Register.Indirect)
                info->images_store = info->images_declared;
-- 
2.7.4



More information about the mesa-dev mailing list