[Mesa-dev] [PATCH 11/22] spirv: Set nir_variable->explicit_binding
Alejandro PiƱeiro
apinheiro at igalia.com
Tue Apr 17 14:36:48 UTC 2018
From: Neil Roberts <nroberts at igalia.com>
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.
---
src/compiler/spirv/vtn_private.h | 1 +
src/compiler/spirv/vtn_variables.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 98bec389fcd..5fc34f43809 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -452,6 +452,7 @@ struct vtn_variable {
unsigned descriptor_set;
unsigned binding;
+ bool explicit_binding;
unsigned input_attachment_index;
bool patch;
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 633fe6bd9da..24f170a0504 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1500,6 +1500,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];
@@ -1923,6 +1924,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;
--
2.14.1
More information about the mesa-dev
mailing list