summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_variables.c
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-05-08 13:16:13 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-05-20 10:53:38 -0700
commit83550b7dc437f496eea090b938d3ba599c0db016 (patch)
tree00b5e7cd3dfaaeec74aea4f01024a549a5d5fc7c /src/compiler/spirv/vtn_variables.c
parent48ea3bbff6ad1ce9f028097660da6c2d30338fe5 (diff)
spirv: Reuse helpers in vtn_handle_type()
And change vtn_storage_class_to_mode() to accept NULL as interface_type. In this case, if we have a SpvStorageClassUniform, we assume it is uses an ubo_addr_format, like the code being replaced by the helper. That assumption is a problem, but no different than the previous code. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_variables.c')
-rw-r--r--src/compiler/spirv/vtn_variables.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 198557f2eaf..50d1d3f4813 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1723,7 +1723,8 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
nir_variable_mode nir_mode;
switch (class) {
case SpvStorageClassUniform:
- if (interface_type->block) {
+ /* Assume it's an UBO if we lack the interface_type. */
+ if (!interface_type || interface_type->block) {
mode = vtn_variable_mode_ubo;
nir_mode = nir_var_mem_ubo;
} else if (interface_type->buffer_block) {