[Mesa-dev] [PATCH v2 04/25] tgsi/scan: collect information about output vertex streams

Nicolai Hähnle nhaehnle at gmail.com
Tue Dec 6 10:48:15 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

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

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 77fe6b3..56b422d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -540,20 +540,37 @@ scan_declaration(struct tgsi_shader_info *info,
             info->reads_samplemask = TRUE;
             break;
          }
          break;
 
       case TGSI_FILE_OUTPUT:
          info->output_semantic_name[reg] = (ubyte) semName;
          info->output_semantic_index[reg] = (ubyte) semIndex;
          info->num_outputs = MAX2(info->num_outputs, reg + 1);
 
+         if (fulldecl->Declaration.UsageMask & TGSI_WRITEMASK_X) {
+            info->output_streams[reg] |= (ubyte)fulldecl->Semantic.StreamX;
+            info->num_stream_output_components[fulldecl->Semantic.StreamX]++;
+         }
+         if (fulldecl->Declaration.UsageMask & TGSI_WRITEMASK_Y) {
+            info->output_streams[reg] |= (ubyte)fulldecl->Semantic.StreamY << 2;
+            info->num_stream_output_components[fulldecl->Semantic.StreamY]++;
+         }
+         if (fulldecl->Declaration.UsageMask & TGSI_WRITEMASK_Z) {
+            info->output_streams[reg] |= (ubyte)fulldecl->Semantic.StreamZ << 4;
+            info->num_stream_output_components[fulldecl->Semantic.StreamZ]++;
+         }
+         if (fulldecl->Declaration.UsageMask & TGSI_WRITEMASK_W) {
+            info->output_streams[reg] |= (ubyte)fulldecl->Semantic.StreamW << 6;
+            info->num_stream_output_components[fulldecl->Semantic.StreamW]++;
+         }
+
          switch (semName) {
          case TGSI_SEMANTIC_PRIMID:
             info->writes_primid = true;
             break;
          case TGSI_SEMANTIC_VIEWPORT_INDEX:
             info->writes_viewport_index = true;
             break;
          case TGSI_SEMANTIC_LAYER:
             info->writes_layer = true;
             break;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index e4f4018..0cce0f6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -47,34 +47,36 @@ struct tgsi_shader_info
    ubyte num_inputs;
    ubyte num_outputs;
    ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */
    ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
    ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS];
    ubyte input_interpolate_loc[PIPE_MAX_SHADER_INPUTS];
    ubyte input_usage_mask[PIPE_MAX_SHADER_INPUTS];
    ubyte input_cylindrical_wrap[PIPE_MAX_SHADER_INPUTS];
    ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */
    ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
+   ubyte output_streams[PIPE_MAX_SHADER_OUTPUTS];
 
    ubyte num_system_values;
    ubyte system_value_semantic_name[PIPE_MAX_SHADER_INPUTS];
 
    ubyte processor;
 
    uint file_mask[TGSI_FILE_COUNT];  /**< bitmask of declared registers */
    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 */
+   ubyte num_stream_output_components[4];
 
    ubyte input_array_first[PIPE_MAX_SHADER_INPUTS];
    ubyte input_array_last[PIPE_MAX_SHADER_INPUTS];
    ubyte output_array_first[PIPE_MAX_SHADER_OUTPUTS];
    ubyte output_array_last[PIPE_MAX_SHADER_OUTPUTS];
    unsigned array_max[TGSI_FILE_COUNT];  /**< highest index array per register file */
 
    uint immediate_count; /**< number of immediates declared */
    uint num_instructions;
    uint num_memory_instructions; /**< sampler, buffer, and image instructions */
-- 
2.7.4



More information about the mesa-dev mailing list