Skip to content

Why are all storage buffers treated like runtime arrays ? #304

@rcmz

Description

@rcmz

I'm trying to get the size of descriptor blocks.
For uniform buffers it seems to work, but for storage buffers block.size is zero.
This is caused by this bit of code in spirv_reflect.c :

bool is_parent_rta = (p_descriptor->descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER);
    result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, is_parent_rta, &p_descriptor->block);
    if (result != SPV_REFLECT_RESULT_SUCCESS) {
      return result;
    }

    if (is_parent_rta) {
      p_descriptor->block.size = 0;
      p_descriptor->block.padded_size = 0;
    }
  }

Why are all storage buffers treated runtime arrays ?
(I presume that's what is_parent_rta mean)

PS:
My wider goal is to make an automated system to create C structs that exactly represent shader block variables (with correct alignment and size).
I assume that is a common goal here, so if you have pointers to similar projects I'm interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions