nir/spirv: Patch through image qualifiers
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 19 Jan 2016 00:01:00 +0000 (16:01 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 19 Jan 2016 01:21:05 +0000 (17:21 -0800)
src/glsl/nir/spirv/spirv_to_nir.c
src/glsl/nir/spirv/vtn_private.h

index 4110c3571c67fe7caf835c5b3e95e89d6447df6b..1fcdb1aa14aabedd6fe459b6bfaeef62b4d00d5b 100644 (file)
@@ -717,6 +717,11 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
       unsigned sampled = w[7];
       SpvImageFormat format = w[8];
 
+      if (count > 9)
+         val->type->access_qualifier = w[9];
+      else
+         val->type->access_qualifier = SpvAccessQualifierReadWrite;
+
       assert(!multisampled && "FIXME: Handl multi-sampled textures");
 
       val->type->image_format = translate_image_format(format);
@@ -1915,6 +1920,17 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
                if (glsl_type_is_image(interface_type->type)) {
                   b->shader->info.num_images++;
                   var->data.image.format = interface_type->image_format;
+
+                  switch (interface_type->access_qualifier) {
+                  case SpvAccessQualifierReadOnly:
+                     var->data.image.read_only = true;
+                     break;
+                  case SpvAccessQualifierWriteOnly:
+                     var->data.image.write_only = true;
+                     break;
+                  default:
+                     break;
+                  }
                } else if (glsl_type_is_sampler(interface_type->type)) {
                   b->shader->info.num_textures++;
                } else {
index f91330ad48666ae354c7d31f7acef52cb32be3bd..cf75bc92a7ac24ec74192f17e30c5be23c10c150 100644 (file)
@@ -216,6 +216,9 @@ struct vtn_type {
    /* Image format for image_load_store type images */
    unsigned image_format;
 
+   /* Access qualifier for storage images */
+   SpvAccessQualifier access_qualifier;
+
    /* for arrays and matrices, the array stride */
    unsigned stride;