spirv: Handle the InputAttachmentIndex decoration
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 14 Nov 2016 22:22:56 +0000 (14:22 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 22 Nov 2016 21:02:35 +0000 (13:02 -0800)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/compiler/spirv/vtn_private.h
src/compiler/spirv/vtn_variables.c

index 6f34f09ebd2f1efa437b40557bfc91c4932b4b5c..47579fe0fb9d20eb07185400273c6eb9de9707fe 100644 (file)
@@ -279,6 +279,7 @@ struct vtn_variable {
 
    unsigned descriptor_set;
    unsigned binding;
+   unsigned input_attachment_index;
 
    nir_variable *var;
    nir_variable **members;
index c064de8d683d98ccc043b0140304872b89aacb2d..14366dc321d904a1d3162b2228df4e631fb05d86 100644 (file)
@@ -1027,6 +1027,9 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
    case SpvDecorationDescriptorSet:
       vtn_var->descriptor_set = dec->literals[0];
       return;
+   case SpvDecorationInputAttachmentIndex:
+      vtn_var->input_attachment_index = dec->literals[0];
+      return;
    default:
       break;
    }
@@ -1335,6 +1338,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
           */
          var->var->data.binding = var->binding;
          var->var->data.descriptor_set = var->descriptor_set;
+         var->var->data.index = var->input_attachment_index;
 
          if (var->mode == vtn_variable_mode_image)
             var->var->data.image.format = without_array->image_format;