anv: Set alignments on descriptor and constant loads
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 26 Mar 2020 20:46:56 +0000 (15:46 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 30 Mar 2020 15:46:19 +0000 (15:46 +0000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4338>

src/intel/vulkan/anv_nir_apply_pipeline_layout.c

index aafa63ece50f041a13cd63256819f7f92c292e10..b5b7cd080411c5b01b834d921830283e49307f87 100644 (file)
@@ -534,6 +534,7 @@ build_ssbo_descriptor_load(const VkDescriptorType desc_type,
       nir_intrinsic_instr_create(b->shader, nir_intrinsic_load_ubo);
    desc_load->src[0] = nir_src_for_ssa(desc_buffer_index);
    desc_load->src[1] = nir_src_for_ssa(desc_offset);
+   nir_intrinsic_set_align(desc_load, 8, 0);
    desc_load->num_components = 4;
    nir_ssa_dest_init(&desc_load->instr, &desc_load->dest, 4, 32, NULL);
    nir_builder_instr_insert(b, &desc_load->instr);
@@ -714,6 +715,7 @@ build_descriptor_load(nir_deref_instr *deref, unsigned offset,
       nir_intrinsic_instr_create(b->shader, nir_intrinsic_load_ubo);
    desc_load->src[0] = nir_src_for_ssa(desc_buffer_index);
    desc_load->src[1] = nir_src_for_ssa(desc_offset);
+   nir_intrinsic_set_align(desc_load, 8, offset % 8);
    desc_load->num_components = num_components;
    nir_ssa_dest_init(&desc_load->instr, &desc_load->dest,
                      num_components, bit_size, NULL);
@@ -798,6 +800,7 @@ lower_load_constant(nir_intrinsic_instr *intrin,
    load_ubo->num_components = intrin->num_components;
    load_ubo->src[0] = nir_src_for_ssa(index);
    load_ubo->src[1] = nir_src_for_ssa(offset);
+   nir_intrinsic_set_align(load_ubo, intrin->dest.ssa.bit_size / 8, 0);
    nir_ssa_dest_init(&load_ubo->instr, &load_ubo->dest,
                      intrin->dest.ssa.num_components,
                      intrin->dest.ssa.bit_size, NULL);