Mesa (master): tgsi/scan: get information about indirect CONST access
Marek Olšák
mareko at kemper.freedesktop.org
Mon Oct 24 19:42:03 UTC 2016
Module: Mesa
Branch: master
Commit: 965a5f181047846b081bf1d510ddc4e5424f6b32
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=965a5f181047846b081bf1d510ddc4e5424f6b32
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Oct 20 00:56:08 2016 +0200
tgsi/scan: get information about indirect CONST access
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/auxiliary/tgsi/tgsi_scan.c | 13 +++++++++++++
src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index b862078..0c81005 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -271,6 +271,18 @@ scan_instruction(struct tgsi_shader_info *info,
if (src->Register.Indirect) {
info->indirect_files |= (1 << src->Register.File);
info->indirect_files_read |= (1 << src->Register.File);
+
+ /* record indirect constant buffer indexing */
+ if (src->Register.File == TGSI_FILE_CONSTANT) {
+ if (src->Register.Dimension) {
+ if (src->Dimension.Indirect)
+ info->const_buffers_indirect = info->const_buffers_declared;
+ else
+ info->const_buffers_indirect |= 1u << src->Dimension.Index;
+ } else {
+ info->const_buffers_indirect |= 1;
+ }
+ }
}
/* Texture samplers */
@@ -392,6 +404,7 @@ scan_declaration(struct tgsi_shader_info *info,
info->const_file_max[buffer] =
MAX2(info->const_file_max[buffer], (int)reg);
+ info->const_buffers_declared |= 1u << buffer;
}
else if (file == TGSI_FILE_INPUT) {
info->input_semantic_name[reg] = (ubyte) semName;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 0c5f2ba..2e61dc7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -64,6 +64,7 @@ struct tgsi_shader_info
uint file_count[TGSI_FILE_COUNT]; /**< number of declared registers */
int file_max[TGSI_FILE_COUNT]; /**< highest index of declared registers */
int const_file_max[PIPE_MAX_CONSTANT_BUFFERS];
+ unsigned const_buffers_declared; /**< bitmask of declared const buffers */
unsigned samplers_declared; /**< bitmask of declared samplers */
ubyte sampler_targets[PIPE_MAX_SHADER_SAMPLER_VIEWS]; /**< TGSI_TEXTURE_x values */
ubyte sampler_type[PIPE_MAX_SHADER_SAMPLER_VIEWS]; /**< TGSI_RETURN_TYPE_x */
@@ -141,6 +142,7 @@ struct tgsi_shader_info
*/
unsigned indirect_files_read;
unsigned indirect_files_written;
+ unsigned const_buffers_indirect; /**< const buffers using indirect addressing */
unsigned properties[TGSI_PROPERTY_COUNT]; /* index with TGSI_PROPERTY_ */
More information about the mesa-commit
mailing list