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 <jason@jlekstrand.net> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
@@ -438,6 +438,7 @@ enum vtn_variable_mode {
|
|||||||
vtn_variable_mode_cross_workgroup,
|
vtn_variable_mode_cross_workgroup,
|
||||||
vtn_variable_mode_input,
|
vtn_variable_mode_input,
|
||||||
vtn_variable_mode_output,
|
vtn_variable_mode_output,
|
||||||
|
vtn_variable_mode_image,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vtn_pointer {
|
struct vtn_pointer {
|
||||||
|
@@ -1779,6 +1779,10 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
|
|||||||
mode = vtn_variable_mode_cross_workgroup;
|
mode = vtn_variable_mode_cross_workgroup;
|
||||||
nir_mode = nir_var_mem_global;
|
nir_mode = nir_var_mem_global;
|
||||||
break;
|
break;
|
||||||
|
case SpvStorageClassImage:
|
||||||
|
mode = vtn_variable_mode_image;
|
||||||
|
nir_mode = nir_var_mem_ubo;
|
||||||
|
break;
|
||||||
case SpvStorageClassGeneric:
|
case SpvStorageClassGeneric:
|
||||||
default:
|
default:
|
||||||
vtn_fail("Unhandled variable storage class: %s (%u)",
|
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_uniform:
|
||||||
case vtn_variable_mode_input:
|
case vtn_variable_mode_input:
|
||||||
case vtn_variable_mode_output:
|
case vtn_variable_mode_output:
|
||||||
|
case vtn_variable_mode_image:
|
||||||
return nir_address_format_logical;
|
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);
|
b->shader->num_uniforms = vtn_type_block_size(b, type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case vtn_variable_mode_image:
|
||||||
|
vtn_fail("Cannot create a variable with the Image storage class");
|
||||||
|
break;
|
||||||
|
|
||||||
case vtn_variable_mode_phys_ssbo:
|
case vtn_variable_mode_phys_ssbo:
|
||||||
vtn_fail("Cannot create a variable with the "
|
vtn_fail("Cannot create a variable with the "
|
||||||
"PhysicalStorageBufferEXT storage class");
|
"PhysicalStorageBufferEXT storage class");
|
||||||
@@ -2244,6 +2253,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
|
|||||||
/* These don't need actual variables. */
|
/* These don't need actual variables. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case vtn_variable_mode_image:
|
||||||
case vtn_variable_mode_phys_ssbo:
|
case vtn_variable_mode_phys_ssbo:
|
||||||
unreachable("Should have been caught before");
|
unreachable("Should have been caught before");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user