Skip to content
  • Boris Brezillon's avatar
    nir: Set proper alignment when splitting var copies · a539b00b
    Boris Brezillon authored
    
    
    Now that copy_deref are passed alignment information we should take it
    into account when splitting var copies. Note that we always pass an
    explicit alignment even if the copy is naturally aligned (which is
    normally encoded with a 0), but that shouldn't be a problem.
    
    We assume GL or CL size/align for natural alignment calculation, but
    this can easily be extended through the addition of a new helper taking
    a glsl_type_size_align_func.
    
    The last thing that's worth mentioning is the fact that we get struct
    field offsets with glsl_get_struct_field_offset() which returns the
    cached offset value. That means we rely on proper offset calculation at
    type creation. Another option would be to make
    struct_type_get_field_offset() public which can be passed a
    glsl_type_size_align_func.
    
    Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
    a539b00b