tgsi/scan: remember sampler view types
authorMarek Olšák <marek.olsak@amd.com>
Wed, 24 Aug 2016 17:08:01 +0000 (19:08 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 29 Aug 2016 12:16:57 +0000 (14:16 +0200)
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h

index 0167e22affdaffe2a255fea5b1c48b088801a92c..a3b0d9f41293d9e5ebc7e7efd5d61c5f6106d4d8 100644 (file)
@@ -497,13 +497,17 @@ scan_declaration(struct tgsi_shader_info *info,
          info->samplers_declared |= 1u << reg;
       } else if (file == TGSI_FILE_SAMPLER_VIEW) {
          unsigned target = fulldecl->SamplerView.Resource;
+         unsigned type = fulldecl->SamplerView.ReturnTypeX;
+
          assert(target < TGSI_TEXTURE_UNKNOWN);
          if (info->sampler_targets[reg] == TGSI_TEXTURE_UNKNOWN) {
             /* Save sampler target for this sampler index */
             info->sampler_targets[reg] = target;
+            info->sampler_type[reg] = type;
          } else {
             /* if previously declared, make sure targets agree */
             assert(info->sampler_targets[reg] == target);
+            assert(info->sampler_type[reg] == type);
          }
       } else if (file == TGSI_FILE_IMAGE) {
          if (fulldecl->Image.Resource == TGSI_TEXTURE_BUFFER)
index 30d01460b1d550149e792c5868d28a4946109c68..0c5f2ba064ace0af35038dda69d77d0b8a33e0dc 100644 (file)
@@ -66,6 +66,7 @@ struct tgsi_shader_info
    int const_file_max[PIPE_MAX_CONSTANT_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 input_array_first[PIPE_MAX_SHADER_INPUTS];
    ubyte input_array_last[PIPE_MAX_SHADER_INPUTS];