Re: [Mesa-dev] [PATCH v2 11/21] spirv: Set nir_variable->explicit_binding

2018-06-05 Thread Timothy Arceri

Seems reasonable.

Reviewed-by: Timothy Arceri 

On 12/05/18 19:40, Alejandro Piñeiro wrote:

From: Neil Roberts 

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 6d1eede5ed0..902b2373015 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1503,6 +1503,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];
@@ -1926,6 +1927,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;
  


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 11/21] spirv: Set nir_variable->explicit_binding

2018-05-12 Thread Alejandro Piñeiro
From: Neil Roberts 

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 6d1eede5ed0..902b2373015 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1503,6 +1503,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];
@@ -1926,6 +1927,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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev