mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 09:20:23 +01:00
spirv: Pass the deref type to storage_class_to_mode for non-forward pointers
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> 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:
parent
2bef02696d
commit
2df055ab47
1 changed files with 17 additions and 2 deletions
|
|
@ -1524,6 +1524,10 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
|
|||
"OpTypeForwardPointer is only allowed in Vulkan with "
|
||||
"the PhysicalStorageBuffer storage class");
|
||||
|
||||
struct vtn_type *deref_type = NULL;
|
||||
if (opcode == SpvOpTypePointer)
|
||||
deref_type = vtn_get_type(b, w[3]);
|
||||
|
||||
if (val->value_type == vtn_value_type_invalid) {
|
||||
val->value_type = vtn_value_type_type;
|
||||
val->type = rzalloc(b, struct vtn_type);
|
||||
|
|
@ -1535,7 +1539,18 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
|
|||
* values so they need a real glsl_type.
|
||||
*/
|
||||
enum vtn_variable_mode mode = vtn_storage_class_to_mode(
|
||||
b, storage_class, NULL, NULL);
|
||||
b, storage_class, deref_type, NULL);
|
||||
|
||||
/* The deref type should only matter for the UniformConstant storage
|
||||
* class. In particular, it should never matter for any storage
|
||||
* classes that are allowed in combination with OpTypeForwardPointer.
|
||||
*/
|
||||
if (storage_class != SpvStorageClassUniform &&
|
||||
storage_class != SpvStorageClassUniformConstant) {
|
||||
assert(mode == vtn_storage_class_to_mode(b, storage_class,
|
||||
NULL, NULL));
|
||||
}
|
||||
|
||||
val->type->type = nir_address_format_to_glsl_type(
|
||||
vtn_mode_to_address_format(b, mode));
|
||||
} else {
|
||||
|
|
@ -1551,7 +1566,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
|
|||
"forward declaration of a pointer, OpTypePointer can "
|
||||
"only be used once for a given id.");
|
||||
|
||||
val->type->deref = vtn_get_type(b, w[3]);
|
||||
val->type->deref = deref_type;
|
||||
|
||||
/* Only certain storage classes use ArrayStride. The others (in
|
||||
* particular Workgroup) are expected to be laid out by the driver.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue