summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-05-09 19:33:51 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-05-20 10:53:38 -0700
commit48ea3bbff6ad1ce9f028097660da6c2d30338fe5 (patch)
treec3a1a84f717e4b734ae6bfdcdd00cd07a73059f3
parent672a3f42d91534a4a77ba5da10a66871734d7953 (diff)
spirv: Add vtn_variable_mode_image
Corresponding to SpvStorageClassImage. We see pointers for that storage class in tests, but don't use the storage class any further. Adding this so that we can call vtn_mode_to_address_format() for all supported pointers. v2: Fail when trying to create a SpvStorageClassImage variable. (Jason) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/compiler/spirv/vtn_private.h1
-rw-r--r--src/compiler/spirv/vtn_variables.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index a66f2c02fbd..c0595709852 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -438,6 +438,7 @@ enum vtn_variable_mode {
vtn_variable_mode_cross_workgroup,
vtn_variable_mode_input,
vtn_variable_mode_output,
+ vtn_variable_mode_image,
};
struct vtn_pointer {
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 11d3111c516..198557f2eaf 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1779,6 +1779,10 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
mode = vtn_variable_mode_cross_workgroup;
nir_mode = nir_var_mem_global;
break;
+ case SpvStorageClassImage:
+ mode = vtn_variable_mode_image;
+ nir_mode = nir_var_mem_ubo;
+ break;
case SpvStorageClassGeneric:
default:
vtn_fail("Unhandled variable storage class: %s (%u)",
@@ -1822,6 +1826,7 @@ vtn_mode_to_address_format(struct vtn_builder *b, enum vtn_variable_mode mode)
case vtn_variable_mode_uniform:
case vtn_variable_mode_input:
case vtn_variable_mode_output:
+ case vtn_variable_mode_image:
return nir_address_format_logical;
}
@@ -2082,6 +2087,10 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
b->shader->num_uniforms = vtn_type_block_size(b, type);
break;
+ case vtn_variable_mode_image:
+ vtn_fail("Cannot create a variable with the Image storage class");
+ break;
+
case vtn_variable_mode_phys_ssbo:
vtn_fail("Cannot create a variable with the "
"PhysicalStorageBufferEXT storage class");
@@ -2244,6 +2253,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
/* These don't need actual variables. */
break;
+ case vtn_variable_mode_image:
case vtn_variable_mode_phys_ssbo:
unreachable("Should have been caught before");
}