tgsi/scan: collect information about output vertex streams
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 29 Nov 2016 13:22:20 +0000 (14:22 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 12 Dec 2016 08:03:57 +0000 (09:03 +0100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h

index 77fe6b3798200b78b65514a88169601588348511..56b422d8e9c201a9ac75fe43775ca2d6d4dca890 100644 (file)
@@ -547,6 +547,23 @@ scan_declaration(struct tgsi_shader_info *info,
          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;
index e4f4018318991a37cda89bba0544be88adc92164..0cce0f6babb666c75ddd7fb6007b87c36bc6eb67 100644 (file)
@@ -54,6 +54,7 @@ struct tgsi_shader_info
    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];
@@ -68,6 +69,7 @@ struct tgsi_shader_info
    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];