spirv: Add a guard for OpTypeForwardPointer storage classes

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6479>
This commit is contained in:
Jason Ekstrand 2020-11-04 12:31:41 -06:00 committed by Marge Bot
parent aabe37b969
commit 2bef02696d

View file

@ -1518,6 +1518,12 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
SpvStorageClass storage_class = w[2];
vtn_fail_if(opcode == SpvOpTypeForwardPointer &&
b->shader->info.stage != MESA_SHADER_KERNEL &&
storage_class != SpvStorageClassPhysicalStorageBuffer,
"OpTypeForwardPointer is only allowed in Vulkan with "
"the PhysicalStorageBuffer storage class");
if (val->value_type == vtn_value_type_invalid) {
val->value_type = vtn_value_type_type;
val->type = rzalloc(b, struct vtn_type);