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 <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Caio Marcelo de Oliveira Filho
2019-05-08 13:16:13 -07:00
parent 48ea3bbff6
commit 83550b7dc4
2 changed files with 6 additions and 33 deletions

View File

@@ -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) {