spirv: Set nir_variable->explicit_binding
authorNeil Roberts <nroberts@igalia.com>
Fri, 23 Feb 2018 16:07:52 +0000 (17:07 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 21 Jun 2018 12:25:05 +0000 (14:25 +0200)
When SpvDecorationBinding is encountered in the SPIR-V source it now
sets explicit_binding on the nir_variable. This will be used to
determine whether to initialise sampler and image uniforms with the
binding value.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/spirv/vtn_private.h
src/compiler/spirv/vtn_variables.c

index 232396775df764307e212bffaf80c296dae894db..bef82dfb5b58d07ca6fdec1ff336682efab65d26 100644 (file)
@@ -456,6 +456,7 @@ struct vtn_variable {
 
    unsigned descriptor_set;
    unsigned binding;
+   bool explicit_binding;
    unsigned input_attachment_index;
    bool patch;
 
index 225b088ecbc77779bfcbb589c026d7ad533bbada..df88abdbd63ec798f2545bbc9a5c6263ea08b303 100644 (file)
@@ -1507,6 +1507,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
    switch (dec->decoration) {
    case SpvDecorationBinding:
       vtn_var->binding = dec->literals[0];
+      vtn_var->explicit_binding = true;
       return;
    case SpvDecorationDescriptorSet:
       vtn_var->descriptor_set = dec->literals[0];
@@ -1930,6 +1931,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
        * for these. We should fix that.
        */
       var->var->data.binding = var->binding;
+      var->var->data.explicit_binding = var->explicit_binding;
       var->var->data.descriptor_set = var->descriptor_set;
       var->var->data.index = var->input_attachment_index;