summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-02-22 00:23:10 +0100
committerMarek Olšák <[email protected]>2016-03-01 00:11:32 +0100
commit09bfbd43a0818c67cb0a6dd4437cc4946e0af5dc (patch)
treec9781d1c2f540fc956240afa0818fc3091c55db5 /src/gallium
parent35859d5bbba998aa41ec87bc53d946add4662dea (diff)
tgsi/scan: count memory instructions
for radeonsi Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c19
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 4f85d2fda67..8e24cc626bd 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -43,6 +43,15 @@
#include "tgsi/tgsi_scan.h"
+static bool
+is_memory_file(unsigned file)
+{
+ return file == TGSI_FILE_SAMPLER ||
+ file == TGSI_FILE_SAMPLER_VIEW ||
+ file == TGSI_FILE_IMAGE ||
+ file == TGSI_FILE_BUFFER;
+}
+
static void
scan_instruction(struct tgsi_shader_info *info,
@@ -50,6 +59,7 @@ scan_instruction(struct tgsi_shader_info *info,
unsigned *current_depth)
{
unsigned i;
+ bool is_mem_inst = false;
assert(fullinst->Instruction.Opcode < TGSI_OPCODE_LAST);
info->opcode_count[fullinst->Instruction.Opcode]++;
@@ -181,6 +191,9 @@ scan_instruction(struct tgsi_shader_info *info,
info->is_msaa_sampler[src->Register.Index] = TRUE;
}
}
+
+ if (is_memory_file(src->Register.File))
+ is_mem_inst = true;
}
/* check for indirect register writes */
@@ -190,8 +203,14 @@ scan_instruction(struct tgsi_shader_info *info,
info->indirect_files |= (1 << dst->Register.File);
info->indirect_files_written |= (1 << dst->Register.File);
}
+
+ if (is_memory_file(dst->Register.File))
+ is_mem_inst = true;
}
+ if (is_mem_inst)
+ info->num_memory_instructions++;
+
info->num_instructions++;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 0541255764c..d65dec71888 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -74,6 +74,7 @@ struct tgsi_shader_info
uint immediate_count; /**< number of immediates declared */
uint num_instructions;
+ uint num_memory_instructions; /**< sampler, buffer, and image instructions */
uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */